blob: 241c3e62bb81fcba97316206710f72877aa6bedc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
use lampada::Connected;
use stanza::client::Stanza;
use crate::{UpdateMessage, presence::Offline};
use super::ClientLogic;
pub async fn handle_disconnect(logic: ClientLogic, connection: Connected) {
// TODO: be able to set offline status message
let offline_presence: stanza::client::presence::Presence = Offline::default().into_stanza(None);
let stanza = Stanza::Presence(offline_presence);
// TODO: timeout and error check
connection.write_handle().write(stanza).await;
let _ = logic
.update_sender()
.send(UpdateMessage::Offline(Offline::default()))
.await;
}
|