aboutsummaryrefslogtreecommitdiffstats
path: root/stanza/src/client/iq.rs
diff options
context:
space:
mode:
Diffstat (limited to 'stanza/src/client/iq.rs')
-rw-r--r--stanza/src/client/iq.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/stanza/src/client/iq.rs b/stanza/src/client/iq.rs
index 388979e..6ee80ea 100644
--- a/stanza/src/client/iq.rs
+++ b/stanza/src/client/iq.rs
@@ -9,10 +9,12 @@ use peanuts::{
use crate::{
bind::{self, Bind},
client::error::Error,
+ xep_0199::{self, Ping},
};
use super::XMLNS;
+#[derive(Debug)]
pub struct Iq {
pub from: Option<JID>,
pub id: String,
@@ -25,9 +27,10 @@ pub struct Iq {
pub errors: Vec<Error>,
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub enum Query {
Bind(Bind),
+ Ping(Ping),
Unsupported,
}
@@ -35,6 +38,7 @@ impl FromElement for Query {
fn from_element(element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
match element.identify() {
(Some(bind::XMLNS), "bind") => Ok(Query::Bind(Bind::from_element(element)?)),
+ (Some(xep_0199::XMLNS), "ping") => Ok(Query::Ping(Ping::from_element(element)?)),
_ => Ok(Query::Unsupported),
}
}
@@ -44,6 +48,7 @@ impl IntoElement for Query {
fn builder(&self) -> peanuts::element::ElementBuilder {
match self {
Query::Bind(bind) => bind.builder(),
+ Query::Ping(ping) => ping.builder(),
// TODO: consider what to do if attempt to serialize unsupported
Query::Unsupported => todo!(),
}
@@ -88,7 +93,7 @@ impl IntoElement for Iq {
}
}
-#[derive(Copy, Clone, PartialEq, Eq)]
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum IqType {
Error,
Get,