]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_messageflood.cpp
Omit the server name internally when building a /STATS reply and prepend it later
[user/henk/code/inspircd.git] / src / modules / m_messageflood.cpp
index a898fd5d1ba037ebac81d23f2de73d23052c1d4f..e2d752d183565f4a17bfe7e67d811549a1d3ee54 100644 (file)
@@ -25,8 +25,6 @@
 
 #include "inspircd.h"
 
-/* $ModDesc: Provides channel mode +f (message flood protection) */
-
 /** Holds flood settings and state for mode +f
  */
 class floodsettings
@@ -80,7 +78,7 @@ class MsgFlood : public ModeHandler
                        std::string::size_type colon = parameter.find(':');
                        if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos))
                        {
-                               source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str());
+                               source->WriteNumeric(608, "%s :Invalid flood parameter", channel->name.c_str());
                                return MODEACTION_DENY;
                        }
 
@@ -91,7 +89,7 @@ class MsgFlood : public ModeHandler
 
                        if ((nlines<2) || (nsecs<1))
                        {
-                               source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str());
+                               source->WriteNumeric(608, "%s :Invalid flood parameter", channel->name.c_str());
                                return MODEACTION_DENY;
                        }
 
@@ -126,15 +124,12 @@ class ModuleMsgFlood : public Module
        {
        }
 
-       void init() CXX11_OVERRIDE
+       ModResult OnUserPreMessage(User* user, void* voiddest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE
        {
-               ServerInstance->Modules->AddService(mf);
-               ServerInstance->Modules->AddService(mf.ext);
-               ServerInstance->Modules->Attach(I_OnUserPreMessage, this);
-       }
+               if (target_type != TYPE_CHANNEL)
+                       return MOD_RES_PASSTHRU;
 
-       ModResult ProcessMessages(User* user,Channel* dest, const std::string &text)
-       {
+               Channel* dest = static_cast<Channel*>(voiddest);
                if ((!IS_LOCAL(user)) || !dest->IsModeSet(mf))
                        return MOD_RES_PASSTHRU;
 
@@ -169,14 +164,6 @@ class ModuleMsgFlood : 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;
-       }
-
        void Prioritize()
        {
                // we want to be after all modules that might deny the message (e.g. m_muteban, m_noctcp, m_blockcolor, etc.)