From 06fd0a354add50fc503960dbfdc2d702d37382db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Thu, 28 Dec 2017 06:05:13 +0100 Subject: [PATCH] client: Adapt to quickxml --- src/client.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/client.rs b/src/client.rs index bfab174..b2a0053 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,4 +1,3 @@ -use xml; use jid::Jid; use transport::{Transport, SslTransport}; use error::Error; @@ -17,7 +16,7 @@ use base64; use minidom::Element; -use xml::reader::XmlEvent as ReaderEvent; +use quick_xml::events::Event as XmlEvent; use std::sync::{Mutex, Arc}; @@ -156,10 +155,6 @@ impl Client { self.transport.lock().unwrap().write_element(elem) } - fn read_event(&self) -> Result { - self.transport.lock().unwrap().read_event() - } - fn connect(&mut self, mut credentials: SaslCredentials) -> Result<(), Error> { let features = self.wait_for_features()?; let ms = &features.sasl_mechanisms.ok_or(Error::SaslError(Some("no SASL mechanisms".to_owned())))?; @@ -269,9 +264,10 @@ impl Client { fn wait_for_features(&mut self) -> Result { // TODO: this is very ugly loop { - let e = self.read_event()?; + let mut transport = self.transport.lock().unwrap(); + let e = transport.read_event(); match e { - ReaderEvent::StartElement { .. } => { + Ok(XmlEvent::Start { .. }) => { break; }, _ => (),