X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_nokicks.cpp;h=8a87f7df83650dfd7478781cbdc5acce9ca79707;hb=1041cb9329027ea2b3855836e2bb68ab7411730f;hp=2b301f6c5af06e1fe8dd8f19f4e9b051074af2a8;hpb=d9d99cd02dadf34bfcc220734ba0c422f0acb3e6;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 2b301f6c5..8a87f7df8 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -22,29 +22,14 @@ #include "inspircd.h" -/* $ModDesc: Provides channel mode +Q to prevent kicks on the channel. */ - -class NoKicks : public SimpleChannelModeHandler -{ - public: - NoKicks(Module* Creator) : SimpleChannelModeHandler(Creator, "nokick", 'Q') { } -}; - class ModuleNoKicks : public Module { - NoKicks nk; + SimpleChannelModeHandler nk; public: ModuleNoKicks() - : nk(this) - { - } - - void init() CXX11_OVERRIDE + : nk(this, "nokick", 'Q') { - ServerInstance->Modules->AddService(nk); - Implementation eventlist[] = { I_OnUserPreKick, I_On005Numeric }; - ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } void On005Numeric(std::map& tokens) CXX11_OVERRIDE @@ -54,10 +39,10 @@ class ModuleNoKicks : public Module ModResult OnUserPreKick(User* source, Membership* memb, const std::string &reason) CXX11_OVERRIDE { - if (!memb->chan->GetExtBanStatus(source, 'Q').check(!memb->chan->IsModeSet('Q'))) + 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()); + source->WriteNumeric(ERR_CHANOPRIVSNEEDED, memb->chan->name, InspIRCd::Format("Can't kick user %s from channel (+Q set)", memb->user->nick.c_str())); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; @@ -65,7 +50,7 @@ class ModuleNoKicks : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides channel mode +Q to prevent kicks on the channel.", VF_VENDOR); + return Version("Provides channel mode +Q to prevent kicks on the channel", VF_VENDOR); } };