X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_nokicks.cpp;h=5e58f002c502984c0f164722407bc5b6184586e3;hb=67de413cad88194972d55a8ff88464370890c5a9;hp=2e598dafea48e43cec6af30ef8d37bcf2b95fc2c;hpb=553a8da754c8cd308bad2008018849714e70f9b7;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 2e598dafe..5e58f002c 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -22,8 +22,6 @@ #include "inspircd.h" -/* $ModDesc: Provides support for unreal-style channel mode +Q */ - class NoKicks : public SimpleChannelModeHandler { public: @@ -38,45 +36,33 @@ class ModuleNoKicks : public Module ModuleNoKicks() : nk(this) { - if (!ServerInstance->Modes->AddMode(&nk)) - throw ModuleException("Could not add new modes!"); - Implementation eventlist[] = { I_OnUserPreKick, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, 2); } - void On005Numeric(std::string &output) + void init() CXX11_OVERRIDE { - ServerInstance->AddExtBanChar('Q'); + ServerInstance->Modules->AddService(nk); } - ModResult OnUserPreKick(User* source, Membership* memb, const std::string &reason) + void On005Numeric(std::map& tokens) CXX11_OVERRIDE { - if (!memb->chan->GetExtBanStatus(source, 'Q').check(!memb->chan->IsModeSet('Q'))) - { - if ((ServerInstance->ULine(source->nick.c_str())) || ServerInstance->ULine(source->server)) - { - // ulines can still kick with +Q in place - return MOD_RES_PASSTHRU; - } - else - { - // nobody else can (not even opers with override, and founders) - source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), memb->chan->name.c_str(), memb->user->nick.c_str()); - return MOD_RES_DENY; - } - } - return MOD_RES_PASSTHRU; + tokens["EXTBAN"].push_back('Q'); } - ~ModuleNoKicks() + ModResult OnUserPreKick(User* source, Membership* memb, const std::string &reason) CXX11_OVERRIDE { + if (!memb->chan->GetExtBanStatus(source, 'Q').check(!memb->chan->IsModeSet(nk))) + { + // Can't kick with Q in place, not even opers with override, and founders + source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), memb->chan->name.c_str(), memb->user->nick.c_str()); + return MOD_RES_DENY; + } + return MOD_RES_PASSTHRU; } - Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { - return Version("Provides support for unreal-style channel mode +Q", VF_VENDOR); + return Version("Provides channel mode +Q to prevent kicks on the channel.", VF_VENDOR); } }; - MODULE_INIT(ModuleNoKicks)