]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nonicks.cpp
m_chanfilter: Apply filters to part messages (#1702)
[user/henk/code/inspircd.git] / src / modules / m_nonicks.cpp
index 91a1303c6c53670ff79a50a046a437ea90113769..a796495a81d95a0b6e72fb883a85a8efe996251c 100644 (file)
 #include "inspircd.h"
 #include "modules/exemption.h"
 
-class NoNicks : public SimpleChannelModeHandler
-{
- public:
-       NoNicks(Module* Creator) : SimpleChannelModeHandler(Creator, "nonick", 'N') { }
-};
-
 class ModuleNoNickChange : public Module
 {
        CheckExemption::EventProvider exemptionprov;
-       NoNicks nn;
-       bool override;
+       SimpleChannelModeHandler nn;
  public:
        ModuleNoNickChange()
                : exemptionprov(this)
-               , nn(this)
+               , nn(this, "nonick", 'N')
        {
        }
 
        Version GetVersion() CXX11_OVERRIDE
        {
-               return Version("Provides support for channel mode +N & extban +b N: which prevents nick changes on channel", VF_VENDOR);
+               return Version("Provides channel mode +N and extban 'N' which prevents nick changes on the channel", VF_VENDOR);
        }
 
        void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
@@ -61,12 +54,12 @@ class ModuleNoNickChange : public Module
                        if (res == MOD_RES_ALLOW)
                                continue;
 
-                       if (override && user->IsOper())
+                       if (user->HasPrivPermission("channels/ignore-nonicks"))
                                continue;
 
                        if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet(nn)))
                        {
-                               user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("Can't change nickname while on %s (+N is set)",
+                               user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("Cannot change nickname while on %s (+N is set)",
                                        curr->name.c_str()));
                                return MOD_RES_DENY;
                        }
@@ -74,11 +67,6 @@ class ModuleNoNickChange : public Module
 
                return MOD_RES_PASSTHRU;
        }
-
-       void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
-       {
-               override = ServerInstance->Config->ConfValue("nonicks")->getBool("operoverride", false);
-       }
 };
 
 MODULE_INIT(ModuleNoNickChange)