aboutsummaryrefslogtreecommitdiffstats
path: root/stanza
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-01-28 22:57:17 +0000
committerLibravatar cel 🌸 <cel@bunny.garden>2025-01-28 22:57:17 +0000
commitb023c6b5f214759a53b5c118b00305925294ee7d (patch)
tree980d56aacfe5fe160b39753ec48b240fac78c8b1 /stanza
parent866e134371a88c221862d3646f67e6cff6624a30 (diff)
downloadluz-b023c6b5f214759a53b5c118b00305925294ee7d.tar.gz
luz-b023c6b5f214759a53b5c118b00305925294ee7d.tar.bz2
luz-b023c6b5f214759a53b5c118b00305925294ee7d.zip
WIP: luz initial client
Diffstat (limited to 'stanza')
-rw-r--r--stanza/src/roster.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/stanza/src/roster.rs b/stanza/src/roster.rs
index 9209fad..ec83403 100644
--- a/stanza/src/roster.rs
+++ b/stanza/src/roster.rs
@@ -10,8 +10,8 @@ pub const XMLNS: &str = "jabber:iq:roster";
#[derive(Debug, Clone)]
pub struct Query {
- ver: Option<String>,
- items: Vec<Item>,
+ pub ver: Option<String>,
+ pub items: Vec<Item>,
}
impl FromElement for Query {
@@ -36,11 +36,16 @@ impl IntoElement for Query {
#[derive(Clone, Debug)]
pub struct Item {
+ /// signals subscription pre-approval (server only)
approved: Option<bool>,
+ /// signals subscription sub-states (server only)
ask: bool,
+ /// uniquely identifies item
jid: JID,
+ /// handle that is determined by user, not contact
name: Option<String>,
- subscription: Subscription,
+ /// state of the presence subscription
+ subscription: Option<Subscription>,
groups: Vec<Group>,
}
@@ -63,7 +68,7 @@ impl FromElement for Item {
};
let jid = element.attribute("jid")?;
let name = element.attribute_opt("name")?;
- let subscription = element.attribute_opt("subscription")?.unwrap_or_default();
+ let subscription = element.attribute_opt("subscription")?;
let groups = element.pop_children()?;
Ok(Self {
@@ -91,7 +96,7 @@ impl IntoElement for Item {
)
.push_attribute("jid", self.jid.clone())
.push_attribute_opt("name", self.name.clone())
- .push_attribute("subscription", self.subscription)
+ .push_attribute_opt("subscription", self.subscription)
.push_children(self.groups.clone())
}
}
@@ -134,6 +139,7 @@ impl ToString for Subscription {
}
#[derive(Clone, Debug)]
+// TODO: check if should be option or not
pub struct Group(Option<String>);
impl FromElement for Group {