]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nokicks.cpp
Expand searching in m_httpd_stats, add global handling of GET parameters (#1566)
[user/henk/code/inspircd.git] / src / modules / m_nokicks.cpp
index bb78b60d12717e5e5387431ec31f4e3996fba608..3155dcb6c9ac1a115ebca6c668796682b043026e 100644 (file)
 
 #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<std::string, std::string>& tokens) CXX11_OVERRIDE
@@ -57,7 +42,7 @@ class ModuleNoKicks : public Module
                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;