From f43911ccbae3856b35b0d3e8ec6ac6450e295da6 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Tue, 11 Jul 2023 21:28:42 +0100 Subject: remove serde functions --- src/jabber.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/jabber.rs') diff --git a/src/jabber.rs b/src/jabber.rs index a1b2a2f..a48751c 100644 --- a/src/jabber.rs +++ b/src/jabber.rs @@ -117,11 +117,12 @@ impl<'j> Jabber<'j> { .connect(&self.server, socket) .await { - let (read, writer) = tokio::io::split(stream); + let (read, write) = tokio::io::split(stream); let reader = Reader::from_reader(BufReader::new(read)); - return Ok(JabberClientType::Encrypted( - client::encrypted::JabberClient::new(reader, writer, self), - )); + let writer = Writer::new(write); + let mut client = client::encrypted::JabberClient::new(reader, writer, self); + client.start_stream().await?; + return Ok(JabberClientType::Encrypted(client)); } } false => { @@ -129,9 +130,10 @@ impl<'j> Jabber<'j> { let (read, write) = tokio::io::split(stream); let reader = Reader::from_reader(BufReader::new(read)); let writer = Writer::new(write); - return Ok(JabberClientType::Unencrypted( - client::unencrypted::JabberClient::new(reader, writer, self), - )); + let mut client = + client::unencrypted::JabberClient::new(reader, writer, self); + client.start_stream().await?; + return Ok(JabberClientType::Unencrypted(client)); } } } -- cgit