aboutsummaryrefslogtreecommitdiffstats
path: root/stanza
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-04-03 13:20:29 +0100
committerLibravatar cel 🌸 <cel@bunny.garden>2025-04-03 13:20:29 +0100
commitf48642bbd5a210b68e60715b59b1f24cf2d77fea (patch)
tree4316bbb8355cc1dfd66a22dde480a49e9158ec59 /stanza
parentbf00184a09418750caeb488d8d71f9dc7afd7aff (diff)
downloadluz-f48642bbd5a210b68e60715b59b1f24cf2d77fea.tar.gz
luz-f48642bbd5a210b68e60715b59b1f24cf2d77fea.tar.bz2
luz-f48642bbd5a210b68e60715b59b1f24cf2d77fea.zip
feat(filamento): caps 1.0
Diffstat (limited to 'stanza')
-rw-r--r--stanza/src/client/presence.rs12
-rw-r--r--stanza/src/xep_0115.rs9
2 files changed, 17 insertions, 4 deletions
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<Headers>,
#[cfg(feature = "xep_0172")]
pub nick: Option<Nick>,
+ #[cfg(feature = "xep_0115")]
+ pub c: Option<C>,
// ##other
pub errors: Vec<Error>,
}
@@ -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<String>,
- hash: String,
- node: String,
- ver: String,
+ pub ext: Option<String>,
+ pub hash: String,
+ pub node: String,
+ pub ver: String,
}
impl FromElement for C {