Merge branch 'update-dependencies' into 'master'

Update dependencies

See merge request xmpp-rs/tokio-xmpp!6
This commit is contained in:
Astro 2019-06-14 23:42:30 +00:00
commit d173254483
8 changed files with 16 additions and 13 deletions

View file

@ -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"

View file

@ -16,12 +16,12 @@ use crate::{AuthError, Error, ProtocolError};
const NS_XMPP_SASL: &str = "urn:ietf:params:xml:ns:xmpp-sasl";
pub struct ClientAuth<S: AsyncRead + AsyncWrite> {
future: Box<Future<Item = XMPPStream<S>, Error = Error>>,
future: Box<dyn Future<Item = XMPPStream<S>, Error = Error>>,
}
impl<S: AsyncRead + AsyncWrite + 'static> ClientAuth<S> {
pub fn new(stream: XMPPStream<S>, creds: Credentials) -> Result<Self, Error> {
let local_mechs: Vec<Box<Fn() -> Box<Mechanism>>> = vec![
let local_mechs: Vec<Box<dyn Fn() -> Box<dyn Mechanism>>> = vec![
Box::new(|| Box::new(Scram::<Sha256>::from_credentials(creds.clone()).unwrap())),
Box::new(|| Box::new(Scram::<Sha1>::from_credentials(creds.clone()).unwrap())),
Box::new(|| Box::new(Plain::from_credentials(creds.clone()).unwrap())),
@ -62,7 +62,7 @@ impl<S: AsyncRead + AsyncWrite + 'static> ClientAuth<S> {
Err(AuthError::NoMechanism)?
}
fn handle_challenge(stream: XMPPStream<S>, mut mechanism: Box<Mechanism>) -> Box<Future<Item = XMPPStream<S>, Error = Error>> {
fn handle_challenge(stream: XMPPStream<S>, mut mechanism: Box<dyn Mechanism>) -> Box<dyn Future<Item = XMPPStream<S>, Error = Error>> {
Box::new(
stream.into_future()
.map_err(|(e, _stream)| e.into())

View file

@ -33,7 +33,7 @@ const NS_JABBER_CLIENT: &str = "jabber:client";
enum ClientState {
Invalid,
Disconnected,
Connecting(Box<Future<Item = XMPPStream, Error = Error>>),
Connecting(Box<dyn Future<Item = XMPPStream, Error = Error>>),
Connected(XMPPStream),
}

View file

@ -30,7 +30,7 @@ const NS_JABBER_COMPONENT_ACCEPT: &str = "jabber:component:accept";
enum ComponentState {
Invalid,
Disconnected,
Connecting(Box<Future<Item = XMPPStream, Error = Error>>),
Connecting(Box<dyn Future<Item = XMPPStream, Error = Error>>),
Connected(XMPPStream),
}

View file

@ -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
}
}

View file

@ -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 => {

View file

@ -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.

View file

@ -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<Option<Self::Item>, Self::Error> {
let buf1: Box<AsRef<[u8]>> = if !self.buf.is_empty() && !buf.is_empty() {
let buf1: Box<dyn AsRef<[u8]>> = 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