diff --git a/src/main.rs b/src/main.rs index bde9c4d..cb411a3 100644 --- a/src/main.rs +++ b/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; + } + } + } + } + } _ => {} } }