]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nickflood.cpp
Use loopCall to protect OnUserKick rather than the triggerevents hack
[user/henk/code/inspircd.git] / src / modules / m_nickflood.cpp
index 4961e97a0f31e90730bd91c4db535f18008e3f6d..0a8e9a31d2ecd9cb21640f5e7cc263422e77db61 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
  */
 class nickfloodsettings : public classbase
 {
+ private:
+       InspIRCd* ServerInstance;
  public:
-
        int secs;
        int nicks;
        time_t reset;
        time_t unlocktime;
        int counter;
        bool locked;
-       InspIRCd* ServerInstance;
-
-       nickfloodsettings() : secs(0), nicks(0) {};
 
-       nickfloodsettings(int b, int c) : secs(b), nicks(c)
+       nickfloodsettings(InspIRCd *Instance, int b, int c) : ServerInstance(Instance), secs(b), nicks(c)
        {
-               reset = ServerInstance->Time() + secs;
+               reset = Instance->Time() + secs;
                counter = 0;
                locked = false;
        };
@@ -144,10 +142,9 @@ class NickFlood : public ModeHandler
                                        if (!channel->GetExt("nickflood", dummy))
                                        {
                                                parameter = ConvToStr(nnicks) + ":" +ConvToStr(nsecs);
-                                               nickfloodsettings *f = new nickfloodsettings(nsecs,nnicks);
+                                               nickfloodsettings *f = new nickfloodsettings(ServerInstance, nsecs, nnicks);
                                                channel->Extend("nickflood", f);
-                                               channel->SetMode('F', true);
-                                               channel->SetModeParam('F', parameter.c_str(), true);
+                                               channel->SetMode('F', parameter);
                                                return MODEACTION_ALLOW;
                                        }
                                        else
@@ -167,11 +164,10 @@ class NickFlood : public ModeHandler
                                                                nickfloodsettings* f;
                                                                channel->GetExt("nickflood", f);
                                                                delete f;
-                                                               f = new nickfloodsettings(nsecs, nnicks);
+                                                               f = new nickfloodsettings(ServerInstance, nsecs, nnicks);
                                                                channel->Shrink("nickflood");
                                                                channel->Extend("nickflood", f);
-                                                               channel->SetModeParam('F', cur_param.c_str(), false);
-                                                               channel->SetModeParam('F', parameter.c_str(), true);
+                                                               channel->SetMode('F', parameter);
                                                                return MODEACTION_ALLOW;
                                                        }
                                                        else
@@ -196,7 +192,7 @@ class NickFlood : public ModeHandler
                                channel->GetExt("nickflood", f);
                                delete f;
                                channel->Shrink("nickflood");
-                               channel->SetMode('F', false);
+                               channel->SetMode('F', "");
                                return MODEACTION_ALLOW;
                        }
                }