Separate notion of _FLOOD constant from the flags stored in the Flooding struct

This adds a FLOOD_FLAG() macro to convert a _FLOOD constant to the appropriate flag.  For now this just
casts the argument to unsigned int.

Rename Flooding.type to Flooding.flags and change it to unsigned int, to reflect that it's a bitfield of
flags for multiple flooding types.
This commit is contained in:
Kevin Easton
2017-01-18 17:03:06 +11:00
parent 78dbdea441
commit fef98f43ba
3 changed files with 6 additions and 4 deletions

View File

@@ -401,15 +401,15 @@ int BX_check_flooding(char *nick, int type, char *line, char *channel)
{
remove_oldest_flood_hashlist(&flood_list[0]);
tmp = add_name_to_floodlist(nick, FromUserHost, channel, flood_list, FLOOD_HASHSIZE);
tmp->type = type;
tmp->flags = FLOOD_FLAG(type);
tmp->cnt = 1;
get_time(&tmp->start);
tmp->flood = 0;
return 1;
}
if (!(tmp->type & type))
if (!(tmp->flags & FLOOD_FLAG(type)))
{
tmp->type |= type;
tmp->flags |= FLOOD_FLAG(type);
return 1;
}