]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_restrictchans.cpp
Some more to fix still, modules probably wont load correctly atm
[user/henk/code/inspircd.git] / src / modules / m_restrictchans.cpp
index e283440f4c42f2d74ac4f7cec2b010a7d065c9ba..015025c032c3c39491d42141bf7e785ef6fab401 100644 (file)
  * ---------------------------------------------------
  */
 
-#include <stdio.h>
-#include <map>
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
-
 #include "inspircd.h"
 
 /* $ModDesc: Only opers may create new channels if this module is loaded */
@@ -47,9 +41,11 @@ class ModuleRestrictChans : public Module
        {
                
                ReadConfig();
+               Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash };
+               ServerInstance->Modules->Attach(eventlist, this, 2);
        }
 
-       virtual void OnRehash(userrec* user, const std::string &parameter)
+       virtual void OnRehash(User* user, const std::string &parameter)
        {
                ReadConfig();
        }
@@ -59,7 +55,7 @@ class ModuleRestrictChans : public Module
                List[I_OnUserPreJoin] = List[I_OnRehash] = 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)
        {
                irc::string x = cname;
                // user is not an oper and its not in the allow list
@@ -85,28 +81,4 @@ class ModuleRestrictChans : public Module
        }
 };
 
-
-class ModuleRestrictChansFactory : public ModuleFactory
-{
- public:
-       ModuleRestrictChansFactory()
-       {
-       }
-       
-       ~ModuleRestrictChansFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleRestrictChans(Me);
-       }
-       
-};
-
-
-extern "C" DllExport void * init_module( void )
-{
-       return new ModuleRestrictChansFactory;
-}
-
+MODULE_INIT(ModuleRestrictChans)