feat: Chat request implementation #14

Manually merged
awiteb merged 55 commits from awiteb/chat-request-and-response into master 2024-07-18 14:21:39 +02:00 AGit
Showing only changes of commit 6268b5fe48 - Show all commits

View file

@ -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
} }