feat: Chat request implementation #14
1 changed files with 12 additions and 12 deletions
|
@ -107,18 +107,6 @@ pub async fn handle_chat_response(
|
||||||
return Some(WsError::NoChatRequestFromRecipient.into());
|
return Some(WsError::NoChatRequestFromRecipient.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(conn_id) = ONLINE_USERS.is_online(sender_public_key).await {
|
|
||||||
ONLINE_USERS
|
|
||||||
.send(
|
|
||||||
&conn_id,
|
|
||||||
ServerEvent::chat_request_response(recipient_public_key, accepted),
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
} else {
|
|
||||||
// TODO: Create a table for chat request responses, and send them when
|
|
||||||
// the user logs in
|
|
||||||
}
|
|
||||||
|
|
||||||
// We don't need to handle the case where the sender is blacklisted or
|
// We don't need to handle the case where the sender is blacklisted or
|
||||||
// whitelisted already, just add it if it is not already there
|
// whitelisted already, just add it if it is not already there
|
||||||
let _ = if accepted {
|
let _ = if accepted {
|
||||||
|
@ -132,5 +120,17 @@ pub async fn handle_chat_response(
|
||||||
.await
|
.await
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if let Some(conn_id) = ONLINE_USERS.is_online(sender_public_key).await {
|
||||||
|
ONLINE_USERS
|
||||||
|
.send(
|
||||||
|
&conn_id,
|
||||||
|
ServerEvent::chat_request_response(recipient_public_key, accepted),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
} else {
|
||||||
|
// TODO: Create a table for chat request responses, and send them when
|
||||||
|
// the user logs in
|
||||||
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue