]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_operlevels.cpp
Switch <stdint.h> test to use a test file too.
[user/henk/code/inspircd.git] / src / modules / m_operlevels.cpp
index d142a4b0f6867d365694bb26141c80ea9f176691..569defd498af9377a9dd5949bddf0b33a1dad357 100644 (file)
  */
 
 
+/* $ModDesc: Gives each oper type a 'level', cannot kill opers 'above' your level. */
+
 #include "inspircd.h"
 
-/* $ModDesc: Gives each oper type a 'level', cannot kill opers 'above' your level. */
 class ModuleOperLevels : public Module
 {
        public:
-               ModuleOperLevels()
-               {
-                       Implementation eventlist[] = { I_OnRehash, I_OnKill };
-                       ServerInstance->Modules->Attach(eventlist, this, 2);
-               }
-
-               virtual ~ModuleOperLevels()
-               {
-               }
-
-
-               virtual void OnRehash(User* user)
+               void init()
                {
+                       ServerInstance->Modules->Attach(I_OnKill, this);
                }
 
                virtual Version GetVersion()
@@ -51,8 +42,11 @@ class ModuleOperLevels : public Module
                        // oper killing an oper?
                        if (IS_OPER(dest) && IS_OPER(source))
                        {
-                               long dest_level = atol(dest->oper->getConfig("level").c_str());
-                               long source_level = atol(source->oper->getConfig("level").c_str());
+                               std::string level = dest->oper->getConfig("level");
+                               long dest_level = atol(level.c_str());
+                               level = source->oper->getConfig("level");
+                               long source_level = atol(level.c_str());
+
                                if (dest_level > source_level)
                                {
                                        if (IS_LOCAL(source)) ServerInstance->SNO->WriteGlobalSno('a', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick.c_str(),source_level,dest->nick.c_str(),dest_level,reason.c_str());
@@ -63,7 +57,6 @@ class ModuleOperLevels : public Module
                        }
                        return MOD_RES_PASSTHRU;
                }
-
 };
 
 MODULE_INIT(ModuleOperLevels)