diff --git a/include/flood.h b/include/flood.h index 85821cd..09ef129 100644 --- a/include/flood.h +++ b/include/flood.h @@ -7,10 +7,10 @@ #ifndef __flood_h_ #define __flood_h_ - int BX_check_flooding (char *, int, char *, char *); - int BX_is_other_flood (ChannelList *, NickList *, int, int *); - int BX_flood_prot (char *, char *, char *, int, int, char *); - void clean_flood_list (void); +int BX_check_flooding(char *, int, char *, char *); +int BX_is_other_flood(ChannelList *, NickList *, int, int *); +int BX_flood_prot(char *nick, char *userhost, int flood_type, int ignoretime, char *channel); +void clean_flood_list(void); #define MSG_FLOOD 0x0001 #define PUBLIC_FLOOD 0x0002 diff --git a/include/modval.h b/include/modval.h index 86bc82d..8444995 100644 --- a/include/modval.h +++ b/include/modval.h @@ -596,7 +596,7 @@ extern Function_ptr *global; /* flood.c */ #define is_other_flood (*(int (*)(ChannelList *, NickList *, int, int *))global[IS_OTHER_FLOOD]) #define check_flooding (*(int (*)(char *, int , char *, char *))global[CHECK_FLOODING]) -#define flood_prot (*(int (*)(char *, char *, char *, int , int , char *))global[FLOOD_PROT]) +#define flood_prot (*(int (*)(char *, char *, int , int , char *))global[FLOOD_PROT]) /* expr.c */ #define next_unit (*(char *(*)(char *, const char *, int *, int ))global[NEXT_UNIT]) diff --git a/source/flood.c b/source/flood.c index b8470df..7c0b86b 100644 --- a/source/flood.c +++ b/source/flood.c @@ -64,7 +64,7 @@ extern int from_server; #define NO_RESET 0 #define RESET 1 -char *get_flood_types(unsigned int type) +static char *get_flood_types(unsigned int type) { int x = 0; while (type) @@ -440,13 +440,11 @@ int BX_check_flooding(char *nick, int type, char *line, char *channel) case NOTICE_FLOOD: case CDCC_FLOOD: case CTCP_FLOOD: - if (flood_prot(nick, FromUserHost, get_flood_types(type), type, get_int_var(IGNORE_TIME_VAR), channel)) + case CTCP_ACTION_FLOOD: + if (flood_prot(nick, FromUserHost, type, get_int_var(IGNORE_TIME_VAR), channel)) return 0; break; - case CTCP_ACTION_FLOOD: - if (flood_prot(nick, FromUserHost, get_flood_types(CTCP_FLOOD), type, get_int_var(IGNORE_TIME_VAR), channel)) - return 0; - default: + default: /* INVITE_FLOOD and WALLOP_FLOOD - not clear if this is intentional */ break; } if (get_int_var(FLOOD_WARNING_VAR)) @@ -489,22 +487,23 @@ ChannelList *chan = NULL; } } -int BX_flood_prot (char *nick, char *userhost, char *type, int ctcp_type, int ignoretime, char *channel) +int BX_flood_prot(char *nick, char *userhost, int flood_type, int ignoretime, char *channel) { -ChannelList *chan; -NickList *Nick; -char tmp[BIG_BUFFER_SIZE+1]; -char *uh; -int old_window_display; -int kick_on_flood = 1; + ChannelList *chan; + NickList *Nick; + char tmp[BIG_BUFFER_SIZE+1]; + char *uh; + int old_window_display; + int kick_on_flood = 1; + char *type = get_flood_types(flood_type); - if ((ctcp_type == CDCC_FLOOD || ctcp_type == CTCP_FLOOD || ctcp_type == CTCP_ACTION_FLOOD) && !get_int_var(CTCP_FLOOD_PROTECTION_VAR)) + if ((flood_type == CDCC_FLOOD || flood_type == CTCP_FLOOD || flood_type == CTCP_ACTION_FLOOD) && !get_int_var(CTCP_FLOOD_PROTECTION_VAR)) return 0; else if (!get_int_var(FLOOD_PROTECTION_VAR)) return 0; else if (!my_stricmp(nick, get_server_nickname(from_server))) return 0; - switch (ctcp_type) + switch (flood_type) { case WALL_FLOOD: case MSG_FLOOD: @@ -549,7 +548,7 @@ int kick_on_flood = 1; snprintf(tmp, sizeof tmp, "*!*%s", uh); old_window_display = window_display; window_display = 0; - ignore_nickname(tmp, ignore_type(type, strlen(type)), 0); + ignore_nickname(tmp, flood_type == CTCP_ACTION_FLOOD ? IGNORE_CTCPS : ignore_type(type, strlen(type)), 0); window_display = old_window_display; snprintf(tmp, sizeof tmp, "%d ^IGNORE *!*%s NONE", ignoretime, uh); timercmd("TIMER", tmp, NULL, NULL); diff --git a/source/parse.c b/source/parse.c index f960402..5d5a48f 100644 --- a/source/parse.c +++ b/source/parse.c @@ -607,7 +607,7 @@ static void p_privmsg(char *from, char **Args) if (is_other_flood(channel, tmpnick, PUBLIC_FLOOD, &blah)) { no_flood = 0; - flood_prot(tmpnick->nick, FromUserHost, "PUBLIC", flood_type, get_cset_int_var(channel->csets, PUBFLOOD_IGNORE_TIME_CSET), channel->channel); + flood_prot(tmpnick->nick, FromUserHost, flood_type, get_cset_int_var(channel->csets, PUBFLOOD_IGNORE_TIME_CSET), channel->channel); } } else