X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_timedbans.cpp;h=803156446a2e50d86e544a204f16f1097cc6dfdf;hb=3ccf0065d43db80f31c6404aeac4d65551481508;hp=2441f1aa812ed4506f42b5efadf8fa42a10127db;hpb=6c7a3ceb6c674a9af09da955ee0238e9291cf29a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 2441f1aa8..803156446 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -71,17 +71,15 @@ class CommandTban : public Command return CMD_FAILURE; } std::string mask = parameters[2]; - std::vector setban; - setban.push_back(parameters[0]); - setban.push_back("+b"); bool isextban = ((mask.size() > 2) && (mask[1] == ':')); - if (!isextban && !ServerInstance->IsValidMask(mask)) + if (!isextban && !InspIRCd::IsValidMask(mask)) mask.append("!*@*"); - setban.push_back(mask); + Modes::ChangeList setban; + setban.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), mask); // Pass the user (instead of ServerInstance->FakeClient) to ModeHandler::Process() to // make it so that the user sets the mode themselves - ServerInstance->Modes->Process(setban, user); + ServerInstance->Modes->Process(user, channel, NULL, setban); if (ServerInstance->Modes->GetLastParse().empty()) { user->WriteNotice("Invalid ban mask"); @@ -148,16 +146,6 @@ class ModuleTimedBans : public Module { } - void init() CXX11_OVERRIDE - { - ServerInstance->Modes->AddModeWatcher(&banwatcher); - } - - ~ModuleTimedBans() - { - ServerInstance->Modes->DelModeWatcher(&banwatcher); - } - void OnBackgroundTimer(time_t curtime) CXX11_OVERRIDE { timedbans expired; @@ -179,17 +167,14 @@ class ModuleTimedBans : public Module Channel* cr = ServerInstance->FindChan(chan); if (cr) { - std::vector setban; - setban.push_back(chan); - setban.push_back("-b"); - setban.push_back(mask); - CUList empty; std::string expiry = "*** Timed ban on " + chan + " expired."; cr->WriteAllExcept(ServerInstance->FakeClient, true, '@', empty, "NOTICE %s :%s", cr->name.c_str(), expiry.c_str()); ServerInstance->PI->SendChannelNotice(cr, '@', expiry); - ServerInstance->Modes->Process(setban, ServerInstance->FakeClient); + Modes::ChangeList setban; + setban.push_remove(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), mask); + ServerInstance->Modes->Process(ServerInstance->FakeClient, cr, NULL, setban); } } }