Move SimpleClient constructors to client::simple_client module

This commit is contained in:
xmppftw xmppftw 2024-08-03 15:23:00 +02:00
commit b3fd0b5372
3 changed files with 15 additions and 21 deletions

View file

@ -1,20 +0,0 @@
use std::str::FromStr;
use xmpp_parsers::jid::Jid;
use crate::{Error, SimpleClient};
use super::ServerConfig;
impl SimpleClient<ServerConfig> {
/// Start a new XMPP client and wait for a usable session
pub async fn new<P: Into<String>>(jid: &str, password: P) -> Result<Self, Error> {
let jid = Jid::from_str(jid)?;
Self::new_with_jid(jid, password.into()).await
}
/// Start a new client given that the JID is already parsed.
pub async fn new_with_jid(jid: Jid, password: String) -> Result<Self, Error> {
Self::new_with_jid_connector(ServerConfig::UseSrv, jid, password).await
}
}

View file

@ -35,7 +35,6 @@ use crate::{connect::ServerConnectorError, xmpp_stream::XMPPStream};
use self::error::Error as StartTlsError;
use self::happy_eyeballs::{connect_to_host, connect_with_srv};
mod client;
pub mod error;
mod happy_eyeballs;