From 30ce0623d43f811bbefdf5baa7fca1b0dc32d85f Mon Sep 17 00:00:00 2001 From: pk910 Date: Fri, 21 Oct 2011 00:38:42 +0200 Subject: [PATCH] ignore users with access > channel_getop/getvoice if ScanChanOps/ScanVoiced is off within the joinflood scanner --- src/event_neonspam_join.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/event_neonspam_join.c b/src/event_neonspam_join.c index b443ef3..f2af828 100644 --- a/src/event_neonspam_join.c +++ b/src/event_neonspam_join.c @@ -95,24 +95,27 @@ static void neonspam_event_join_punish(struct ClientSocket *client, struct ChanU if(chanuser->user->flags & USERFLAG_ISAUTHED) uaccess = getChannelAccess(chanuser->user, chanuser->chan, 0); if(uaccess >= settings->exceptlevel) return; + //scanops / scanvoiced + MYSQL_RES *res; + MYSQL_ROW row, defaults; + loadChannelSettings(chanuser->chan); + printf_mysql_query("SELECT `%s`, `channel_getop`, `channel_getvoice` FROM `channels` WHERE `channel_id` = '%d'", reaction, chanuser->chan->channel_id); + res = mysql_use(); + row = mysql_fetch_row(res); + if(!row[0] || !row[1] || !row[2]) { + printf_mysql_query("SELECT `%s`, `channel_getop`, `channel_getvoice` FROM `channels` WHERE `channel_name` = 'defaults'", reaction); + res = mysql_use(); + defaults = mysql_fetch_row(res); + } + if(!(settings->flags & SPAMSETTINGS_SCANOPS) && uaccess >= atoi((row[1] ? row[1] : defaults[1]))) return; + if(!(settings->flags & SPAMSETTINGS_SCANVOICE) && uaccess >= atoi((row[2] ? row[2] : defaults[2]))) return; if(action == SPAMSERV_CHECK_WARN) { reply(client, chanuser->user, "%s", reason); } else if(action == SPAMSERV_CHECK_PUNISH) { - MYSQL_RES *res; - MYSQL_ROW row; - loadChannelSettings(chanuser->chan); - printf_mysql_query("SELECT `%s` FROM `channels` WHERE `channel_id` = '%d'", reaction, chanuser->chan->channel_id); - res = mysql_use(); - row = mysql_fetch_row(res); - if(!row[0]) { - printf_mysql_query("SELECT `%s` FROM `channels` WHERE `channel_name` = 'defaults'", reaction); - res = mysql_use(); - row = mysql_fetch_row(res); - } int duration = 0; char banmaskBuf[NICKLEN+USERLEN+HOSTLEN+3]; char *banmask = NULL; - switch (atoi(row[0])) { + switch (atoi((row[0] ? row[0] : defaults[0]))) { case 2: //TIMEBAN: 3min duration = 180; case 3: //TIMEBAN: 1h -- 2.20.1