aboutsummaryrefslogtreecommitdiffstats
path: root/stanza/src/client/iq.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-03-24 20:51:15 +0000
committerLibravatar cel 🌸 <cel@bunny.garden>2025-03-24 20:51:15 +0000
commit85a3093674506b60b31a023ae40df1d65b2f1fb4 (patch)
tree3443a36a3bf02544440a934d387c5b85e83b2264 /stanza/src/client/iq.rs
parentf0cb64670a7fdc49c334d99428458dfaf450171c (diff)
downloadluz-85a3093674506b60b31a023ae40df1d65b2f1fb4.tar.gz
luz-85a3093674506b60b31a023ae40df1d65b2f1fb4.tar.bz2
luz-85a3093674506b60b31a023ae40df1d65b2f1fb4.zip
feat(stanza): xep-0030
Diffstat (limited to 'stanza/src/client/iq.rs')
-rw-r--r--stanza/src/client/iq.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/stanza/src/client/iq.rs b/stanza/src/client/iq.rs
index 5c39938..5f5ccd2 100644
--- a/stanza/src/client/iq.rs
+++ b/stanza/src/client/iq.rs
@@ -13,6 +13,9 @@ use crate::{
xep_0199::{self, Ping},
};
+#[cfg(feature = "xep_0030")]
+use crate::xep_0030::{self, info, items};
+
use super::XMLNS;
#[derive(Debug, Clone)]
@@ -31,6 +34,10 @@ pub struct Iq {
#[derive(Clone, Debug)]
pub enum Query {
Bind(Bind),
+ #[cfg(feature = "xep_0030")]
+ DiscoInfo(info::Query),
+ #[cfg(feature = "xep_0030")]
+ DiscoItems(items::Query),
Ping(Ping),
Roster(roster::Query),
Unsupported,
@@ -44,6 +51,14 @@ impl FromElement for Query {
(Some(roster::XMLNS), "query") => {
Ok(Query::Roster(roster::Query::from_element(element)?))
}
+ #[cfg(feature = "xep_0030")]
+ (Some(xep_0030::info::XMLNS), "query") => {
+ Ok(Query::DiscoInfo(info::Query::from_element(element)?))
+ }
+ #[cfg(feature = "xep_0030")]
+ (Some(xep_0030::items::XMLNS), "query") => {
+ Ok(Query::DiscoItems(items::Query::from_element(element)?))
+ }
_ => Ok(Query::Unsupported),
}
}
@@ -57,6 +72,10 @@ impl IntoElement for Query {
Query::Roster(query) => query.builder(),
// TODO: consider what to do if attempt to serialize unsupported
Query::Unsupported => todo!(),
+ #[cfg(feature = "xep_0030")]
+ Query::DiscoInfo(query) => query.builder(),
+ #[cfg(feature = "xep_0030")]
+ Query::DiscoItems(query) => query.builder(),
}
}
}