aboutsummaryrefslogtreecommitdiffstats
path: root/stanza/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'stanza/src/client')
-rw-r--r--stanza/src/client/error.rs7
-rw-r--r--stanza/src/client/iq.rs13
-rw-r--r--stanza/src/client/message.rs21
-rw-r--r--stanza/src/client/mod.rs12
-rw-r--r--stanza/src/client/presence.rs21
5 files changed, 31 insertions, 43 deletions
diff --git a/stanza/src/client/error.rs b/stanza/src/client/error.rs
index c4ab517..9cc85a9 100644
--- a/stanza/src/client/error.rs
+++ b/stanza/src/client/error.rs
@@ -1,8 +1,7 @@
use std::fmt::Display;
use std::str::FromStr;
-use peanuts::element::{FromElement, IntoElement};
-use peanuts::{DeserializeError, Element};
+use peanuts::{DeserializeError, Element, FromElement, IntoElement};
use thiserror::Error;
use crate::stanza_error::Error as StanzaError;
@@ -40,7 +39,7 @@ impl Display for Error {
}
impl FromElement for Error {
- fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
element.check_name("error")?;
element.check_name(XMLNS)?;
@@ -59,7 +58,7 @@ impl FromElement for Error {
}
impl IntoElement for Error {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("error", Some(XMLNS))
.push_attribute_opt("by", self.by.clone())
.push_attribute("type", self.r#type)
diff --git a/stanza/src/client/iq.rs b/stanza/src/client/iq.rs
index a1d58f6..478530a 100644
--- a/stanza/src/client/iq.rs
+++ b/stanza/src/client/iq.rs
@@ -1,10 +1,7 @@
use std::str::FromStr;
use jid::JID;
-use peanuts::{
- element::{FromElement, IntoElement},
- DeserializeError, Element, XML_NS,
-};
+use peanuts::{DeserializeError, Element, FromElement, IntoElement, XML_NS};
use crate::{
bind::{self, Bind},
@@ -60,7 +57,7 @@ pub enum Query {
}
impl FromElement for Query {
- fn from_element(element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
match element.identify() {
(Some(bind::XMLNS), "bind") => Ok(Query::Bind(Bind::from_element(element)?)),
#[cfg(feature = "xep_0199")]
@@ -89,7 +86,7 @@ impl FromElement for Query {
}
impl IntoElement for Query {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
match self {
Query::Bind(bind) => bind.builder(),
#[cfg(feature = "xep_0199")]
@@ -111,7 +108,7 @@ impl IntoElement for Query {
}
impl FromElement for Iq {
- fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
element.check_name("iq")?;
element.check_namespace(XMLNS)?;
@@ -136,7 +133,7 @@ impl FromElement for Iq {
}
impl IntoElement for Iq {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("iq", Some(XMLNS))
.push_attribute_opt("from", self.from.clone())
.push_attribute("id", self.id.clone())
diff --git a/stanza/src/client/message.rs b/stanza/src/client/message.rs
index 78258ca..41761d2 100644
--- a/stanza/src/client/message.rs
+++ b/stanza/src/client/message.rs
@@ -1,10 +1,7 @@
use std::str::FromStr;
use jid::JID;
-use peanuts::{
- element::{FromElement, IntoElement},
- DeserializeError, Element, XML_NS,
-};
+use peanuts::{DeserializeError, Element, FromElement, IntoElement, XML_NS};
#[cfg(feature = "xep_0060")]
use crate::xep_0060::event::Event;
@@ -40,7 +37,7 @@ pub struct Message {
}
impl FromElement for Message {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("message")?;
element.check_namespace(XMLNS)?;
@@ -88,7 +85,7 @@ impl FromElement for Message {
}
impl IntoElement for Message {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
let builder = Element::builder("message", Some(XMLNS))
.push_attribute_opt("from", self.from.clone())
.push_attribute_opt("id", self.id.clone())
@@ -166,7 +163,7 @@ pub struct Body {
}
impl FromElement for Body {
- fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
element.check_name("body")?;
element.check_namespace(XMLNS)?;
@@ -178,7 +175,7 @@ impl FromElement for Body {
}
impl IntoElement for Body {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("body", Some(XMLNS))
.push_attribute_opt_namespaced(XML_NS, "lang", self.lang.clone())
.push_text_opt(self.body.clone())
@@ -192,7 +189,7 @@ pub struct Subject {
}
impl FromElement for Subject {
- fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
element.check_name("subject")?;
element.check_namespace(XMLNS)?;
@@ -204,7 +201,7 @@ impl FromElement for Subject {
}
impl IntoElement for Subject {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("subject", Some(XMLNS))
.push_attribute_opt_namespaced(XML_NS, "lang", self.lang.clone())
.push_text_opt(self.subject.clone())
@@ -218,7 +215,7 @@ pub struct Thread {
}
impl FromElement for Thread {
- fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
element.check_name("thread")?;
element.check_namespace(XMLNS)?;
@@ -230,7 +227,7 @@ impl FromElement for Thread {
}
impl IntoElement for Thread {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("thread", Some(XMLNS))
.push_attribute_opt("parent", self.parent.clone())
.push_text_opt(self.thread.clone())
diff --git a/stanza/src/client/mod.rs b/stanza/src/client/mod.rs
index a1b2de5..aca4fad 100644
--- a/stanza/src/client/mod.rs
+++ b/stanza/src/client/mod.rs
@@ -1,9 +1,7 @@
+use peanuts::{Content, ContentBuilder, DeserializeError, FromContent, FromElement, IntoContent};
+
use iq::Iq;
use message::Message;
-use peanuts::{
- element::{Content, ContentBuilder, FromContent, FromElement, IntoContent},
- DeserializeError,
-};
use presence::Presence;
use super::stream::{self, Error as StreamError};
@@ -26,7 +24,7 @@ pub enum Stanza {
}
impl FromContent for Stanza {
- fn from_content(content: Content) -> peanuts::element::DeserializeResult<Self> {
+ fn from_content(content: Content) -> peanuts::DeserializeResult<Self> {
match content {
Content::Element(element) => Ok(Stanza::from_element(element)?),
Content::Text(_) => Ok(Stanza::OtherContent(content)),
@@ -37,7 +35,7 @@ impl FromContent for Stanza {
}
impl FromElement for Stanza {
- fn from_element(element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
match element.identify() {
(Some(XMLNS), "message") => Ok(Stanza::Message(Message::from_element(element)?)),
(Some(XMLNS), "presence") => Ok(Stanza::Presence(Presence::from_element(element)?)),
@@ -51,7 +49,7 @@ impl FromElement for Stanza {
}
impl IntoContent for Stanza {
- fn builder(&self) -> peanuts::element::ContentBuilder {
+ fn builder(&self) -> peanuts::ContentBuilder {
match self {
Stanza::Message(message) => <Message as IntoContent>::builder(message),
Stanza::Presence(presence) => <Presence as IntoContent>::builder(presence),
diff --git a/stanza/src/client/presence.rs b/stanza/src/client/presence.rs
index a8c35d0..b0a0bc0 100644
--- a/stanza/src/client/presence.rs
+++ b/stanza/src/client/presence.rs
@@ -1,10 +1,7 @@
use std::str::FromStr;
use jid::JID;
-use peanuts::{
- element::{FromElement, IntoElement},
- DeserializeError, Element, XML_NS,
-};
+use peanuts::{DeserializeError, Element, FromElement, IntoElement, XML_NS};
#[cfg(feature = "xep_0115")]
use crate::xep_0115::C;
@@ -41,7 +38,7 @@ pub struct Presence {
}
impl FromElement for Presence {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("presence")?;
element.check_namespace(XMLNS)?;
@@ -91,7 +88,7 @@ impl FromElement for Presence {
}
impl IntoElement for Presence {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
let builder = Element::builder("presence", Some(XMLNS))
.push_attribute_opt("from", self.from.clone())
.push_attribute_opt("id", self.id.clone())
@@ -174,7 +171,7 @@ pub enum Show {
}
impl FromElement for Show {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("show")?;
element.check_namespace(XMLNS)?;
@@ -197,7 +194,7 @@ impl FromStr for Show {
}
impl IntoElement for Show {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("show", Some(XMLNS)).push_text(*self)
}
}
@@ -220,7 +217,7 @@ pub struct Status {
}
impl FromElement for Status {
- fn from_element(mut element: Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: Element) -> peanuts::DeserializeResult<Self> {
element.check_name("status")?;
element.check_namespace(XMLNS)?;
@@ -232,7 +229,7 @@ impl FromElement for Status {
}
impl IntoElement for Status {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("status", Some(XMLNS))
.push_attribute_opt_namespaced(XML_NS, "lang", self.lang.clone())
.push_text(self.status.clone())
@@ -263,7 +260,7 @@ impl ToString for String1024 {
pub struct Priority(pub i8);
impl FromElement for Priority {
- fn from_element(mut element: peanuts::Element) -> peanuts::element::DeserializeResult<Self> {
+ fn from_element(mut element: peanuts::Element) -> peanuts::DeserializeResult<Self> {
element.check_name("priority")?;
element.check_namespace(XMLNS)?;
@@ -272,7 +269,7 @@ impl FromElement for Priority {
}
impl IntoElement for Priority {
- fn builder(&self) -> peanuts::element::ElementBuilder {
+ fn builder(&self) -> peanuts::ElementBuilder {
Element::builder("priority", Some(XMLNS)).push_text(self.0)
}
}