]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nickflood.cpp
fix some unitialised vectors and tidy up a bit.
[user/henk/code/inspircd.git] / src / modules / m_nickflood.cpp
index 7e5e6b2c5e391f918c32f26e89fa8452b6a33a93..09570c104fd24d3c074a68ab6a44f8d2363947bd 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
  * See: http://www.inspircd.org/wiki/index.php/Credits
  *
  * This program is free but copyrighted software; see
@@ -105,7 +105,7 @@ class NickFlood : public ModeHandler
                return (their_param < our_param);
        }
 
-       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding)
+       ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string &parameter, bool adding, bool)
        {
                nickfloodsettings* dummy;
 
@@ -135,7 +135,7 @@ class NickFlood : public ModeHandler
                                int nsecs = atoi(secs);
                                if ((nnicks<1) || (nsecs<1))
                                {
-                                       source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name);
+                                       source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name);
                                        parameter.clear();
                                        return MODEACTION_DENY;
                                }
@@ -184,7 +184,7 @@ class NickFlood : public ModeHandler
                        }
                        else
                        {
-                               source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name);
+                               source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name);
                                return MODEACTION_DENY;
                        }
                }
@@ -194,7 +194,7 @@ class NickFlood : public ModeHandler
                        {
                                nickfloodsettings *f;
                                channel->GetExt("nickflood", f);
-                               DELETE(f);
+                               delete f;
                                channel->Shrink("nickflood");
                                channel->SetMode('F', false);
                                return MODEACTION_ALLOW;
@@ -215,7 +215,7 @@ class ModuleNickFlood : public Module
        {
                
                jf = new NickFlood(ServerInstance);
-               if (!ServerInstance->AddMode(jf))
+               if (!ServerInstance->Modes->AddMode(jf))
                        throw ModuleException("Could not add new modes!");
                Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreNick };
                ServerInstance->Modules->Attach(eventlist, this, 2);
@@ -238,7 +238,7 @@ class ModuleNickFlood : public Module
 
                                if (f->islocked())
                                {
-                                       user->WriteServ("447 %s :%s has been locked for nickchanges for 60 seconds because there have been more than %d nick changes in %d seconds", user->nick, channel->name, f->nicks, f->secs);
+                                       user->WriteNumeric(447, "%s :%s has been locked for nickchanges for 60 seconds because there have been more than %d nick changes in %d seconds", user->nick, channel->name, f->nicks, f->secs);
                                        return 1;
                                }
 
@@ -261,25 +261,21 @@ class ModuleNickFlood : public Module
                nickfloodsettings *f;
                if (chan->GetExt("nickflood",f))
                {
-                       DELETE(f);
+                       delete f;
                        chan->Shrink("nickflood");
                }
        }
 
-       void Implements(char* List)
-       {
-               List[I_OnChannelDelete] = List[I_OnUserPreNick] = 1;
-       }
 
        virtual ~ModuleNickFlood()
        {
                ServerInstance->Modes->DelMode(jf);
-               DELETE(jf);
+               delete jf;
        }
        
        virtual Version GetVersion()
        {
-               return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
        }
 };