diff --git a/Cargo.toml b/Cargo.toml index 3bcdbd2c..a62b4ba1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,12 +17,12 @@ tokio = "0.1" tokio-io = "0.1" tokio-codec = "0.1" bytes = "0.4" -xml5ever = "0.12" +xml5ever = "0.14" native-tls = "0.2" tokio-tls = "0.2" sasl = "0.4" -trust-dns-resolver = "0.10" -trust-dns-proto = "0.6" +trust-dns-resolver = "0.11" +trust-dns-proto = "0.7" xmpp-parsers = "0.13" idna = "0.1" quick-xml = "0.13" diff --git a/src/client/auth.rs b/src/client/auth.rs index d961f7a0..81210dc7 100644 --- a/src/client/auth.rs +++ b/src/client/auth.rs @@ -16,12 +16,12 @@ use crate::{AuthError, Error, ProtocolError}; const NS_XMPP_SASL: &str = "urn:ietf:params:xml:ns:xmpp-sasl"; pub struct ClientAuth { - future: Box, Error = Error>>, + future: Box, Error = Error>>, } impl ClientAuth { pub fn new(stream: XMPPStream, creds: Credentials) -> Result { - let local_mechs: Vec Box>> = vec![ + let local_mechs: Vec Box>> = vec![ Box::new(|| Box::new(Scram::::from_credentials(creds.clone()).unwrap())), Box::new(|| Box::new(Scram::::from_credentials(creds.clone()).unwrap())), Box::new(|| Box::new(Plain::from_credentials(creds.clone()).unwrap())), @@ -62,7 +62,7 @@ impl ClientAuth { Err(AuthError::NoMechanism)? } - fn handle_challenge(stream: XMPPStream, mut mechanism: Box) -> Box, Error = Error>> { + fn handle_challenge(stream: XMPPStream, mut mechanism: Box) -> Box, Error = Error>> { Box::new( stream.into_future() .map_err(|(e, _stream)| e.into()) diff --git a/src/client/mod.rs b/src/client/mod.rs index 99965dc8..37085788 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -33,7 +33,7 @@ const NS_JABBER_CLIENT: &str = "jabber:client"; enum ClientState { Invalid, Disconnected, - Connecting(Box>), + Connecting(Box>), Connected(XMPPStream), } diff --git a/src/component/mod.rs b/src/component/mod.rs index cfc1ee5e..87381117 100644 --- a/src/component/mod.rs +++ b/src/component/mod.rs @@ -30,7 +30,7 @@ const NS_JABBER_COMPONENT_ACCEPT: &str = "jabber:component:accept"; enum ComponentState { Invalid, Disconnected, - Connecting(Box>), + Connecting(Box>), Connected(XMPPStream), } diff --git a/src/error.rs b/src/error.rs index 375c5178..d8b2063d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -59,7 +59,7 @@ impl StdError for ParseError { fn description(&self) -> &str { self.0.as_ref() } - fn cause(&self) -> Option<&StdError> { + fn cause(&self) -> Option<&dyn StdError> { None } } diff --git a/src/happy_eyeballs.rs b/src/happy_eyeballs.rs index fc4e0280..7696f65e 100644 --- a/src/happy_eyeballs.rs +++ b/src/happy_eyeballs.rs @@ -79,7 +79,7 @@ impl Connecter { // Initialize state match &self_.srv_domain { &Some(ref srv_domain) => { - let srv_lookup = resolver.lookup_srv(srv_domain); + let srv_lookup = resolver.lookup_srv(srv_domain.clone()); self_.state = State::ResolveSrv(resolver, srv_lookup); } None => { diff --git a/src/lib.rs b/src/lib.rs index bfed02a5..07ae8784 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![deny(unsafe_code, unused, missing_docs)] +#![deny(unsafe_code, unused, missing_docs, bare_trait_objects)] //! XMPP implementation with asynchronous I/O using Tokio. diff --git a/src/xmpp_codec.rs b/src/xmpp_codec.rs index 482cd786..00020873 100644 --- a/src/xmpp_codec.rs +++ b/src/xmpp_codec.rs @@ -18,6 +18,7 @@ use std::borrow::Cow; use tokio_codec::{Decoder, Encoder}; use xml5ever::interface::Attribute; use xml5ever::tokenizer::{Tag, TagKind, Token, TokenSink, XmlTokenizer}; +use xml5ever::buffer_queue::BufferQueue; /// Anything that can be sent or received on an XMPP/XML stream #[derive(Debug, Clone, PartialEq, Eq)] @@ -219,7 +220,7 @@ impl Decoder for XMPPCodec { type Error = ParserError; fn decode(&mut self, buf: &mut BytesMut) -> Result, Self::Error> { - let buf1: Box> = if !self.buf.is_empty() && !buf.is_empty() { + let buf1: Box> = if !self.buf.is_empty() && !buf.is_empty() { let mut prefix = std::mem::replace(&mut self.buf, vec![]); prefix.extend_from_slice(buf.take().as_ref()); Box::new(prefix) @@ -231,8 +232,10 @@ impl Decoder for XMPPCodec { Ok(s) => { if !s.is_empty() { // println!("<< {}", s); + let mut buffer_queue = BufferQueue::new(); let tendril = FromIterator::from_iter(s.chars()); - self.parser.feed(tendril); + buffer_queue.push_back(tendril); + self.parser.feed(&mut buffer_queue); } } // Remedies for truncated utf8