aboutsummaryrefslogtreecommitdiffstats
path: root/filamento/src/logic
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--filamento/src/logic/local_only.rs7
-rw-r--r--filamento/src/logic/offline.rs12
-rw-r--r--filamento/src/logic/online.rs7
3 files changed, 18 insertions, 8 deletions
diff --git a/filamento/src/logic/local_only.rs b/filamento/src/logic/local_only.rs
index a22efbd..f5705f4 100644
--- a/filamento/src/logic/local_only.rs
+++ b/filamento/src/logic/local_only.rs
@@ -44,6 +44,13 @@ pub async fn handle_get_chat<Fs: FileStore + Clone>(
Ok(logic.db().read_chat(jid).await?)
}
+pub async fn handle_get_chat_and_user<Fs: FileStore + Clone>(
+ logic: &ClientLogic<Fs>,
+ jid: JID,
+) -> Result<(Chat, User), DatabaseError> {
+ Ok(logic.db().read_chat_and_user(jid).await?)
+}
+
pub async fn handle_get_message<Fs: FileStore + Clone>(
logic: &ClientLogic<Fs>,
id: Uuid,
diff --git a/filamento/src/logic/offline.rs b/filamento/src/logic/offline.rs
index 42a38ca..606b04f 100644
--- a/filamento/src/logic/offline.rs
+++ b/filamento/src/logic/offline.rs
@@ -19,13 +19,9 @@ use crate::{
};
use super::{
- ClientLogic,
local_only::{
- handle_delete_chat, handle_delete_messaage, handle_get_chat, handle_get_chats,
- handle_get_chats_ordered, handle_get_chats_ordered_with_latest_messages,
- handle_get_chats_ordered_with_latest_messages_and_users, handle_get_message,
- handle_get_messages, handle_get_messages_with_users, handle_get_user,
- },
+ handle_delete_chat, handle_delete_messaage, handle_get_chat, handle_get_chat_and_user, handle_get_chats, handle_get_chats_ordered, handle_get_chats_ordered_with_latest_messages, handle_get_chats_ordered_with_latest_messages_and_users, handle_get_message, handle_get_messages, handle_get_messages_with_users, handle_get_user
+ }, ClientLogic
};
pub async fn handle_offline<Fs: FileStore + Clone>(logic: ClientLogic<Fs>, command: Command<Fs>) {
@@ -89,6 +85,10 @@ pub async fn handle_offline_result<Fs: FileStore + Clone>(
let chats = handle_get_chat(logic, jid).await;
sender.send(chats);
}
+ Command::GetChatAndUser(jid, sender) => {
+ let chat = handle_get_chat_and_user(logic, jid).await;
+ let _ = sender.send(chat);
+ }
Command::GetMessage(id, sender) => {
let message = handle_get_message(logic, id).await;
let _ = sender.send(message);
diff --git a/filamento/src/logic/online.rs b/filamento/src/logic/online.rs
index 969e08a..9814ff2 100644
--- a/filamento/src/logic/online.rs
+++ b/filamento/src/logic/online.rs
@@ -23,8 +23,7 @@ use crate::{
use super::{
local_only::{
- handle_get_message,
- handle_delete_chat, handle_delete_messaage, handle_get_chat, handle_get_chats, handle_get_chats_ordered, handle_get_chats_ordered_with_latest_messages, handle_get_chats_ordered_with_latest_messages_and_users, handle_get_messages, handle_get_messages_with_users, handle_get_user
+ handle_delete_chat, handle_delete_messaage, handle_get_chat, handle_get_chat_and_user, handle_get_chats, handle_get_chats_ordered, handle_get_chats_ordered_with_latest_messages, handle_get_chats_ordered_with_latest_messages_and_users, handle_get_message, handle_get_messages, handle_get_messages_with_users, handle_get_user
}, ClientLogic
};
@@ -1111,6 +1110,10 @@ pub async fn handle_online_result<Fs: FileStore + Clone>(
let chat = handle_get_chat(logic, jid).await;
let _ = sender.send(chat);
}
+ Command::GetChatAndUser(jid, sender) => {
+ let chat = handle_get_chat_and_user(logic, jid).await;
+ let _ = sender.send(chat);
+ }
Command::GetMessage(id, sender) => {
let message = handle_get_message(logic, id).await;
let _ = sender.send(message);