]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_deaf.cpp
Fix potential for duplicate SID if the SID is auto generated.
[user/henk/code/inspircd.git] / src / modules / m_deaf.cpp
index 2a1449bb4ed08d18d5643086c05e2ec36b7ceba2..c7d40115a6bc5769fcc96ed3e0f2217b269d347e 100644 (file)
@@ -11,9 +11,6 @@
  * ---------------------------------------------------
  */
 
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 #include "inspircd.h"
 
 /* $ModDesc: Provides support for ircu style usermode +d (deaf to channel messages and channel notices) */
@@ -31,6 +28,7 @@ class User_d : public ModeHandler
                {
                        if (!dest->IsModeSet('d'))
                        {
+                               dest->WriteServ("NOTICE %s :*** You have enabled usermode +d, deaf mode. This mode means you WILL NOT receive any messages from any channels you are in. If you did NOT mean to do this, use /mode %s -d.", dest->nick, dest->nick);
                                dest->SetMode('d',true);
                                return MODEACTION_ALLOW;
                        }
@@ -52,7 +50,7 @@ class ModuleDeaf : public Module
        User_d* m1;
  public:
        ModuleDeaf(InspIRCd* Me)
-               : Module::Module(Me)
+               : Module(Me)
        {
                m1 = new User_d(ServerInstance);
                if (!ServerInstance->AddMode(m1, 'd'))
@@ -95,11 +93,11 @@ class ModuleDeaf : public Module
 
                for (CUList::iterator i = ulist->begin(); i != ulist->end(); i++)
                {
-                       if (IS_LOCAL(i->second))
+                       if (IS_LOCAL(i->first))
                        {
-                               if (i->second->IsModeSet('d'))
+                               if (i->first->IsModeSet('d'))
                                {
-                                       exempt_list[i->second] = i->second;
+                                       exempt_list[i->first] = i->first->nick;
                                }
                        }
                }
@@ -110,6 +108,7 @@ class ModuleDeaf : public Module
                if (target_type == TYPE_CHANNEL)
                {
                        chanrec* chan = (chanrec*)dest;
+
                        if (chan)
                        {
                                this->OnBuildExemptList(MSG_PRIVMSG, chan, user, status, exempt_list);
@@ -131,28 +130,4 @@ class ModuleDeaf : public Module
 
 };
 
-
-class ModuleDeafFactory : public ModuleFactory
-{
- public:
-       ModuleDeafFactory()
-       {
-       }
-       
-       ~ModuleDeafFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleDeaf(Me);
-       }
-       
-};
-
-
-extern "C" void * init_module( void )
-{
-       return new ModuleDeafFactory;
-}
-
+MODULE_INIT(ModuleDeaf)