From b023c6b5f214759a53b5c118b00305925294ee7d Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Tue, 28 Jan 2025 22:57:17 +0000 Subject: WIP: luz initial client --- stanza/src/roster.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'stanza') 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, - items: Vec, + pub ver: Option, + pub items: Vec, } 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, + /// signals subscription sub-states (server only) ask: bool, + /// uniquely identifies item jid: JID, + /// handle that is determined by user, not contact name: Option, - subscription: Subscription, + /// state of the presence subscription + subscription: Option, groups: Vec, } @@ -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); impl FromElement for Group { -- cgit