+ if (target.type != MessageTarget::TYPE_CHANNEL)
+ return MOD_RES_PASSTHRU;
+
+ Channel* dest = target.Get<Channel>();
+ if ((!IS_LOCAL(user)) || !dest->IsModeSet(mf))
+ return MOD_RES_PASSTHRU;
+
+ ModResult res = CheckExemption::Call(exemptionprov, user, dest, "flood");
+ if (res == MOD_RES_ALLOW)
+ return MOD_RES_PASSTHRU;
+
+ floodsettings *f = mf.ext.get(dest);
+ if (f)
+ {
+ if (f->addmessage(user))
+ {
+ /* Youre outttta here! */
+ f->clear(user);
+ if (f->ban)
+ {
+ Modes::ChangeList changelist;
+ changelist.push_add(ServerInstance->Modes->FindMode('b', MODETYPE_CHANNEL), "*!*@" + user->GetDisplayedHost());
+ ServerInstance->Modes->Process(ServerInstance->FakeClient, dest, NULL, changelist);
+ }
+
+ const std::string kickMessage = "Channel flood triggered (trigger is " + ConvToStr(f->lines) +
+ " lines in " + ConvToStr(f->secs) + " secs)";
+
+ dest->KickUser(ServerInstance->FakeClient, user, kickMessage);
+
+ return MOD_RES_DENY;
+ }
+ }
+
+ return MOD_RES_PASSTHRU;