feat: Component.jid is now a BareJid
This commit is contained in:
parent
24ae2ffd73
commit
abd9f7d136
3 changed files with 6 additions and 6 deletions
|
|
@ -5,9 +5,9 @@ Version NEXT:
|
||||||
new default. The newly-introduced `pedantic` feature can be used to
|
new default. The newly-introduced `pedantic` feature can be used to
|
||||||
opt into the previous default behaviour of rejecting all unknown
|
opt into the previous default behaviour of rejecting all unknown
|
||||||
child elements and attributes.
|
child elements and attributes.
|
||||||
* Breaking:
|
|
||||||
- Add `xmpp_parsers::stream_features::StreamFeatures` to
|
- Add `xmpp_parsers::stream_features::StreamFeatures` to
|
||||||
`tokio_xmpp::event::Online` (!631)
|
`tokio_xmpp::event::Online` (!631)
|
||||||
|
- `Component.jid` iw now a `BareJid` and not a raw `Jid` (!684)
|
||||||
* Added:
|
* Added:
|
||||||
- Expose `client_auth` method to allow manual stream setups for advanced
|
- Expose `client_auth` method to allow manual stream setups for advanced
|
||||||
use cases.
|
use cases.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ use std::io;
|
||||||
|
|
||||||
use futures::{SinkExt, StreamExt};
|
use futures::{SinkExt, StreamExt};
|
||||||
use tokio::io::{AsyncBufRead, AsyncWrite};
|
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::component::ServerConnector;
|
||||||
use crate::error::{AuthError, Error};
|
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
|
/// Log into an XMPP server as a client with a jid+pass
|
||||||
pub async fn component_login<C: ServerConnector>(
|
pub async fn component_login<C: ServerConnector>(
|
||||||
connector: C,
|
connector: C,
|
||||||
jid: Jid,
|
jid: BareJid,
|
||||||
password: &str,
|
password: &str,
|
||||||
timeouts: Timeouts,
|
timeouts: Timeouts,
|
||||||
) -> Result<XmppStream<C::Stream>, Error> {
|
) -> Result<XmppStream<C::Stream>, Error> {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
//! allowed to use any user and resource identifiers in their stanzas.
|
//! allowed to use any user and resource identifiers in their stanzas.
|
||||||
use futures::sink::SinkExt;
|
use futures::sink::SinkExt;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use xmpp_parsers::jid::Jid;
|
use xmpp_parsers::jid::BareJid;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
component::login::component_login,
|
component::login::component_login,
|
||||||
|
|
@ -27,7 +27,7 @@ mod stream;
|
||||||
/// (stanzas). Connection handling however is up to the user.
|
/// (stanzas). Connection handling however is up to the user.
|
||||||
pub struct Component<C: ServerConnector> {
|
pub struct Component<C: ServerConnector> {
|
||||||
/// The component's Jabber-Id
|
/// The component's Jabber-Id
|
||||||
pub jid: Jid,
|
pub jid: BareJid,
|
||||||
stream: XmppStream<C::Stream>,
|
stream: XmppStream<C::Stream>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ impl<C: ServerConnector> Component<C> {
|
||||||
connector: C,
|
connector: C,
|
||||||
timeouts: Timeouts,
|
timeouts: Timeouts,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
let jid = Jid::from_str(jid)?;
|
let jid = BareJid::from_str(jid)?;
|
||||||
let stream = component_login(connector, jid.clone(), password, timeouts).await?;
|
let stream = component_login(connector, jid.clone(), password, timeouts).await?;
|
||||||
Ok(Component { jid, stream })
|
Ok(Component { jid, stream })
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue