]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chanfilter.cpp
m_spanningtree Get rid of some boilerplate
[user/henk/code/inspircd.git] / src / modules / m_chanfilter.cpp
index 2828dca30a6dc81e43f215d016c25fb3f7d2462b..53428a5a871af08f19274155a4a7ebb31ba810bb 100644 (file)
@@ -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<Channel*>(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);