luz/src/lib.rs

44 lines
961 B
Rust
Raw Normal View History

2023-06-16 14:49:20 +01:00
#![allow(unused_must_use)]
2023-06-19 19:23:54 +01:00
// TODO: logging (dropped errors)
pub mod client;
pub mod error;
pub mod jabber;
2023-06-16 17:13:01 +01:00
pub mod jid;
2023-06-19 19:23:54 +01:00
pub mod stanza;
2023-06-13 00:46:59 +01:00
2023-06-19 19:23:54 +01:00
pub use client::encrypted::JabberClient;
pub use error::JabberError;
pub use jabber::Jabber;
pub use jid::JID;
2023-06-16 14:49:20 +01:00
2023-06-19 19:23:54 +01:00
pub type Result<T> = std::result::Result<T, JabberError>;
2023-06-13 00:46:59 +01:00
#[cfg(test)]
mod tests {
2023-06-19 19:23:54 +01:00
use std::str::FromStr;
2023-06-16 14:49:20 +01:00
2023-06-19 19:23:54 +01:00
use crate::Jabber;
use crate::JID;
2023-06-13 00:46:59 +01:00
2023-06-19 19:23:54 +01:00
// #[tokio::test]
// async fn get_sockets() {
// let jabber = Jabber::new(JID::from_str("cel@blos.sm").unwrap(), "password".to_owned());
// println!("{:?}", jabber.get_sockets().await)
// }
2023-06-16 17:13:01 +01:00
#[tokio::test]
async fn connect() {
2023-06-19 19:23:54 +01:00
Jabber::new(JID::from_str("cel@blos.sm").unwrap(), "password".to_owned())
.connect()
.await
.unwrap()
.ensure_tls()
.await
.unwrap()
.start_stream()
.await
.unwrap();
2023-06-13 00:46:59 +01:00
}
}