Move AsyncClient::new to client::async_client module

This commit is contained in:
xmppftw xmppftw 2024-08-03 15:17:27 +02:00
commit fc0071a0c5
2 changed files with 19 additions and 16 deletions

View file

@ -2,25 +2,10 @@ use std::str::FromStr;
use xmpp_parsers::jid::Jid;
use crate::{AsyncClient, AsyncConfig, Error, SimpleClient};
use crate::{Error, SimpleClient};
use super::ServerConfig;
impl AsyncClient<ServerConfig> {
/// Start a new XMPP client
///
/// Start polling the returned instance so that it will connect
/// and yield events.
pub fn new<J: Into<Jid>, P: Into<String>>(jid: J, password: P) -> Self {
let config = AsyncConfig {
jid: jid.into(),
password: password.into(),
server: ServerConfig::UseSrv,
};
Self::new_with_config(config)
}
}
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> {