diff options
author | 2025-04-28 19:53:11 +0100 | |
---|---|---|
committer | 2025-04-28 19:53:11 +0100 | |
commit | 42c7423667a2d6acdebca75250ad30c5d475081b (patch) | |
tree | 65faaac42cf3f8ef83715ee7f66db1af45dd39d6 /lampada/src/lib.rs | |
parent | 66cd4d48142124d920e5cc57f685555d279b8c7a (diff) | |
download | luz-42c7423667a2d6acdebca75250ad30c5d475081b.tar.gz luz-42c7423667a2d6acdebca75250ad30c5d475081b.tar.bz2 luz-42c7423667a2d6acdebca75250ad30c5d475081b.zip |
feat: serde
Diffstat (limited to '')
-rw-r--r-- | lampada/src/lib.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lampada/src/lib.rs b/lampada/src/lib.rs index dacc56d..5b1f89f 100644 --- a/lampada/src/lib.rs +++ b/lampada/src/lib.rs @@ -217,9 +217,10 @@ where else => break, }; match msg { - CoreClientCommand::Connect => { + CoreClientCommand::Connect(sender) => { match self.connected { Some(_) => { + sender.send(Err(ConnectionError::AlreadyConnected)); self.logic .clone() .handle_connection_error(ConnectionError::AlreadyConnected) @@ -238,9 +239,10 @@ where self.logic .clone() .handle_connection_error(ConnectionError::InvalidServerJID( - e, + e.clone(), )) .await; + sender.send(Err(ConnectionError::InvalidServerJID(e))); continue; } }; @@ -269,15 +271,18 @@ where self.logic.clone().handle_connect(connected.clone()).await; self.connected = Some((connected, supervisor)); + // REMEMBER TO NOTIFY IT@S GOOD + sender.send(Ok(())); } Err(e) => { tracing::error!("error: {}", e); self.logic .clone() .handle_connection_error(ConnectionError::ConnectionFailed( - e.into(), + e.clone().into(), )) .await; + sender.send(Err(ConnectionError::ConnectionFailed(e))); } } } @@ -315,7 +320,7 @@ where pub enum CoreClientCommand<C> { // TODO: login invisible xep-0186 /// connect to XMPP chat server. gets roster and publishes initial presence. - Connect, + Connect(oneshot::Sender<Result<(), ConnectionError>>), /// disconnect from XMPP chat server, sending unavailable presence then closing stream. Disconnect, /// TODO: generics |