]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nickflood.cpp
Dynamically determine the size of the eventlist[] passed to Attach()
[user/henk/code/inspircd.git] / src / modules / m_nickflood.cpp
index ec9d9a26140d91f9b12e945f8ac02f76d73095ab..349bf1a5d1f38e07f6a2ee2577a7301502e1d26d 100644 (file)
@@ -138,12 +138,16 @@ class ModuleNickFlood : public Module
 
        ModuleNickFlood()
                : nf(this)
+       {
+       }
+
+       void init()
        {
                if (!ServerInstance->Modes->AddMode(&nf))
                        throw ModuleException("Could not add new modes!");
                ServerInstance->Extensions.Register(&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)