X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_joinflood.cpp;h=466ceb52e27f88088cbed0a8dd612c0c8b7d1e95;hb=83137d5f9274832f152acc7d19de3cb0897f9630;hp=6840e155c18fe74538c795f23bcce4a17fba591f;hpb=b57c7f4e466f72fdd2ac3deca42caa1ea7748338;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 6840e155c..466ceb52e 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -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 JoinFlood : public ModeHandler return (their_param < our_param); } - ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) + ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { joinfloodsettings* dummy; @@ -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; @@ -216,8 +216,10 @@ class ModuleJoinFlood : public Module { jf = new JoinFlood(ServerInstance); - if (!ServerInstance->AddMode(jf, 'j')) + if (!ServerInstance->Modes->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()