diff options
Diffstat (limited to 'stanza/src/roster.rs')
-rw-r--r-- | stanza/src/roster.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/stanza/src/roster.rs b/stanza/src/roster.rs index 0181193..dcbf017 100644 --- a/stanza/src/roster.rs +++ b/stanza/src/roster.rs @@ -1,10 +1,7 @@ use std::str::FromStr; -use jid::JID; -use peanuts::{ - element::{FromElement, IntoElement}, - DeserializeError, Element, -}; +use jid::BareJID; +use peanuts::{DeserializeError, Element, FromElement, IntoElement}; pub const XMLNS: &str = "jabber:iq:roster"; @@ -15,7 +12,7 @@ pub struct Query { } impl FromElement for Query { - fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> { + fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> { element.check_name("query")?; element.check_namespace(XMLNS)?; @@ -27,7 +24,7 @@ impl FromElement for Query { } impl IntoElement for Query { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { Element::builder("query", Some(XMLNS)) .push_attribute_opt("ver", self.ver.clone()) .push_children(self.items.clone()) @@ -41,7 +38,7 @@ pub struct Item { /// signals subscription sub-states (server only) pub ask: bool, /// uniquely identifies item - pub jid: JID, + pub jid: BareJID, /// handle that is determined by user, not contact pub name: Option<String>, /// state of the presence subscription @@ -50,7 +47,7 @@ pub struct Item { } impl FromElement for Item { - fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> { + fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> { element.check_name("item")?; element.check_namespace(XMLNS)?; @@ -83,7 +80,7 @@ impl FromElement for Item { } impl IntoElement for Item { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { Element::builder("item", Some(XMLNS)) .push_attribute_opt("approved", self.approved) .push_attribute_opt( @@ -143,7 +140,7 @@ impl ToString for Subscription { pub struct Group(pub Option<String>); impl FromElement for Group { - fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> { + fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> { element.check_name("group")?; element.check_namespace(XMLNS)?; @@ -154,7 +151,7 @@ impl FromElement for Group { } impl IntoElement for Group { - fn builder(&self) -> peanuts::element::ElementBuilder { + fn builder(&self) -> peanuts::ElementBuilder { Element::builder("group", Some(XMLNS)).push_text_opt(self.0.clone()) } } |