Port PART functionality to QUIT
This commit is contained in:
parent
603b7ec20b
commit
f6a03a792f
21
src/main.rs
21
src/main.rs
|
@ -91,6 +91,27 @@ async fn main() -> anyhow::Result<()> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Command::QUIT(Some(ref message)) => {
|
||||||
|
for (channel, users) in &mut channel_users {
|
||||||
|
let user = unwrap_or_continue!(users.get_mut(nick));
|
||||||
|
if message == &conf.quit_message {
|
||||||
|
*user = match user {
|
||||||
|
Status::TimeoutCount(count) => Status::TimeoutCount(*count + 1),
|
||||||
|
_ => *user,
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Status::TimeoutCount(count) = user {
|
||||||
|
if *count > conf.timeout_limit.unwrap_or(1) {
|
||||||
|
let mode =
|
||||||
|
Mode::Plus(ChannelMode::Ban, Some(format!("{}!*@*", nick)));
|
||||||
|
client.send_mode(channel, &[mode])?;
|
||||||
|
|
||||||
|
*user = Status::Banned;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue