diff options
Diffstat (limited to 'stanza/src/client/iq.rs')
-rw-r--r-- | stanza/src/client/iq.rs | 19 |
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(), } } } |