X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chanfilter.cpp;h=133c5180dd10338730378e333d20b0e0438053fb;hb=4aa27e75af8da0a5bc2e35f931f0165339f5f289;hp=53428a5a871af08f19274155a4a7ebb31ba810bb;hpb=f71e6bf9cb41811f18864f5d4eecb26e29d03f25;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 53428a5a8..133c5180d 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -25,6 +25,7 @@ #include "inspircd.h" #include "listmode.h" +#include "modules/exemption.h" /** Handles channel mode +g */ @@ -33,42 +34,43 @@ class ChanFilter : public ListModeBase public: ChanFilter(Module* Creator) : ListModeBase(Creator, "filter", 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { } - bool ValidateParam(User* user, Channel* chan, std::string &word) - { + bool ValidateParam(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE { if (word.length() > 35) { - user->WriteNumeric(935, "%s %s :word is too long for censor list", chan->name.c_str(), word.c_str()); + user->WriteNumeric(935, chan->name, word, "%word is too long for censor list"); return false; } return true; } - void TellListTooLong(User* user, Channel* chan, std::string &word) + void TellListTooLong(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE { - user->WriteNumeric(939, "%s %s :Channel spamfilter list is full", chan->name.c_str(), word.c_str()); + user->WriteNumeric(939, chan->name, word, "Channel spamfilter list is full"); } - void TellAlreadyOnList(User* user, Channel* chan, std::string &word) + void TellAlreadyOnList(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE { - user->WriteNumeric(937, "%s :The word %s is already on the spamfilter list", chan->name.c_str(), word.c_str()); + user->WriteNumeric(937, chan->name, InspIRCd::Format("The word %s is already on the spamfilter list", word.c_str())); } - void TellNotSet(User* user, Channel* chan, std::string &word) + void TellNotSet(User* user, Channel* chan, std::string& word) CXX11_OVERRIDE { - user->WriteNumeric(938, "%s :No such spamfilter word is set", chan->name.c_str()); + user->WriteNumeric(938, chan->name, "No such spamfilter word is set"); } }; class ModuleChanFilter : public Module { + CheckExemption::EventProvider exemptionprov; ChanFilter cf; bool hidemask; public: ModuleChanFilter() - : cf(this) + : exemptionprov(this) + , cf(this) { } @@ -84,7 +86,7 @@ class ModuleChanFilter : public Module return MOD_RES_PASSTHRU; Channel* chan = static_cast(dest); - ModResult res = ServerInstance->OnCheckExemption(user,chan,"filter"); + ModResult res = CheckExemption::Call(exemptionprov, user, chan, "filter"); if (!IS_LOCAL(user) || res == MOD_RES_ALLOW) return MOD_RES_PASSTHRU; @@ -98,9 +100,9 @@ class ModuleChanFilter : public Module if (InspIRCd::Match(text, i->mask)) { if (hidemask) - user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (your message contained a censored word)", chan->name.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (your message contained a censored word)"); else - user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Cannot send to channel (your message contained a censored word)", chan->name.c_str(), i->mask.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, i->mask, "Cannot send to channel (your message contained a censored word)"); return MOD_RES_DENY; } }