From 07ab60f3ffc7ca2818bd5761694b6b80b2bc045d Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Sun, 11 Jun 2017 00:33:33 +1000 Subject: [PATCH] Test sent_kick instead of kickcount for NICKFLOOD kicking kickcount is for counting KICKs sent by the user to detect KICK floods. The userlist and isme() tests are already done prior to calling handle_nickflood() so they are not needed here. --- source/names.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/names.c b/source/names.c index de18484..02e6690 100644 --- a/source/names.c +++ b/source/names.c @@ -1315,14 +1315,13 @@ void BX_remove_from_channel(char *channel, char *nick, int server, int netsplit, } } -void handle_nickflood(char *old_nick, char *new_nick, register NickList *nick, register ChannelList *chan, int flood_time) +static void handle_nickflood(char *old_nick, char *new_nick, register NickList *nick, register ChannelList *chan, int flood_time) { -time_t floodtime = now - nick->bantime; - if (isme(new_nick)) - return; + time_t floodtime = now - nick->bantime; + if ((!nick->bancount) || (nick->bancount && (floodtime > 3))) { - if (!nick->kickcount++ && ((nick->userlist && (nick->userlist->flags & ADD_FLOOD)) || !nick->userlist)) + if (!nick->sent_kick++) send_to_server("KICK %s %s :\002Niq flood (%d nicks in %dsecs of %dsecs)\002", chan->channel, new_nick, get_cset_int_var(chan->csets, KICK_ON_NICKFLOOD_CSET), flood_time, get_cset_int_var(chan->csets, NICKFLOOD_TIME_CSET)); } }