diff --git a/tokio-xmpp/ChangeLog b/tokio-xmpp/ChangeLog index c1d3fef6..4bef1523 100644 --- a/tokio-xmpp/ChangeLog +++ b/tokio-xmpp/ChangeLog @@ -5,9 +5,9 @@ Version NEXT: new default. The newly-introduced `pedantic` feature can be used to opt into the previous default behaviour of rejecting all unknown child elements and attributes. - * Breaking: - Add `xmpp_parsers::stream_features::StreamFeatures` to `tokio_xmpp::event::Online` (!631) + - `Component.jid` iw now a `BareJid` and not a raw `Jid` (!684) * Added: - Expose `client_auth` method to allow manual stream setups for advanced use cases. diff --git a/tokio-xmpp/src/component/login.rs b/tokio-xmpp/src/component/login.rs index d09638c6..a19ccc4b 100644 --- a/tokio-xmpp/src/component/login.rs +++ b/tokio-xmpp/src/component/login.rs @@ -2,7 +2,7 @@ use std::io; use futures::{SinkExt, StreamExt}; use tokio::io::{AsyncBufRead, AsyncWrite}; -use xmpp_parsers::{component::Handshake, jid::Jid, ns}; +use xmpp_parsers::{component::Handshake, jid::BareJid, ns}; use crate::component::ServerConnector; use crate::error::{AuthError, Error}; @@ -11,7 +11,7 @@ use crate::xmlstream::{ReadError, Timeouts, XmppStream, XmppStreamElement}; /// Log into an XMPP server as a client with a jid+pass pub async fn component_login( connector: C, - jid: Jid, + jid: BareJid, password: &str, timeouts: Timeouts, ) -> Result, Error> { diff --git a/tokio-xmpp/src/component/mod.rs b/tokio-xmpp/src/component/mod.rs index 33ebe94d..bd9edf3c 100644 --- a/tokio-xmpp/src/component/mod.rs +++ b/tokio-xmpp/src/component/mod.rs @@ -3,7 +3,7 @@ //! allowed to use any user and resource identifiers in their stanzas. use futures::sink::SinkExt; use std::str::FromStr; -use xmpp_parsers::jid::Jid; +use xmpp_parsers::jid::BareJid; use crate::{ component::login::component_login, @@ -27,7 +27,7 @@ mod stream; /// (stanzas). Connection handling however is up to the user. pub struct Component { /// The component's Jabber-Id - pub jid: Jid, + pub jid: BareJid, stream: XmppStream, } @@ -87,7 +87,7 @@ impl Component { connector: C, timeouts: Timeouts, ) -> Result { - let jid = Jid::from_str(jid)?; + let jid = BareJid::from_str(jid)?; let stream = component_login(connector, jid.clone(), password, timeouts).await?; Ok(Component { jid, stream }) }