From 3b6733f38b4e748e18021202a772e6f76f5b8751 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 21 Jul 2017 01:20:29 +0100 Subject: [PATCH] =?UTF-8?q?Upgrade=20to=20minidom=C2=A00.4.4=20to=20avoid?= =?UTF-8?q?=20having=20to=20redefine=20IntoElements=20for=20each=20Into.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.toml | 2 +- src/data_forms.rs | 20 +------------------- src/disco.rs | 14 +------------- src/ibr.rs | 8 +------- src/jingle.rs | 14 +------------- src/media_element.rs | 14 +------------- src/muc/user.rs | 26 +------------------------- src/pubsub/event.rs | 8 +------- src/roster.rs | 8 +------- 9 files changed, 9 insertions(+), 105 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b705381..b4a760b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ categories = ["parsing", "network-programming"] license = "MPL-2.0" [dependencies] -minidom = "0.4.3" +minidom = "0.4.4" jid = "0.2.0" base64 = "0.6.0" digest = "0.6.0" diff --git a/src/data_forms.rs b/src/data_forms.rs index bccdca0..eb751e0 100644 --- a/src/data_forms.rs +++ b/src/data_forms.rs @@ -7,7 +7,7 @@ use try_from::TryFrom; use std::str::FromStr; -use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter}; +use minidom::{Element, IntoAttributeValue}; use error::Error; use ns; @@ -46,12 +46,6 @@ impl From for Element { } } -impl IntoElements for Option_ { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[derive(Debug, Clone)] pub struct Field { pub var: String, @@ -80,12 +74,6 @@ impl From for Element { } } -impl IntoElements for Field { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - generate_attribute!(DataFormType, "type", { Cancel => "cancel", Form => "form", @@ -236,12 +224,6 @@ impl From for Element { } } -impl IntoElements for DataForm { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/src/disco.rs b/src/disco.rs index aee3de6..167440e 100644 --- a/src/disco.rs +++ b/src/disco.rs @@ -6,7 +6,7 @@ use try_from::TryFrom; -use minidom::{Element, IntoElements, ElementEmitter}; +use minidom::Element; use error::Error; use ns; @@ -62,12 +62,6 @@ impl From for Element { } } -impl IntoElements for Feature { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[derive(Debug, Clone)] pub struct Identity { pub category: String, // TODO: use an enum here. @@ -88,12 +82,6 @@ impl From for Element { } } -impl IntoElements for Identity { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[derive(Debug, Clone)] pub struct DiscoInfoResult { pub node: Option, diff --git a/src/ibr.rs b/src/ibr.rs index 59dc15d..c51153e 100644 --- a/src/ibr.rs +++ b/src/ibr.rs @@ -7,7 +7,7 @@ use std::collections::HashMap; use try_from::TryFrom; -use minidom::{Element, IntoElements, ElementEmitter}; +use minidom::Element; use error::Error; @@ -78,12 +78,6 @@ impl From for Element { } } -impl IntoElements for Query { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/src/jingle.rs b/src/jingle.rs index 1d0c07f..62fb4b5 100644 --- a/src/jingle.rs +++ b/src/jingle.rs @@ -7,7 +7,7 @@ use try_from::TryFrom; use std::str::FromStr; -use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter}; +use minidom::{Element, IntoAttributeValue}; use jid::Jid; use error::Error; @@ -110,12 +110,6 @@ impl From for Element { } } -impl IntoElements for Content { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[derive(Debug, Clone, PartialEq)] pub enum Reason { AlternativeSession, //(String), @@ -240,12 +234,6 @@ impl From for Element { } } -impl IntoElements for ReasonElement { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - generate_id!(SessionId); #[derive(Debug, Clone)] diff --git a/src/media_element.rs b/src/media_element.rs index aa15efb..b2e5857 100644 --- a/src/media_element.rs +++ b/src/media_element.rs @@ -6,7 +6,7 @@ use try_from::TryFrom; -use minidom::{Element, IntoElements, ElementEmitter}; +use minidom::Element; use error::Error; @@ -28,12 +28,6 @@ impl From for Element { } } -impl IntoElements for URI { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[derive(Debug, Clone)] pub struct MediaElement { pub width: Option, @@ -81,12 +75,6 @@ impl From for Element { } } -impl IntoElements for MediaElement { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[cfg(test)] mod tests { use super::*; diff --git a/src/muc/user.rs b/src/muc/user.rs index 48da796..afc9e72 100644 --- a/src/muc/user.rs +++ b/src/muc/user.rs @@ -8,7 +8,7 @@ use try_from::{TryFrom, TryInto}; use std::str::FromStr; -use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter}; +use minidom::{Element, IntoAttributeValue}; use jid::Jid; @@ -142,12 +142,6 @@ impl From for Element { } } -impl IntoElements for Status { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - /// Optional element used in elements inside presence stanzas of type /// "unavailable" that are sent to users who are kick or banned, as well as within IQs for tracking /// purposes. -- CHANGELOG 0.17 (2002-10-23) @@ -198,12 +192,6 @@ impl From for Element { } } -impl IntoElements for Actor { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[derive(Debug, Clone, PartialEq)] pub struct Continue { thread: Option, @@ -237,12 +225,6 @@ impl From for Element { } } -impl IntoElements for Continue { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[derive(Debug, Clone, PartialEq)] pub struct Reason(String); @@ -272,12 +254,6 @@ impl From for Element { } } -impl IntoElements for Reason { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - generate_attribute!(Affiliation, "affiliation", { Owner => "owner", Admin => "admin", diff --git a/src/pubsub/event.rs b/src/pubsub/event.rs index 04519e9..a6fa455 100644 --- a/src/pubsub/event.rs +++ b/src/pubsub/event.rs @@ -7,7 +7,7 @@ use try_from::TryFrom; use std::str::FromStr; -use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter}; +use minidom::{Element, IntoAttributeValue}; use jid::Jid; use chrono::{DateTime, FixedOffset}; @@ -37,12 +37,6 @@ impl From for Element { } } -impl IntoElements for Item { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - generate_attribute!(Subscription, "subscription", { None => "none", Pending => "pending", diff --git a/src/roster.rs b/src/roster.rs index a1ed2dc..1a4cc50 100644 --- a/src/roster.rs +++ b/src/roster.rs @@ -7,7 +7,7 @@ use try_from::TryFrom; use std::str::FromStr; -use minidom::{Element, IntoElements, IntoAttributeValue, ElementEmitter}; +use minidom::{Element, IntoAttributeValue}; use jid::Jid; use error::Error; @@ -70,12 +70,6 @@ impl From for Element { } } -impl IntoElements for Item { - fn into_elements(self, emitter: &mut ElementEmitter) { - emitter.append_child(self.into()); - } -} - #[derive(Debug, Clone)] pub struct Roster { pub ver: Option,