]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_joinflood.cpp
Header update: 2007 -> 2008
[user/henk/code/inspircd.git] / src / modules / m_joinflood.cpp
index 15cc535c06179609798585c02ca7bb04e5b09658..ee38cf0074456de1cc3a8ebb6f4769e1a44181f9 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
@@ -194,7 +194,7 @@ class JoinFlood : public ModeHandler
                        {
                                joinfloodsettings *f;
                                channel->GetExt("joinflood", f);
-                               DELETE(f);
+                               delete f;
                                channel->Shrink("joinflood");
                                channel->SetMode('j', false);
                                return MODEACTION_ALLOW;
@@ -218,6 +218,8 @@ class ModuleJoinFlood : public Module
                jf = new JoinFlood(ServerInstance);
                if (!ServerInstance->AddMode(jf))
                        throw ModuleException("Could not add new modes!");
+               Implementation eventlist[] = { I_OnChannelDelete, I_OnUserPreJoin, I_OnUserJoin };
+               ServerInstance->Modules->Attach(eventlist, this, 3);
        }
        
        virtual int OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs)
@@ -237,9 +239,15 @@ class ModuleJoinFlood : public Module
                return 0;
        }
 
-       virtual void OnUserJoin(User* user, Channel* channel, bool &silent)
+       virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
        {
                joinfloodsettings *f;
+
+               /* We arent interested in JOIN events caused by a network burst */
+               if (sync)
+                       return;
+
+               /* But all others are OK */
                if (channel->GetExt("joinflood",f))
                {
                        f->addjoin();
@@ -257,20 +265,16 @@ class ModuleJoinFlood : public Module
                joinfloodsettings *f;
                if (chan->GetExt("joinflood",f))
                {
-                       DELETE(f);
+                       delete f;
                        chan->Shrink("joinflood");
                }
        }
 
-       void Implements(char* List)
-       {
-               List[I_OnChannelDelete] = List[I_OnUserPreJoin] = List[I_OnUserJoin] = 1;
-       }
 
        virtual ~ModuleJoinFlood()
        {
                ServerInstance->Modes->DelMode(jf);
-               DELETE(jf);
+               delete jf;
        }
        
        virtual Version GetVersion()