aboutsummaryrefslogtreecommitdiffstats
path: root/lampada/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lampada/src/lib.rs')
-rw-r--r--lampada/src/lib.rs13
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