tokio-xmpp: use xmpp_parsers::ns everywhere

This commit is contained in:
Astro 2020-05-30 01:19:06 +02:00
commit e501addb96
9 changed files with 23 additions and 41 deletions

View file

@ -1,14 +1,12 @@
use futures::stream::StreamExt;
use std::marker::Unpin;
use tokio::io::{AsyncRead, AsyncWrite};
use xmpp_parsers::component::Handshake;
use xmpp_parsers::{component::Handshake, ns};
use crate::xmpp_codec::Packet;
use crate::xmpp_stream::XMPPStream;
use crate::{AuthError, Error};
const NS_JABBER_COMPONENT_ACCEPT: &str = "jabber:component:accept";
pub async fn auth<S: AsyncRead + AsyncWrite + Unpin>(
stream: &mut XMPPStream<S>,
password: String,
@ -19,7 +17,7 @@ pub async fn auth<S: AsyncRead + AsyncWrite + Unpin>(
loop {
match stream.next().await {
Some(Ok(Packet::Stanza(ref stanza)))
if stanza.is("handshake", NS_JABBER_COMPONENT_ACCEPT) =>
if stanza.is("handshake", ns::COMPONENT_ACCEPT) =>
{
return Ok(());
}