From aab4cd47b1d2da5539c50675be4c7a36898189ef Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Fri, 11 Apr 2025 00:49:36 +0100 Subject: feat(filamento): `get_roster_with_users()` --- filamento/src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'filamento/src/lib.rs') diff --git a/filamento/src/lib.rs b/filamento/src/lib.rs index 7946241..9fa254e 100644 --- a/filamento/src/lib.rs +++ b/filamento/src/lib.rs @@ -52,6 +52,8 @@ pub mod user; pub enum Command { /// get the roster. if offline, retreive cached version from database. should be stored in application memory GetRoster(oneshot::Sender, RosterError>>), + /// get the roster. if offline, retreive cached version from database. should be stored in application memory. includes user associated with each contact + GetRosterWithUsers(oneshot::Sender, RosterError>>), /// get all chats. chat will include 10 messages in their message Vec (enough for chat previews) // TODO: paging and filtering GetChats(oneshot::Sender, DatabaseError>>), @@ -276,6 +278,22 @@ impl Client { Ok(roster) } + pub async fn get_roster_with_users( + &self, + ) -> Result, CommandError> { + let (send, recv) = oneshot::channel(); + self.send(CoreClientCommand::Command(Command::GetRosterWithUsers( + send, + ))) + .await + .map_err(|e| CommandError::Actor(Into::::into(e)))?; + let roster = timeout(self.timeout, recv) + .await + .map_err(|e| CommandError::Actor(Into::::into(e)))? + .map_err(|e| CommandError::Actor(Into::::into(e)))??; + Ok(roster) + } + pub async fn get_chats(&self) -> Result, CommandError> { let (send, recv) = oneshot::channel(); self.send(CoreClientCommand::Command(Command::GetChats(send))) -- cgit