]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_operchans.cpp
Fix these to use new hook system (u_listmode wasnt fixed yet)
[user/henk/code/inspircd.git] / src / modules / m_operchans.cpp
index 883849dca1c4c49eb76d3a88d7464d9f8d209f31..e96fbc79a8cd40aecbe6382588efd3dd652b72c4 100644 (file)
@@ -12,9 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 
 /* $ModDesc: Provides support for oper-only chans via the +O channel mode */
 
@@ -24,7 +21,7 @@ class OperChans : public ModeHandler
        /* This is an oper-only mode */
        OperChans(InspIRCd* Instance) : ModeHandler(Instance, 'O', 0, 0, false, MODETYPE_CHANNEL, true) { }
 
-       ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string &parameter, bool adding)
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
        {
                if (adding)
                {
@@ -57,8 +54,10 @@ class ModuleOperChans : public Module
        {
                                
                oc = new OperChans(ServerInstance);
-               if (!ServerInstance->AddMode(oc, 'O'))
+               if (!ServerInstance->AddMode(oc))
                        throw ModuleException("Could not add new modes!");
+               Implementation eventlist[] = { I_OnUserPreJoin };
+               ServerInstance->Modules->Attach(eventlist, this, 1);
        }
 
        void Implements(char* List)
@@ -66,7 +65,7 @@ class ModuleOperChans : public Module
                List[I_OnUserPreJoin] = 1;
        }
 
-       virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname, std::string &privs)
+       virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs)
        {
                if (!IS_OPER(user))
                {
@@ -85,7 +84,7 @@ class ModuleOperChans : public Module
        virtual ~ModuleOperChans()
        {
                ServerInstance->Modes->DelMode(oc);
-               DELETE(oc);
+               delete oc;
        }
        
        virtual Version GetVersion()
@@ -94,4 +93,4 @@ class ModuleOperChans : public Module
        }
 };
 
-MODULE_INIT(ModuleOperChans);
+MODULE_INIT(ModuleOperChans)