From 1e5d4b504901bbd8fbf884e0f006d5717e1bc88c Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Fri, 11 Apr 2025 06:51:03 +0100 Subject: feat(filamento): `get_messages_with_users()` --- filamento/src/lib.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'filamento/src/lib.rs') diff --git a/filamento/src/lib.rs b/filamento/src/lib.rs index 83d4991..97cc9cd 100644 --- a/filamento/src/lib.rs +++ b/filamento/src/lib.rs @@ -66,6 +66,12 @@ pub enum Command { /// get message history for chat (does appropriate mam things) // TODO: paging and filtering GetMessages(JID, oneshot::Sender, DatabaseError>>), + /// get message history for chat (does appropriate mam things) + // TODO: paging and filtering + GetMessagesWithUsers( + JID, + oneshot::Sender, DatabaseError>>, + ), /// delete a chat from your chat history, along with all the corresponding messages DeleteChat(JID, oneshot::Sender>), /// delete a message from your chat history @@ -360,6 +366,23 @@ impl Client { Ok(messages) } + pub async fn get_messages_with_users( + &self, + jid: JID, + ) -> Result, CommandError> { + let (send, recv) = oneshot::channel(); + self.send(CoreClientCommand::Command(Command::GetMessagesWithUsers( + jid, send, + ))) + .await + .map_err(|e| CommandError::Actor(Into::::into(e)))?; + let messages = timeout(self.timeout, recv) + .await + .map_err(|e| CommandError::Actor(Into::::into(e)))? + .map_err(|e| CommandError::Actor(Into::::into(e)))??; + Ok(messages) + } + pub async fn delete_chat(&self, jid: JID) -> Result<(), CommandError> { let (send, recv) = oneshot::channel(); self.send(CoreClientCommand::Command(Command::DeleteChat(jid, send))) -- cgit