diff options
author | cel 🌸 <cel@blos.sm> | 2023-10-21 01:28:54 +0100 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2023-10-21 01:28:54 +0100 |
commit | e893869df974ebb7afcc318119840c53f8f377cb (patch) | |
tree | 3319dba477784c126011acc5422c9973782f7850 /src/client/mod.rs | |
parent | ba94ee66fafbabd63d6d1ed5edf435d4c46c6796 (diff) | |
download | luz-e893869df974ebb7afcc318119840c53f8f377cb.tar.gz luz-e893869df974ebb7afcc318119840c53f8f377cb.tar.bz2 luz-e893869df974ebb7afcc318119840c53f8f377cb.zip |
implement connection
Diffstat (limited to '')
-rw-r--r-- | src/client/mod.rs | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs deleted file mode 100644 index 01df4a4..0000000 --- a/src/client/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -// pub mod encrypted; -pub mod unencrypted; - -// use async_trait::async_trait; - -// use crate::stanza::stream::StreamFeature; -use crate::JabberError; -use crate::Result; - -pub enum JabberClientType<'j> { - // Encrypted(encrypted::JabberClient<'j>), - Unencrypted(unencrypted::JabberClient<'j>), -} - -impl<'j> JabberClientType<'j> { - /// ensures an encrypted jabber client - pub async fn ensure_tls(self) -> Result<encrypted::JabberClient<'j>> { - match self { - Self::Encrypted(c) => Ok(c), - Self::Unencrypted(mut c) => { - c.start_stream().await?; - let features = c.get_features().await?; - if features.contains(&StreamFeature::StartTls) { - Ok(c.starttls().await?) - } else { - Err(JabberError::StartTlsUnavailable) - } - } - } - } -} - -// TODO: jabber client trait over both client types using macro -// #[async_trait] -// pub trait JabberTrait { -// async fn start_stream(&mut self) -> Result<()>; -// async fn get_features(&self) -> Result<Vec<StreamFeatures>>; -// } |