]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_blockcolor.cpp
Get rid of irc::sockets::satoap().
[user/henk/code/inspircd.git] / src / modules / m_blockcolor.cpp
index 6d1111a1dceeff8ee3e36ab077a94c58bf42fb6b..7c961d96aab49f2bfd902d5e00dcac03638fd5f9 100644 (file)
@@ -22,8 +22,7 @@
 
 
 #include "inspircd.h"
-
-/* $ModDesc: Provides channel mode +c to block color */
+#include "modules/exemption.h"
 
 /** Handles the +c channel mode
  */
@@ -35,18 +34,14 @@ class BlockColor : public SimpleChannelModeHandler
 
 class ModuleBlockColor : public Module
 {
+       CheckExemption::EventProvider exemptionprov;
        BlockColor bc;
  public:
 
-       ModuleBlockColor() : bc(this)
-       {
-       }
-
-       void init() CXX11_OVERRIDE
+       ModuleBlockColor()
+               : exemptionprov(this)
+               , bc(this)
        {
-               ServerInstance->Modules->AddService(bc);
-               Implementation eventlist[] = { I_OnUserPreMessage, I_On005Numeric };
-               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
@@ -59,7 +54,8 @@ class ModuleBlockColor : public Module
                if ((target_type == TYPE_CHANNEL) && (IS_LOCAL(user)))
                {
                        Channel* c = (Channel*)dest;
-                       ModResult res = ServerInstance->OnCheckExemption(user,c,"blockcolor");
+                       ModResult res;
+                       FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, c, "blockcolor"));
 
                        if (res == MOD_RES_ALLOW)
                                return MOD_RES_PASSTHRU;
@@ -76,7 +72,7 @@ class ModuleBlockColor : public Module
                                                case 21:
                                                case 22:
                                                case 31:
-                                                       user->WriteNumeric(404, "%s %s :Can't send colors to channel (+c set)",user->nick.c_str(), c->name.c_str());
+                                                       user->WriteNumeric(ERR_CANNOTSENDTOCHAN, c->name, "Can't send colors to channel (+c set)");
                                                        return MOD_RES_DENY;
                                                break;
                                        }