Allow specifying a reason when parting
This commit is contained in:
parent
302ac9b050
commit
8065fdd8ff
1 changed files with 12 additions and 12 deletions
20
src/main.rs
20
src/main.rs
|
@ -123,16 +123,16 @@ impl Cri {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
let reason = tokens.collect::<Vec<_>>().join(" ");
|
||||||
.input_tx
|
let reason = if reason.is_empty() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(reason)
|
||||||
|
};
|
||||||
|
|
||||||
|
self.input_tx
|
||||||
.borrow()
|
.borrow()
|
||||||
.send(
|
.send(IrcCommand::PART(channel, reason).into())
|
||||||
IrcCommand::PART(
|
|
||||||
channel,
|
|
||||||
tokens.next().map(str::to_string),
|
|
||||||
)
|
|
||||||
.into(),
|
|
||||||
)
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
"/query" => self
|
"/query" => self
|
||||||
|
@ -190,7 +190,7 @@ impl Application for Cri {
|
||||||
.on_quit(&source_nickname, comment.as_deref());
|
.on_quit(&source_nickname, comment.as_deref());
|
||||||
}
|
}
|
||||||
|
|
||||||
IrcCommand::PRIVMSG(msgtarget, content) => {
|
IrcCommand::PRIVMSG(msgtarget, content) | IrcCommand::NOTICE(msgtarget, content) => {
|
||||||
let channel = message.response_target().unwrap_or(msgtarget).to_string();
|
let channel = message.response_target().unwrap_or(msgtarget).to_string();
|
||||||
self.message_log
|
self.message_log
|
||||||
.on_privmsg(&channel, &source_nickname, content);
|
.on_privmsg(&channel, &source_nickname, content);
|
||||||
|
|
Loading…
Reference in a new issue