diff --git a/crates/projection-xmpp/src/presence.rs b/crates/projection-xmpp/src/presence.rs index 7f9a2a4..5c51c52 100644 --- a/crates/projection-xmpp/src/presence.rs +++ b/crates/projection-xmpp/src/presence.rs @@ -149,14 +149,14 @@ impl<'a> XmppConnection<'a> { server: Server(self.hostname_rooms.clone()), resource: Option::from(Resource(history_message.author.name.clone().into())), }, - delay: Delay::new( - Jid { + delay: Delay { + from: Jid { name: Option::from(Name(history_message.author.name.clone().into())), server: Server(self.hostname_rooms.clone()), resource: None, }, - history_message.created_at.to_rfc3339(), - ), + stamp: history_message.created_at.to_rfc3339(), + }, body: history_message.content.clone(), }); tracing::info!( diff --git a/crates/proto-xmpp/src/muc/mod.rs b/crates/proto-xmpp/src/muc/mod.rs index 2105c4c..fecc58c 100644 --- a/crates/proto-xmpp/src/muc/mod.rs +++ b/crates/proto-xmpp/src/muc/mod.rs @@ -10,6 +10,7 @@ use crate::xml::*; pub const XMLNS: &'static str = "http://jabber.org/protocol/muc"; pub const XMLNS_USER: &'static str = "http://jabber.org/protocol/muc#user"; +pub const XMLNS_DELAY: &'static str = "urn:xmpp:delay"; #[derive(PartialEq, Eq, Debug, Default)] pub struct History { @@ -253,27 +254,16 @@ impl Role { #[derive(Debug, PartialEq, Eq)] pub struct Delay { - pub xmlns: String, pub from: Jid, pub stamp: String, } -impl Delay { - pub fn new(from: Jid, stamp: String) -> Self { - Self { - xmlns: "urn:xmpp:delay".into(), - from, - stamp, - } - } -} - impl ToXml for Delay { fn serialize(&self, events: &mut Vec) { let mut tag = BytesStart::new("delay"); tag.push_attribute(Attribute { key: QName(b"xmlns"), - value: self.xmlns.as_bytes().into(), + value: XMLNS_DELAY.as_bytes().into(), }); tag.push_attribute(Attribute { key: QName(b"from"),