summaryrefslogtreecommitdiffstats
path: root/src/client/mod.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2023-07-11 21:28:42 +0100
committerLibravatar cel 🌸 <cel@blos.sm>2023-07-11 21:28:42 +0100
commitf43911ccbae3856b35b0d3e8ec6ac6450e295da6 (patch)
tree492b195cc06b08e546c059c16a748f369995eab1 /src/client/mod.rs
parent143a0365d0822e6786cdac3530a725bbf450f38f (diff)
downloadluz-f43911ccbae3856b35b0d3e8ec6ac6450e295da6.tar.gz
luz-f43911ccbae3856b35b0d3e8ec6ac6450e295da6.tar.bz2
luz-f43911ccbae3856b35b0d3e8ec6ac6450e295da6.zip
remove serde functions
Diffstat (limited to 'src/client/mod.rs')
-rw-r--r--src/client/mod.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs
index fe3dd34..d545923 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -15,17 +15,16 @@ pub enum JabberClientType<'j> {
impl<'j> JabberClientType<'j> {
pub async fn ensure_tls(self) -> Result<encrypted::JabberClient<'j>> {
match self {
- Self::Encrypted(mut c) => {
- c.start_stream();
- Ok(c)
- }
+ 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?)
+ if let Some(features) = c.get_features().await? {
+ if features.contains(&StreamFeature::StartTls) {
+ Ok(c.starttls().await?)
+ } else {
+ Err(JabberError::StartTlsUnavailable)
+ }
} else {
- Err(JabberError::StartTlsUnavailable)
+ Err(JabberError::NoFeatures)
}
}
}