aboutsummaryrefslogtreecommitdiffstats
path: root/stanza/src/xep_0060/pubsub.rs
diff options
context:
space:
mode:
Diffstat (limited to 'stanza/src/xep_0060/pubsub.rs')
-rw-r--r--stanza/src/xep_0060/pubsub.rs81
1 files changed, 39 insertions, 42 deletions
diff --git a/stanza/src/xep_0060/pubsub.rs b/stanza/src/xep_0060/pubsub.rs
index 0f698dc..0416b78 100644
--- a/stanza/src/xep_0060/pubsub.rs
+++ b/stanza/src/xep_0060/pubsub.rs
@@ -1,10 +1,7 @@
use std::str::FromStr;
use jid::JID;
-use peanuts::{
- element::{FromElement, IntoElement},
- DeserializeError, Element,
-};
+use peanuts::{DeserializeError, Element, FromElement, IntoElement};
use crate::xep_0004::X;
#[cfg(feature = "xep_0084")]
@@ -30,7 +27,7 @@ pub enum Pubsub {
}
impl FromElement for Pubsub {
- fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
element.check_name("pubsub")?;
element.check_namespace(XMLNS)?;
@@ -81,7 +78,7 @@ impl FromElement for Pubsub {
}
impl IntoElement for Pubsub {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
let element = Element::builder("pubsub", Some(XMLNS));
match self {
@@ -113,7 +110,7 @@ pub struct Affiliations {
}
impl FromElement for Affiliations {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("affiliations")?;
element.check_namespace(XMLNS)?;
@@ -126,7 +123,7 @@ impl FromElement for Affiliations {
}
impl IntoElement for Affiliations {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("affilations", Some(XMLNS))
.push_attribute_opt("node", self.node.clone())
.push_children(self.affiliations.clone())
@@ -141,7 +138,7 @@ pub struct Affiliation {
}
impl FromElement for Affiliation {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("affiliation")?;
element.check_namespace(XMLNS)?;
@@ -153,7 +150,7 @@ impl FromElement for Affiliation {
}
impl IntoElement for Affiliation {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("affiliation", Some(XMLNS))
.push_attribute("affiliation", self.affiliation.clone())
.push_attribute("node", self.node.clone())
@@ -204,7 +201,7 @@ impl ToString for AffiliationType {
pub struct Configure(Option<X>);
impl FromElement for Configure {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("configure")?;
element.check_namespace(XMLNS)?;
@@ -213,7 +210,7 @@ impl FromElement for Configure {
}
impl IntoElement for Configure {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("configure", Some(XMLNS)).push_child_opt(self.0.clone())
}
}
@@ -224,7 +221,7 @@ pub struct Create {
}
impl FromElement for Create {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("create")?;
element.check_namespace(XMLNS)?;
@@ -235,7 +232,7 @@ impl FromElement for Create {
}
impl IntoElement for Create {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("create", Some(XMLNS)).push_attribute_opt("node", self.node.clone())
}
}
@@ -249,7 +246,7 @@ pub struct Default {
}
impl FromElement for Default {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("default")?;
element.check_namespace(XMLNS)?;
@@ -267,7 +264,7 @@ impl FromElement for Default {
}
impl IntoElement for Default {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("default", Some(XMLNS))
.push_attribute_opt("node", self.node.clone())
.push_attribute_opt("type", self.r#type.clone())
@@ -312,7 +309,7 @@ pub struct Items {
}
impl FromElement for Items {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("items")?;
element.check_namespace(XMLNS)?;
@@ -332,7 +329,7 @@ impl FromElement for Items {
}
impl IntoElement for Items {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("items", Some(XMLNS))
.push_attribute_opt("max_items", self.max_items)
.push_attribute("node", self.node.clone())
@@ -349,7 +346,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)?;
@@ -367,7 +364,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("id", self.id.clone())
.push_attribute_opt("publisher", self.publisher.clone())
@@ -387,7 +384,7 @@ pub enum Content {
}
impl FromElement for Content {
- fn from_element(element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(element: Element) -> peanuts::DeserializeResult<Self> {
match element.identify() {
#[cfg(feature = "xep_0172")]
(Some(xep_0172::XMLNS), "nick") => Ok(Content::Nick(Nick::from_element(element)?)),
@@ -405,7 +402,7 @@ impl FromElement for Content {
}
impl IntoElement for Content {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
match self {
#[cfg(feature = "xep_0172")]
Content::Nick(nick) => nick.builder(),
@@ -427,7 +424,7 @@ pub struct Options {
}
impl FromElement for Options {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("options")?;
element.check_namespace(XMLNS)?;
@@ -447,7 +444,7 @@ impl FromElement for Options {
}
impl IntoElement for Options {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("options", Some(XMLNS))
.push_attribute("jid", self.jid.clone())
.push_attribute_opt("node", self.node.clone())
@@ -463,7 +460,7 @@ pub struct Publish {
}
impl FromElement for Publish {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("publish")?;
element.check_namespace(XMLNS)?;
@@ -476,7 +473,7 @@ impl FromElement for Publish {
}
impl IntoElement for Publish {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("publish", Some(XMLNS))
.push_attribute("node", self.node.clone())
.push_children(self.items.clone())
@@ -487,7 +484,7 @@ impl IntoElement for Publish {
pub struct PublishOptions(pub Option<X>);
impl FromElement for PublishOptions {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("publish-options")?;
element.check_namespace(XMLNS)?;
@@ -496,7 +493,7 @@ impl FromElement for PublishOptions {
}
impl IntoElement for PublishOptions {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("publish-options", Some(XMLNS)).push_child_opt(self.0.clone())
}
}
@@ -510,7 +507,7 @@ pub struct Retract {
}
impl FromElement for Retract {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("retract")?;
element.check_namespace(XMLNS)?;
@@ -528,7 +525,7 @@ impl FromElement for Retract {
}
impl IntoElement for Retract {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("retract", Some(XMLNS))
.push_attribute("node", self.node.clone())
.push_attribute_opt("notify", self.notify)
@@ -543,7 +540,7 @@ pub struct SubscribeOptions {
}
impl FromElement for SubscribeOptions {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("subscribe-options")?;
element.check_namespace(XMLNS)?;
@@ -559,7 +556,7 @@ impl FromElement for SubscribeOptions {
}
impl IntoElement for SubscribeOptions {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
let builder = Element::builder("subscribe-options", Some(XMLNS));
if self.required {
@@ -573,7 +570,7 @@ impl IntoElement for SubscribeOptions {
pub struct Required;
impl FromElement for Required {
- fn from_element(element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("required")?;
element.check_namespace(XMLNS)?;
@@ -582,7 +579,7 @@ impl FromElement for Required {
}
impl IntoElement for Required {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("required", Some(XMLNS))
}
}
@@ -594,7 +591,7 @@ pub struct Subscribe {
}
impl FromElement for Subscribe {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("subscribe")?;
element.check_namespace(XMLNS)?;
@@ -606,7 +603,7 @@ impl FromElement for Subscribe {
}
impl IntoElement for Subscribe {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("subscribe", Some(XMLNS))
.push_attribute("jid", self.jid.clone())
.push_attribute_opt("node", self.node.clone())
@@ -620,7 +617,7 @@ pub struct Subscriptions {
}
impl FromElement for Subscriptions {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("subscriptions")?;
element.check_namespace(XMLNS)?;
@@ -636,7 +633,7 @@ impl FromElement for Subscriptions {
}
impl IntoElement for Subscriptions {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("subscriptions", Some(XMLNS))
.push_attribute_opt("node", self.node.clone())
.push_children(self.subscriptions.clone())
@@ -653,7 +650,7 @@ pub struct Subscription {
}
impl FromElement for Subscription {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("subscription")?;
element.check_namespace(XMLNS)?;
@@ -675,7 +672,7 @@ impl FromElement for Subscription {
}
impl IntoElement for Subscription {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("subscription", Some(XMLNS))
.push_attribute("jid", self.jid.clone())
.push_attribute_opt("node", self.node.clone())
@@ -727,7 +724,7 @@ pub struct Unsubscribe {
}
impl FromElement for Unsubscribe {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("unsubscribe")?;
element.check_namespace(XMLNS)?;
@@ -740,7 +737,7 @@ impl FromElement for Unsubscribe {
}
impl IntoElement for Unsubscribe {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("unsubscribe", Some(XMLNS))
.push_attribute("jid", self.jid.clone())
.push_attribute_opt("node", self.node.clone())