aboutsummaryrefslogtreecommitdiffstats
path: root/stanza/src/xep_0030/info.rs
diff options
context:
space:
mode:
Diffstat (limited to 'stanza/src/xep_0030/info.rs')
-rw-r--r--stanza/src/xep_0030/info.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/stanza/src/xep_0030/info.rs b/stanza/src/xep_0030/info.rs
index 589fd08..94cbabb 100644
--- a/stanza/src/xep_0030/info.rs
+++ b/stanza/src/xep_0030/info.rs
@@ -3,6 +3,9 @@ use peanuts::{
DeserializeError, Element,
};
+#[cfg(feature = "xep_0059")]
+use crate::xep_0059::Set;
+
pub const XMLNS: &str = "http://jabber.org/protocol/disco#info";
#[derive(Debug, Clone)]
@@ -10,6 +13,8 @@ pub struct Query {
pub node: Option<String>,
pub features: Vec<Feature>,
pub identities: Vec<Identity>,
+ #[cfg(feature = "xep_0059")]
+ pub set: Option<Set>,
}
impl FromElement for Query {
@@ -22,20 +27,30 @@ impl FromElement for Query {
let features = element.children()?;
let identities = element.children()?;
+ #[cfg(feature = "xep_0059")]
+ let set = element.child_opt()?;
+
Ok(Self {
node,
features,
identities,
+ #[cfg(feature = "xep_0059")]
+ set,
})
}
}
impl IntoElement for Query {
fn builder(&self) -> peanuts::element::ElementBuilder {
- Element::builder("query", Some(XMLNS))
+ let builder = Element::builder("query", Some(XMLNS))
.push_attribute_opt("node", self.node.clone())
.push_children(self.features.clone())
- .push_children(self.identities.clone())
+ .push_children(self.identities.clone());
+
+ #[cfg(feature = "xep_0059")]
+ let builder = builder.push_child_opt(self.set.clone());
+
+ builder
}
}