]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_messageflood.cpp
Fix all typos (not as fun as 'kill all humans' but meh, beggers cant be choosers)
[user/henk/code/inspircd.git] / src / modules / m_messageflood.cpp
index 97b51b36fa95f5d541e47c82224f9a030e4939b4..c5df268ea896ad5953ee90b09cd46d60350d5ce9 100644 (file)
@@ -144,7 +144,7 @@ class ModuleMsgFlood : public Module
                                        {
                                                if (!c->GetExt("flood"))
                                                {
-                                                       floodsettings *f = new floodsettings(ban,nlines,nsecs);
+                                                       floodsettings *f = new floodsettings(ban,nsecs,nlines);
                                                        c->Extend("flood",(char*)f);
                                                }
                                        }
@@ -163,7 +163,7 @@ class ModuleMsgFlood : public Module
                                if (c->GetExt("flood"))
                                {
                                        floodsettings *f = (floodsettings*)c->GetExt("flood");
-                                       delete f;
+                                       DELETE(f);
                                        c->Shrink("flood");
                                }
                        }
@@ -172,38 +172,41 @@ class ModuleMsgFlood : public Module
                return 0;
        }
 
-       void ProcessMessages(userrec* user,chanrec* dest,std::string &text)
+       void ProcessMessages(userrec* user,chanrec* dest, const std::string &text)
        {
-               floodsettings *f = (floodsettings*)dest->GetExt("flood");
-               if (f)
+               if (IS_LOCAL(user))
                {
-                       f->addmessage(user);
-                       if (f->shouldkick(user))
+                       floodsettings *f = (floodsettings*)dest->GetExt("flood");
+                       if (f)
                        {
-                               /* Youre outttta here! */
-                               f->clear(user);
-                               if (f->ban)
+                               f->addmessage(user);
+                               if (f->shouldkick(user))
                                {
-                                       char* parameters[3];
-                                       parameters[0] = dest->name;
-                                       parameters[1] = "+b";
-                                       parameters[2] = user->MakeWildHost();
-                                       Srv->SendMode(parameters,3,user);
+                                       /* Youre outttta here! */
+                                       f->clear(user);
+                                       if (f->ban)
+                                       {
+                                               char* parameters[3];
+                                               parameters[0] = dest->name;
+                                               parameters[1] = "+b";
+                                               parameters[2] = user->MakeWildHost();
+                                               Srv->SendMode(parameters,3,user);
+                                       }
+                                       Srv->KickUser(NULL, user, dest, "Channel flood triggered (mode +f)");
                                }
-                               Srv->KickUser(NULL, user, dest, "Channel flood triggered (mode +f)");
                        }
                }
        }
 
-        virtual void OnUserMessage(userrec* user, void* dest, int target_type, std::string text, char status)
+       virtual void OnUserMessage(userrec* user, void* dest, int target_type, const std::string &text, char status)
        {
-                if (target_type == TYPE_CHANNEL)
-                {
-                        ProcessMessages(user,(chanrec*)dest,text);
-                }
+               if (target_type == TYPE_CHANNEL)
+               {
+                       ProcessMessages(user,(chanrec*)dest,text);
+               }
        }
 
-       virtual void OnUserNotice(userrec* user, void* dest, int target_type, std::string text, char status)
+       virtual void OnUserNotice(userrec* user, void* dest, int target_type, const std::string &text, char status)
        {
                if (target_type == TYPE_CHANNEL)
                {
@@ -216,7 +219,7 @@ class ModuleMsgFlood : public Module
                if (chan->GetExt("flood"))
                {
                        floodsettings *f = (floodsettings*)chan->GetExt("flood");
-                       delete f;
+                       DELETE(f);
                        chan->Shrink("flood");
                }
        }