diff options
author | 2025-04-01 21:40:23 +0100 | |
---|---|---|
committer | 2025-04-01 21:40:23 +0100 | |
commit | 9ce3827a7d25714d17f266f0f50bb29f41090175 (patch) | |
tree | b34f4d9c947cf7bc21e90f1a6723fd58801e8e8f /stanza/src/client/presence.rs | |
parent | 448208337c3a404403e6b312dbe38555a2bf8ad5 (diff) | |
download | luz-9ce3827a7d25714d17f266f0f50bb29f41090175.tar.gz luz-9ce3827a7d25714d17f266f0f50bb29f41090175.tar.bz2 luz-9ce3827a7d25714d17f266f0f50bb29f41090175.zip |
feat(stanza): xep-0131: stanza headers
Diffstat (limited to 'stanza/src/client/presence.rs')
-rw-r--r-- | stanza/src/client/presence.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/stanza/src/client/presence.rs b/stanza/src/client/presence.rs index ae38756..8fb96be 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_0131")] +use crate::xep_0131::Headers; #[cfg(feature = "xep_0203")] use crate::xep_0203::Delay; @@ -24,6 +26,8 @@ pub struct Presence { pub priority: Option<Priority>, #[cfg(feature = "xep_0203")] pub delay: Option<Delay>, + #[cfg(feature = "xep_0131")] + pub headers: Option<Headers>, // TODO: ##other // other: Vec<Other>, pub errors: Vec<Error>, @@ -48,6 +52,9 @@ impl FromElement for Presence { #[cfg(feature = "xep_0203")] let delay = element.child_opt()?; + #[cfg(feature = "xep_0131")] + let headers = element.child_opt()?; + Ok(Presence { from, id, @@ -60,6 +67,8 @@ impl FromElement for Presence { errors, #[cfg(feature = "xep_0203")] delay, + #[cfg(feature = "xep_0131")] + headers, }) } } @@ -80,6 +89,9 @@ impl IntoElement for Presence { #[cfg(feature = "xep_0203")] let builder = builder.push_child_opt(self.delay.clone()); + #[cfg(feature = "xep_0131")] + let builder = builder.push_child_opt(self.headers.clone()); + builder } } |