]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_botmode.cpp
New 'Implements' system
[user/henk/code/inspircd.git] / src / modules / m_botmode.cpp
index 6d8269435ab5da25f7b6da113365d27074412017..909befee011da3ae0d51b04a1ed1cc18d31263a0 100644 (file)
@@ -14,6 +14,8 @@
  * ---------------------------------------------------
  */
 
+using namespace std;
+
 #include <stdio.h>
 #include <string>
 #include "users.h"
@@ -26,26 +28,30 @@ class ModuleBotMode : public Module
 {
        Server *Srv; 
  public:
-       ModuleBotMode()
+       ModuleBotMode(Server* Me)
+               : Module::Module(Me)
        {
-               Srv = new Server;
+               Srv = Me;
                
                if (!Srv->AddExtendedMode('B',MT_CLIENT,false,0,0))
                {
                        Srv->Log(DEFAULT,"*** m_botmode: ERROR, failed to allocate user mode +B!");
-                       printf("Could not claim usermode +B for this module!");
-                       exit(0);
+                       return;
                }
        }
+
+       void Implements(char* List)
+       {
+               List[I_OnWhois] = List[I_OnExtendedMode] = 1;
+       }
        
        virtual ~ModuleBotMode()
        {
-               delete Srv;
        }
        
        virtual Version GetVersion()
        {
-               return Version(1,0,0,0);
+               return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
        }
        
        virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list &params)
@@ -83,9 +89,9 @@ class ModuleBotModeFactory : public ModuleFactory
        {
        }
        
-       virtual Module * CreateModule()
+       virtual Module * CreateModule(Server* Me)
        {
-               return new ModuleBotMode;
+               return new ModuleBotMode(Me);
        }
        
 };