]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_showwhois.cpp
Convert all to new Attach() system. The Implements() method needs removing from all...
[user/henk/code/inspircd.git] / src / modules / m_showwhois.cpp
index d2324eb7362f1c628b50fd830d768ea4a4ded6b3..322fc4a62a98f7d20ad9abd52fcbebfe2757ffaf 100644 (file)
@@ -12,9 +12,6 @@
  */
 
 #include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 
 /* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */
 
@@ -25,7 +22,7 @@ class SeeWhois : public ModeHandler
  public:
        SeeWhois(InspIRCd* Instance) : ModeHandler(Instance, 'W', 0, 0, false, MODETYPE_USER, 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)
        {
                /* Only opers can change other users modes */
                if (source != dest)
@@ -63,8 +60,10 @@ class ModuleShowwhois : public Module
        {
                
                sw = new SeeWhois(ServerInstance);
-               if (!ServerInstance->AddMode(sw, 'W'))
+               if (!ServerInstance->AddMode(sw))
                        throw ModuleException("Could not add new modes!");
+               Implementation eventlist[] = { I_OnWhois };
+               ServerInstance->Modules->Attach(eventlist, this, 1);
        }
 
        ~ModuleShowwhois()
@@ -83,7 +82,7 @@ class ModuleShowwhois : public Module
                return Version(1,1,0,3,VF_COMMON|VF_VENDOR,API_VERSION);
        }
 
-       virtual void OnWhois(userrec* source, userrec* dest)
+       virtual void OnWhois(User* source, User* dest)
        {
                if ((dest->IsModeSet('W')) && (source != dest))
                {
@@ -106,25 +105,4 @@ class ModuleShowwhois : public Module
 
 };
 
-class ModuleShowwhoisFactory : public ModuleFactory
-{
-       public:
-               ModuleShowwhoisFactory()
-               {
-               }
-
-               ~ModuleShowwhoisFactory()
-               {
-               }
-
-               virtual Module* CreateModule(InspIRCd* Me)
-               {
-                       return new ModuleShowwhois(Me);
-               }
-
-};
-
-extern "C" DllExport void* init_module()
-{
-       return new ModuleShowwhoisFactory;
-}
+MODULE_INIT(ModuleShowwhois)