luz/src/lib.rs

58 lines
1.3 KiB
Rust
Raw Normal View History

2023-06-16 14:49:20 +01:00
#![allow(unused_must_use)]
2023-08-02 00:56:38 +01:00
#![feature(let_chains)]
2023-06-16 14:49:20 +01:00
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
2023-07-04 21:27:15 +01:00
// #[tokio::test]
// async fn connect() {
// Jabber::new(JID::from_str("cel@blos.sm").unwrap(), "password".to_owned())
// .unwrap()
// .connect()
// .await
// .unwrap()
// .ensure_tls()
// .await
// .unwrap()
// .start_stream()
// .await
// .unwrap();
// }
2023-06-16 17:13:01 +01:00
#[tokio::test]
2023-07-04 21:27:15 +01:00
async fn login() {
2023-08-02 00:56:38 +01:00
Jabber::new(
JID::from_str("test@blos.sm/clown").unwrap(),
"slayed".to_owned(),
)
.unwrap()
.login()
.await
.unwrap();
2023-06-13 00:46:59 +01:00
}
}