diff --git a/src/main.rs b/src/main.rs index cb411a3..ba9a796 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,6 +59,19 @@ async fn main() -> anyhow::Result<()> { match message.command { Command::JOIN(ref channel, _, _) => { let users = unwrap_or_continue!(channel_users.get_mut(channel)); + for (user, status) in users.iter_mut() { + if nick.starts_with(user) { + // They're joining back for real, unban them + *status = match status { + Status::Banned => Status::TimeoutCount(0), + _ => *status, + }; + + let mode = Mode::Minus(ChannelMode::Ban, Some(format!("{}!*@*", user))); + client.send_mode(channel, &[mode])?; + client.send_privmsg(nick, "You're unbanned, welcome back!")?; + } + } if !users.contains_key(nick) { users.insert(nick.to_string(), Status::TimeoutCount(0)); }