X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_chanfilter.cpp;h=53428a5a871af08f19274155a4a7ebb31ba810bb;hb=4bb972550e79292c5571714103780d873f5e82aa;hp=2828dca30a6dc81e43f215d016c25fb3f7d2462b;hpb=6c7a3ceb6c674a9af09da955ee0238e9291cf29a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 2828dca30..53428a5a8 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -23,9 +23,6 @@ */ -#define _CRT_SECURE_NO_DEPRECATE -#define _SCL_SECURE_NO_DEPRECATE - #include "inspircd.h" #include "listmode.h" @@ -38,9 +35,9 @@ class ChanFilter : public ListModeBase bool ValidateParam(User* user, Channel* chan, std::string &word) { - if ((word.length() > 35) || (word.empty())) + if (word.length() > 35) { - user->WriteNumeric(935, "%s %s :word is too %s for censor list", chan->name.c_str(), word.c_str(), (word.empty() ? "short" : "long")); + user->WriteNumeric(935, "%s %s :word is too long for censor list", chan->name.c_str(), word.c_str()); return false; } @@ -81,8 +78,12 @@ class ModuleChanFilter : public Module cf.DoRehash(); } - ModResult ProcessMessages(User* user,Channel* chan,std::string &text) + ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE { + if (target_type != TYPE_CHANNEL) + return MOD_RES_PASSTHRU; + + Channel* chan = static_cast(dest); ModResult res = ServerInstance->OnCheckExemption(user,chan,"filter"); if (!IS_LOCAL(user) || res == MOD_RES_ALLOW) @@ -108,15 +109,6 @@ class ModuleChanFilter : public Module return MOD_RES_PASSTHRU; } - ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE - { - if (target_type == TYPE_CHANNEL) - { - return ProcessMessages(user,(Channel*)dest,text); - } - return MOD_RES_PASSTHRU; - } - Version GetVersion() CXX11_OVERRIDE { return Version("Provides channel-specific censor lists (like mode +G but varies from channel to channel)", VF_VENDOR);