summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
blob: 89e69c9104c77ec3c7a3041363a883500926eae6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#![allow(unused_must_use)]

// TODO: logging (dropped errors)
pub mod client;
pub mod element;
pub mod error;
pub mod jabber;
pub mod jid;
pub mod stanza;

pub use client::encrypted::JabberClient;
pub use error::JabberError;
pub use jabber::Jabber;
pub use jid::JID;

pub type Result<T> = std::result::Result<T, JabberError>;

#[cfg(test)]
mod tests {
    use std::str::FromStr;

    use crate::Jabber;
    use crate::JID;

    // #[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)
    // }

    // #[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();
    // }

    #[tokio::test]
    async fn login() {
        Jabber::new(JID::from_str("test@blos.sm").unwrap(), "slayed".to_owned())
            .unwrap()
            .login()
            .await
            .unwrap();
    }
}