]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_censor.cpp
Get rid of irc::sockets::satoap().
[user/henk/code/inspircd.git] / src / modules / m_censor.cpp
index 11a69df9f15fb46cb31a25089c00f3dacabc3cfd..56639b2984f4352c8678000fc8704c887e4e0860 100644 (file)
@@ -21,6 +21,7 @@
 
 
 #include "inspircd.h"
+#include "modules/exemption.h"
 
 typedef insp::flat_map<irc::string, irc::string> censor_t;
 
@@ -42,12 +43,18 @@ class CensorChannel : public SimpleChannelModeHandler
 
 class ModuleCensor : public Module
 {
+       CheckExemption::EventProvider exemptionprov;
        censor_t censors;
        CensorUser cu;
        CensorChannel cc;
 
  public:
-       ModuleCensor() : cu(this), cc(this) { }
+       ModuleCensor()
+               : exemptionprov(this)
+               , cu(this)
+               , cc(this)
+       {
+       }
 
        // format of a config entry is <badword text="shit" replace="poo">
        ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE
@@ -63,7 +70,8 @@ class ModuleCensor : public Module
                {
                        Channel* c = (Channel*)dest;
                        active = c->IsModeSet(cc);
-                       ModResult res = ServerInstance->OnCheckExemption(user,c,"censor");
+                       ModResult res;
+                       FIRST_MOD_RESULT_CUSTOM(exemptionprov, CheckExemption::EventListener, OnCheckExemption, res, (user, c, "censor"));
 
                        if (res == MOD_RES_ALLOW)
                                return MOD_RES_PASSTHRU;
@@ -79,7 +87,7 @@ class ModuleCensor : public Module
                        {
                                if (index->second.empty())
                                {
-                                       user->WriteNumeric(ERR_WORDFILTERED, ((target_type == TYPE_CHANNEL) ? ((Channel*)dest)->name : ((User*)dest)->nick), index->first, "Your message contained a censored word, and was blocked");
+                                       user->WriteNumeric(ERR_WORDFILTERED, ((target_type == TYPE_CHANNEL) ? ((Channel*)dest)->name : ((User*)dest)->nick), index->first.c_str(), "Your message contained a censored word, and was blocked");
                                        return MOD_RES_DENY;
                                }