blob: 681d1d0e41fd3aca8afe0f9ce7ddb5a8a28627c8 (
plain) (
tree)
|
|
#![allow(unused_must_use)]
// #![feature(let_chains)]
// TODO: logging (dropped errors)
pub mod connection;
pub mod error;
pub mod jabber;
pub mod jid;
pub mod stanza;
pub use connection::Connection;
use connection::Tls;
pub use error::Error;
pub use jabber::Jabber;
pub use jid::JID;
pub type Result<T> = std::result::Result<T, Error>;
pub async fn login<J: AsRef<str>, P: AsRef<str>>(jid: J, password: P) -> Result<Jabber<Tls>> {
Ok(Connection::connect_user(jid, password.as_ref().to_string())
.await?
.ensure_tls()
.await?
.negotiate()
.await?)
}
#[cfg(test)]
mod tests {
#[tokio::test]
async fn test_login() {
crate::login("test@blos.sm/clown", "slayed").await.unwrap();
}
}
|