]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nickflood.cpp
Add method for writing server notices.
[user/henk/code/inspircd.git] / src / modules / m_nickflood.cpp
index 7c8452a6cb514874792e6f5d69a66876b4c2251c..f8593c26fa51d2957789e2b4c3bcfb45c2cca8b6 100644 (file)
@@ -56,7 +56,7 @@ class nickfloodsettings
                 * on successful nick changes; this will be checked before the counter is
                 * incremented.
                 */
-               return (counter + 1 >= this->nicks);
+               return ((ServerInstance->Time() <= reset) && (counter == this->nicks));
        }
 
        void clear()
@@ -135,15 +135,17 @@ class ModuleNickFlood : public Module
        NickFlood nf;
 
  public:
-
        ModuleNickFlood()
                : nf(this)
        {
-               if (!ServerInstance->Modes->AddMode(&nf))
-                       throw ModuleException("Could not add new modes!");
-               ServerInstance->Extensions.Register(&nf.ext);
+       }
+
+       void init()
+       {
+               ServerInstance->Modules->AddService(nf);
+               ServerInstance->Modules->AddService(nf.ext);
                Implementation eventlist[] = { I_OnUserPreNick, I_OnUserPostNick };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        ModResult OnUserPreNick(User* user, const std::string &newnick)
@@ -211,10 +213,6 @@ class ModuleNickFlood : public Module
                }
        }
 
-       ~ModuleNickFlood()
-       {
-       }
-
        Version GetVersion()
        {
                return Version("Channel mode F - nick flood protection", VF_VENDOR);