Skip to main content

msnp11_sdk/
lib.rs

1//! An MSNP11 client SDK.
2//! # Login
3//! ```
4//! use msnp11_sdk::client::Client;
5//! use msnp11_sdk::enums::event::Event;
6//! use msnp11_sdk::models::personal_message::PersonalMessage;
7//! use msnp11_sdk::enums::msnp_status::MsnpStatus;
8//!
9//! let mut client = Client::new("127.0.0.1", 1863)
10//!    .await
11//!    .unwrap();
12//!
13//! client.add_event_handler_closure(|event| async { /* Handle events... */ });
14//!
15//! // Handle a redirection by creating a new connection
16//! if let Ok(Event::RedirectedTo { server, port }) = client
17//!     .login(
18//!         "testing@example.com".to_string(),
19//!         "123456",
20//!         "http://localhost:3000/rdr/pprdr.asp",
21//!         "msnp11-sdk",
22//!         "0.11.1"
23//!     )
24//!     .await
25//!  {
26//!     client = Client::new(&*server, port).await.unwrap();
27//!     client
28//!         .login(
29//!             "testing@example.com".to_string(),
30//!             "123456",
31//!             "http://localhost:3000/rdr/pprdr.asp",
32//!             "msnp11-sdk",
33//!             "0.11.1"
34//!         )
35//!         .await
36//!         .unwrap();
37//!  }
38//!
39//! client.set_presence(MsnpStatus::Online).await.unwrap();
40//! client
41//!     .set_personal_message(&PersonalMessage {
42//!         psm: "test".to_string(),
43//!         current_media: "".to_string(),
44//!     })
45//!     .await
46//!     .unwrap();
47//! ```
48//! # Bindings
49//! Bindings for Kotlin and Swift can be generated with
50//! [UniFFI](https://mozilla.github.io/uniffi-rs/latest/tutorial/foreign_language_bindings.html#multi-crate-workspaces).
51//!
52
53pub mod client;
54pub mod enums;
55mod errors;
56#[cfg(feature = "uniffi")]
57pub mod event_handler;
58#[cfg(feature = "uniffi")]
59mod exports;
60mod http;
61pub mod models;
62mod notification_server;
63mod receive_split;
64pub mod switchboard_server;
65
66#[cfg(feature = "uniffi")]
67uniffi::setup_scaffolding!();
68
69pub use client::Client;
70pub use enums::event::Event;
71pub use enums::msnp_list::MsnpList;
72pub use enums::msnp_status::MsnpStatus;
73pub use errors::contact_error::ContactError;
74pub use errors::messaging_error::MessagingError;
75pub use errors::p2p_error::P2pError;
76pub use errors::sdk_error::SdkError;
77pub use models::msn_object::MsnObject;
78pub use models::personal_message::PersonalMessage;
79pub use models::plain_text::PlainText;
80pub use models::presence::Presence;
81pub use switchboard_server::switchboard::Switchboard;
82
83#[cfg(feature = "config")]
84pub use http::config::Config;
85#[cfg(feature = "config")]
86pub use http::xml::tab::Tab;