diff options
-rw-r--r-- | src/modules/m_timedbans.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 4be32ffc2..6247f32d6 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -158,17 +158,28 @@ class ModuleTimedBans : public Module if (cr) { const char *setban[3]; + std::string mask = i->mask; + setban[0] = i->channel.c_str(); setban[1] = "-b"; - setban[2] = i->mask.c_str(); - - ServerInstance->PI->SendModeStr(i->channel, std::string("-b ") + setban[2]); - ServerInstance->SendMode(setban,3, ServerInstance->FakeClient); + setban[2] = mask.c_str(); CUList empty; cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, i->mask.c_str()); if (ServerInstance->Config->AllowHalfop) cr->WriteAllExcept(ServerInstance->FakeClient, true, '%', empty, "NOTICE %s :*** Timed ban on %s expired.", cr->name, i->mask.c_str()); + + ServerInstance->PI->SendModeStr(i->channel, std::string("-b ") + setban[2]); + ServerInstance->SendMode(setban,3, ServerInstance->FakeClient); + + bool was_removed = true; + for (BanList::iterator j = cr->bans.begin(); j != cr->bans.end(); j++) + if (!strcasecmp(j->data, mask.c_str())) + was_removed = false; + + /* Fix for crash if user cycles before the ban expires */ + if (!was_removed) + TimedBanList.erase(i); } else { |