diff options
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 } } |