]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_blockcolor.cpp
Add sanity checks to the ssl modules so that theres no possibility of an out of range...
[user/henk/code/inspircd.git] / src / modules / m_blockcolor.cpp
index a40d4ebd3f11439d8c98de462e5fd8648d98afd7..d46e5a9d6f36e4044cdd0a97226ab4e7424a3789 100644 (file)
  * ---------------------------------------------------
  */
 
-#include <stdio.h>
-#include <sstream>
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 #include "inspircd.h"
 
 /* $ModDesc: Provides support for unreal-style channel mode +c */
@@ -56,28 +51,19 @@ class ModuleBlockColour : public Module
        BlockColor *bc;
  public:
  
-       ModuleBlockColour(InspIRCd* Me) : Module::Module(Me)
+       ModuleBlockColour(InspIRCd* Me) : Module(Me)
        {
                bc = new BlockColor(ServerInstance);
                if (!ServerInstance->AddMode(bc, 'c'))
                        throw ModuleException("Could not add new modes!");
-
-               OnRehash(NULL, "");
        }
 
        void Implements(char* List)
        {
-               List[I_OnRehash] = List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
+               List[I_OnUserPreMessage] = List[I_OnUserPreNotice] = 1;
        }
 
 
-       virtual void OnRehash(userrec* user, const std::string &parameter)
-       {
-               ConfigReader Conf(ServerInstance);
-
-               AllowChanOps = Conf.ReadFlag("blockcolor", "allowchanops", 0);
-       }
-
        virtual int OnUserPreMessage(userrec* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
        {
                if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
@@ -86,7 +72,7 @@ class ModuleBlockColour : public Module
                        
                        if(c->IsModeSet('c'))
                        {
-                               if (!AllowChanOps || AllowChanOps && c->GetStatus(user) != STATUS_OP)
+                               if (!CHANOPS_EXEMPT(ServerInstance, 'c') || CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetStatus(user) != STATUS_OP)
                                {
                                        for (std::string::iterator i = text.begin(); i != text.end(); i++)
                                        {
@@ -126,27 +112,4 @@ class ModuleBlockColour : public Module
        }
 };
 
-
-class ModuleBlockColourFactory : public ModuleFactory
-{
- public:
-       ModuleBlockColourFactory()
-       {
-       }
-       
-       ~ModuleBlockColourFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleBlockColour(Me);
-       }
-       
-};
-
-
-extern "C" void * init_module( void )
-{
-       return new ModuleBlockColourFactory;
-}
+MODULE_INIT(ModuleBlockColour)