]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nonicks.cpp
Remove spanningtree override of /LUSERS
[user/henk/code/inspircd.git] / src / modules / m_nonicks.cpp
index 368eaa34354d736dd4edc64a90189d5b00405352..48eafff7a8bad711935db7c242b3d943efcd7e0f 100644 (file)
@@ -46,12 +46,14 @@ class NoNicks : public ModeHandler
 class ModuleNoNickChange : public Module
 {
        NoNicks nn;
+       bool override;
  public:
        ModuleNoNickChange() : nn(this)
        {
+               OnRehash(NULL);
                ServerInstance->Modes->AddMode(&nn);
-               Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+               Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric, I_OnRehash };
+               ServerInstance->Modules->Attach(eventlist, this, 3);
        }
 
        virtual ~ModuleNoNickChange()
@@ -91,6 +93,9 @@ class ModuleNoNickChange : public Module
                        if (res == MOD_RES_ALLOW)
                                continue;
 
+                       if (override && IS_OPER(user))
+                               continue;
+
                        if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet('N')))
                        {
                                user->WriteNumeric(ERR_CANTCHANGENICK, "%s :Can't change nickname while on %s (+N is set)",
@@ -101,6 +106,12 @@ class ModuleNoNickChange : public Module
 
                return MOD_RES_PASSTHRU;
        }
+
+       virtual void OnRehash(User* user)
+       {
+               ConfigReader Conf;
+               override = Conf.ReadFlag("nonicks", "operoverride", "no", 0);
+       }
 };
 
 MODULE_INIT(ModuleNoNickChange)