Add AsyncServerConnector to AsyncClient to be able to support any stream

Unfortunately API breaking unless we do some export mangling
This commit is contained in:
moparisthebest 2023-12-29 01:09:33 -05:00
commit 3cab603a4c
No known key found for this signature in database
GPG key ID: 88C93BFE27BC8229
6 changed files with 86 additions and 57 deletions

View file

@ -21,7 +21,7 @@ log = "0.4"
reqwest = { version = "0.11.8", features = ["stream"] }
tokio-util = { version = "0.7", features = ["codec"] }
# same repository dependencies
tokio-xmpp = { version = "3.4", path = "../tokio-xmpp" }
tokio-xmpp = { version = "3.4", path = "../tokio-xmpp", default-features = false }
[dev-dependencies]
env_logger = { version = "0.10", default-features = false, features = ["auto-color", "humantime"] }
@ -31,5 +31,7 @@ name = "hello_bot"
required-features = ["avatars"]
[features]
default = ["avatars"]
default = ["avatars", "tls-native"]
tls-native = ["tokio-xmpp/tls-native"]
tls-rust = ["tokio-xmpp/tls-rust"]
avatars = []

View file

@ -8,10 +8,9 @@ use std::path::{Path, PathBuf};
use std::sync::{Arc, RwLock};
pub use tokio_xmpp::parsers;
use tokio_xmpp::parsers::{disco::DiscoInfoResult, message::MessageType};
use tokio_xmpp::AsyncClient as TokioXmppClient;
pub use tokio_xmpp::{BareJid, Element, FullJid, Jid};
use crate::{event_loop, message, muc, upload, Error, Event, RoomNick};
use crate::{event_loop, message, muc, upload, Error, Event, RoomNick, TokioXmppClient};
pub struct Agent {
pub(crate) client: TokioXmppClient,

View file

@ -10,10 +10,10 @@ use tokio_xmpp::{
disco::{DiscoInfoResult, Feature, Identity},
ns,
},
AsyncClient as TokioXmppClient, BareJid, Jid,
BareJid, Jid,
};
use crate::{Agent, ClientFeature};
use crate::{Agent, ClientFeature, TokioXmppClient};
#[derive(Debug)]
pub enum ClientType {

View file

@ -7,6 +7,7 @@
#![deny(bare_trait_objects)]
pub use tokio_xmpp::parsers;
use tokio_xmpp::{AsyncClient, AsyncServerConfig};
pub use tokio_xmpp::{BareJid, Element, FullJid, Jid};
#[macro_use]
extern crate log;
@ -31,6 +32,8 @@ pub use builder::{ClientBuilder, ClientType};
pub use event::Event;
pub use feature::ClientFeature;
type TokioXmppClient = AsyncClient<AsyncServerConfig>;
pub type Error = tokio_xmpp::Error;
pub type Id = Option<String>;
pub type RoomNick = String;