Complete channel-closing behaviour

We now emit appropriate signals and return a non-error status code when
a channel is closed.
This commit is contained in:
2020-05-17 22:23:57 +01:00
parent 782662b82f
commit 576fec63cd
2 changed files with 16 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ impl telepathy::Channel for Channel {
.send(DbusAction::CloseChannel(self.path()))
.unwrap();
Err(MethodErr::no_arg())
Ok(())
}
// Deprecated

View File

@@ -353,12 +353,22 @@ impl Connection {
actq.send(DbusAction::Signal(legacy_sig.to_emit_message(&path)))
.unwrap();
}
DbusAction::CloseChannel(path) => {
println!("*** Closing channel {}", path.clone());
let _chan = Arc::clone(&chans).write().unwrap().remove(&path);
DbusAction::CloseChannel(chan_path) => {
println!("*** Closing channel {}", chan_path.clone());
let _chan = Arc::clone(&chans).write().unwrap().remove(&chan_path);
let t2 = tree.clone();
t2.lock().unwrap().remove(&path);
// TODO: emit signals
t2.lock().unwrap().remove(&chan_path);
let requests_sig = telepathy::ConnectionInterfaceRequestsChannelClosed {
removed: chan_path.clone(),
};
let legacy_sig = telepathy::ChannelClosed {};
actq.send(DbusAction::Signal(requests_sig.to_emit_message(&path)))
.unwrap();
actq.send(DbusAction::Signal(legacy_sig.to_emit_message(&chan_path)))
.unwrap();
}
DbusAction::IncomingMessage(chat_id, msg_id) => {
println!("*** Incoming message: {} {}", chat_id, msg_id);