]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nonotice.cpp
Fix potential for duplicate SID if the SID is auto generated.
[user/henk/code/inspircd.git] / src / modules / m_nonotice.cpp
index 5ec063e7127aa4d585e62066f1503c6f4161ba3e..e536328bc0b0b65a51c5d98a8d686a9be70d7ca7 100644 (file)
@@ -11,9 +11,6 @@
  * ---------------------------------------------------
  */
 
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 #include "inspircd.h"
 
 /* $ModDesc: Provides support for unreal-style channel mode +T */
@@ -53,11 +50,12 @@ class ModuleNoNotice : public Module
  public:
  
        ModuleNoNotice(InspIRCd* Me)
-               : Module::Module(Me)
+               : Module(Me)
        {
                
                nt = new NoNotice(ServerInstance);
-               ServerInstance->AddMode(nt, 'T');
+               if (!ServerInstance->AddMode(nt, 'T'))
+                       throw ModuleException("Could not add new modes!");
        }
 
        void Implements(char* List)
@@ -67,7 +65,7 @@ class ModuleNoNotice : public Module
        
        virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
-               if (target_type == TYPE_CHANNEL)
+               if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
                {
                        chanrec* c = (chanrec*)dest;
                        if (c->IsModeSet('T'))
@@ -99,28 +97,4 @@ class ModuleNoNotice : public Module
        }
 };
 
-
-class ModuleNoNoticeFactory : public ModuleFactory
-{
- public:
-       ModuleNoNoticeFactory()
-       {
-       }
-       
-       ~ModuleNoNoticeFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleNoNotice(Me);
-       }
-       
-};
-
-
-extern "C" void * init_module( void )
-{
-       return new ModuleNoNoticeFactory;
-}
-
+MODULE_INIT(ModuleNoNotice)