Update dependencies

This commit is contained in:
SonnyX 2019-09-08 21:28:44 +02:00
commit 3b37646d0a
12 changed files with 617 additions and 629 deletions

View file

@ -1,12 +1,12 @@
use std::str::FromStr;
use std::collections::HashSet;
use std::convert::TryFrom;
use futures::{Future, Poll, Stream, future::{ok, err, IntoFuture}};
use sasl::client::mechanisms::{Anonymous, Plain, Scram};
use sasl::client::Mechanism;
use sasl::common::scram::{Sha1, Sha256};
use sasl::common::Credentials;
use tokio_io::{AsyncRead, AsyncWrite};
use xmpp_parsers::TryFrom;
use xmpp_parsers::sasl::{Auth, Challenge, Failure, Mechanism as XMPPMechanism, Response, Success};
use crate::xmpp_codec::Packet;

View file

@ -1,8 +1,9 @@
use futures::{sink, Async, Future, Poll, Stream};
use std::convert::TryFrom;
use std::mem::replace;
use tokio_io::{AsyncRead, AsyncWrite};
use xmpp_parsers::TryFrom;
use xmpp_parsers::bind::Bind;
use xmpp_parsers::Jid;
use xmpp_parsers::bind::{BindQuery, BindResponse};
use xmpp_parsers::iq::{Iq, IqType};
use crate::xmpp_codec::Packet;
@ -32,8 +33,13 @@ impl<S: AsyncWrite> ClientBind<S> {
ClientBind::Unsupported(stream)
}
Some(_) => {
let resource = stream.jid.resource.clone();
let iq = Iq::from_set(BIND_REQ_ID, Bind::new(resource));
let resource;
if let Jid::Full(jid) = stream.jid.clone() {
resource = Some(jid.resource);
} else {
resource = None;
}
let iq = Iq::from_set(BIND_REQ_ID, BindQuery::new(resource));
let send = stream.send_stanza(iq);
ClientBind::WaitSend(send)
}
@ -68,11 +74,8 @@ impl<S: AsyncRead + AsyncWrite> Future for ClientBind<S> {
match iq.payload {
IqType::Result(payload) => {
payload
.and_then(|payload| Bind::try_from(payload).ok())
.map(|bind| match bind {
Bind::Jid(jid) => stream.jid = jid,
_ => {}
});
.and_then(|payload| BindResponse::try_from(payload).ok())
.map(|bind| stream.jid = bind.into());
Ok(Async::Ready(stream))
}
_ => Err(ProtocolError::InvalidBindResponse)?,

View file

@ -60,11 +60,11 @@ impl Client {
}
fn make_connect(jid: Jid, password: String) -> impl Future<Item = XMPPStream, Error = Error> {
let username = jid.node.as_ref().unwrap().to_owned();
let username = jid.clone().node().unwrap();
let jid1 = jid.clone();
let jid2 = jid.clone();
let password = password;
done(idna::domain_to_ascii(&jid.domain))
done(idna::domain_to_ascii(&jid.domain()))
.map_err(|_| Error::Idna)
.and_then(|domain| {
done(Connecter::from_lookup(