aboutsummaryrefslogtreecommitdiffstats
path: root/stanza
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-01-02 17:48:12 +0000
committerLibravatar cel 🌸 <cel@bunny.garden>2025-01-02 17:48:12 +0000
commit0e5f09b2bd05690f3d28f7076629031fcc2cc6e6 (patch)
tree29409764a94d570c8d9e929f1751a678355cb6ee /stanza
parent89351e956368ad3112127570ef03dd2547730ce5 (diff)
downloadluz-0e5f09b2bd05690f3d28f7076629031fcc2cc6e6.tar.gz
luz-0e5f09b2bd05690f3d28f7076629031fcc2cc6e6.tar.bz2
luz-0e5f09b2bd05690f3d28f7076629031fcc2cc6e6.zip
WIP: client
Diffstat (limited to 'stanza')
-rw-r--r--stanza/src/client/iq.rs6
-rw-r--r--stanza/src/roster.rs7
2 files changed, 10 insertions, 3 deletions
diff --git a/stanza/src/client/iq.rs b/stanza/src/client/iq.rs
index 6ee80ea..2e87636 100644
--- a/stanza/src/client/iq.rs
+++ b/stanza/src/client/iq.rs
@@ -9,6 +9,7 @@ use peanuts::{
use crate::{
bind::{self, Bind},
client::error::Error,
+ roster,
xep_0199::{self, Ping},
};
@@ -31,6 +32,7 @@ pub struct Iq {
pub enum Query {
Bind(Bind),
Ping(Ping),
+ Roster(roster::Query),
Unsupported,
}
@@ -39,6 +41,9 @@ impl FromElement for Query {
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)?)),
+ (Some(roster::XMLNS), "query") => {
+ Ok(Query::Roster(roster::Query::from_element(element)?))
+ }
_ => Ok(Query::Unsupported),
}
}
@@ -49,6 +54,7 @@ impl IntoElement for Query {
match self {
Query::Bind(bind) => bind.builder(),
Query::Ping(ping) => ping.builder(),
+ Query::Roster(query) => query.builder(),
// TODO: consider what to do if attempt to serialize unsupported
Query::Unsupported => todo!(),
}
diff --git a/stanza/src/roster.rs b/stanza/src/roster.rs
index b49fcc3..9209fad 100644
--- a/stanza/src/roster.rs
+++ b/stanza/src/roster.rs
@@ -8,6 +8,7 @@ use peanuts::{
pub const XMLNS: &str = "jabber:iq:roster";
+#[derive(Debug, Clone)]
pub struct Query {
ver: Option<String>,
items: Vec<Item>,
@@ -33,7 +34,7 @@ impl IntoElement for Query {
}
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct Item {
approved: Option<bool>,
ask: bool,
@@ -95,7 +96,7 @@ impl IntoElement for Item {
}
}
-#[derive(Default, Clone, Copy)]
+#[derive(Default, Clone, Copy, Debug)]
pub enum Subscription {
Both,
From,
@@ -132,7 +133,7 @@ impl ToString for Subscription {
}
}
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub struct Group(Option<String>);
impl FromElement for Group {