aboutsummaryrefslogtreecommitdiffstats
path: root/filamento/src/logic/process_stanza.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-04-11 06:07:37 +0100
committerLibravatar cel 🌸 <cel@bunny.garden>2025-04-11 06:07:37 +0100
commit76b148011e5c974ab20466d873f11c2c460c9351 (patch)
tree8dc9b3da249715d3ebe29c5c2e9366480d416768 /filamento/src/logic/process_stanza.rs
parente49b4e5ea59079fdf047d3d2eb63ddb895c3b0eb (diff)
downloadluz-76b148011e5c974ab20466d873f11c2c460c9351.tar.gz
luz-76b148011e5c974ab20466d873f11c2c460c9351.tar.bz2
luz-76b148011e5c974ab20466d873f11c2c460c9351.zip
feat(filamento): return from: `User` with `Message` on new message
Diffstat (limited to 'filamento/src/logic/process_stanza.rs')
-rw-r--r--filamento/src/logic/process_stanza.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/filamento/src/logic/process_stanza.rs b/filamento/src/logic/process_stanza.rs
index 51e20a4..1a29f70 100644
--- a/filamento/src/logic/process_stanza.rs
+++ b/filamento/src/logic/process_stanza.rs
@@ -26,6 +26,7 @@ use crate::{
files::FileStore,
presence::{Offline, Online, Presence, PresenceType, Show},
roster::Contact,
+ user::User,
};
use super::ClientLogic;
@@ -103,11 +104,25 @@ pub async fn recv_message<Fs: FileStore + Clone>(
}
};
+ let from_user = match logic.db().read_user(from.as_bare()).await {
+ Ok(u) => u,
+ Err(e) => {
+ error!("{}", e);
+ User {
+ jid: from.as_bare(),
+ nick: None,
+ avatar: None,
+ cached_status_message: None,
+ }
+ }
+ };
+
// update the client with the new message
logic
.update_sender()
.send(UpdateMessage::Message {
to: from.as_bare(),
+ from: from_user,
message,
})
.await;