From f48642bbd5a210b68e60715b59b1f24cf2d77fea Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Thu, 3 Apr 2025 13:20:29 +0100 Subject: feat(filamento): caps 1.0 --- stanza/src/client/presence.rs | 12 ++++++++++++ stanza/src/xep_0115.rs | 9 +++++---- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'stanza') diff --git a/stanza/src/client/presence.rs b/stanza/src/client/presence.rs index bffb0d0..a8c35d0 100644 --- a/stanza/src/client/presence.rs +++ b/stanza/src/client/presence.rs @@ -6,6 +6,8 @@ use peanuts::{ DeserializeError, Element, XML_NS, }; +#[cfg(feature = "xep_0115")] +use crate::xep_0115::C; #[cfg(feature = "xep_0131")] use crate::xep_0131::Headers; #[cfg(feature = "xep_0172")] @@ -32,6 +34,8 @@ pub struct Presence { pub headers: Option, #[cfg(feature = "xep_0172")] pub nick: Option, + #[cfg(feature = "xep_0115")] + pub c: Option, // ##other pub errors: Vec, } @@ -61,6 +65,9 @@ impl FromElement for Presence { #[cfg(feature = "xep_0172")] let nick = element.child_opt()?; + #[cfg(feature = "xep_0115")] + let c = element.child_opt()?; + Ok(Presence { from, id, @@ -77,6 +84,8 @@ impl FromElement for Presence { headers, #[cfg(feature = "xep_0172")] nick, + #[cfg(feature = "xep_0115")] + c, }) } } @@ -103,6 +112,9 @@ impl IntoElement for Presence { #[cfg(feature = "xep_0172")] let builder = builder.push_child_opt(self.nick.clone()); + #[cfg(feature = "xep_0115")] + let builder = builder.push_child_opt(self.c.clone()); + builder } } diff --git a/stanza/src/xep_0115.rs b/stanza/src/xep_0115.rs index c4eee54..1c2ef69 100644 --- a/stanza/src/xep_0115.rs +++ b/stanza/src/xep_0115.rs @@ -5,11 +5,12 @@ use peanuts::{ pub const XMLNS: &str = "http://jabber.org/protocol/caps"; +#[derive(Debug, Clone)] pub struct C { - ext: Option, - hash: String, - node: String, - ver: String, + pub ext: Option, + pub hash: String, + pub node: String, + pub ver: String, } impl FromElement for C { -- cgit