blob: ebcfd4fc6620871ef7e31a287008cc1db613b059 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
use lampada::Connected;
use stanza::client::Stanza;
use crate::{UpdateMessage, files::FileStore, presence::Offline};
use super::ClientLogic;
pub async fn handle_disconnect<Fs: FileStore + Clone>(
logic: ClientLogic<Fs>,
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;
}
|