diff options
author | 2025-04-03 03:41:38 +0100 | |
---|---|---|
committer | 2025-04-03 03:41:38 +0100 | |
commit | 91f1994af940085d5d475a97820900ebbf0eb553 (patch) | |
tree | 6aab872f71d17a785d3d9286742fef38983d274c /stanza/src/client/presence.rs | |
parent | 9ce3827a7d25714d17f266f0f50bb29f41090175 (diff) | |
download | luz-91f1994af940085d5d475a97820900ebbf0eb553.tar.gz luz-91f1994af940085d5d475a97820900ebbf0eb553.tar.bz2 luz-91f1994af940085d5d475a97820900ebbf0eb553.zip |
feat: better message handling, pep publish, xep_0172: nick
Diffstat (limited to 'stanza/src/client/presence.rs')
-rw-r--r-- | stanza/src/client/presence.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/stanza/src/client/presence.rs b/stanza/src/client/presence.rs index 8fb96be..bffb0d0 100644 --- a/stanza/src/client/presence.rs +++ b/stanza/src/client/presence.rs @@ -8,12 +8,14 @@ use peanuts::{ #[cfg(feature = "xep_0131")] use crate::xep_0131::Headers; +#[cfg(feature = "xep_0172")] +use crate::xep_0172::Nick; #[cfg(feature = "xep_0203")] use crate::xep_0203::Delay; use super::{error::Error, XMLNS}; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub struct Presence { pub from: Option<JID>, pub id: Option<String>, @@ -28,8 +30,9 @@ pub struct Presence { pub delay: Option<Delay>, #[cfg(feature = "xep_0131")] pub headers: Option<Headers>, - // TODO: ##other - // other: Vec<Other>, + #[cfg(feature = "xep_0172")] + pub nick: Option<Nick>, + // ##other pub errors: Vec<Error>, } @@ -55,6 +58,9 @@ impl FromElement for Presence { #[cfg(feature = "xep_0131")] let headers = element.child_opt()?; + #[cfg(feature = "xep_0172")] + let nick = element.child_opt()?; + Ok(Presence { from, id, @@ -69,6 +75,8 @@ impl FromElement for Presence { delay, #[cfg(feature = "xep_0131")] headers, + #[cfg(feature = "xep_0172")] + nick, }) } } @@ -92,6 +100,9 @@ impl IntoElement for Presence { #[cfg(feature = "xep_0131")] let builder = builder.push_child_opt(self.headers.clone()); + #[cfg(feature = "xep_0172")] + let builder = builder.push_child_opt(self.nick.clone()); + builder } } |