]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_nickflood.cpp
The module hook is kinda required.
[user/henk/code/inspircd.git] / src / modules / m_nickflood.cpp
index d560774fc6280dd5c5ba9a5d6180473418568d05..72e2831dae4f827aae4cc95c06bf305b667c41d9 100644 (file)
@@ -97,7 +97,7 @@ class NickFlood : public ModeHandler
                        return std::make_pair(true, ConvToStr(x->nicks)+":"+ConvToStr(x->secs));
                else
                        return std::make_pair(false, parameter);
-       } 
+       }
 
        bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel)
        {
@@ -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.c_str(),channel->name.c_str());
                                        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.c_str(),channel->name.c_str());
                                return MODEACTION_DENY;
                        }
                }
@@ -207,15 +207,15 @@ class NickFlood : public ModeHandler
 class ModuleNickFlood : public Module
 {
        NickFlood* jf;
-       
+
  public:
+
        ModuleNickFlood(InspIRCd* Me)
                : Module(Me)
        {
-               
+
                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.c_str(), channel->name.c_str(), f->nicks, f->secs);
                                        return 1;
                                }
 
@@ -247,7 +247,7 @@ class ModuleNickFlood : public Module
                                {
                                        f->clear();
                                        f->lock();
-                                       channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :No nick changes are allowed for 60 seconds because there have been more than %d nick changes in %d seconds.", channel->name, f->nicks, f->secs);
+                                       channel->WriteChannelWithServ((char*)ServerInstance->Config->ServerName, "NOTICE %s :No nick changes are allowed for 60 seconds because there have been more than %d nick changes in %d seconds.", channel->name.c_str(), f->nicks, f->secs);
                                        return 1;
                                }
                        }
@@ -255,7 +255,7 @@ class ModuleNickFlood : public Module
 
                return 0;
        }
-       
+
        void OnChannelDelete(Channel* chan)
        {
                nickfloodsettings *f;
@@ -272,10 +272,10 @@ class ModuleNickFlood : public Module
                ServerInstance->Modes->DelMode(jf);
                delete jf;
        }
-       
+
        virtual Version GetVersion()
        {
-               return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
        }
 };