Switch *_FLOOD constants to sequential rather than bits and add flood type lookup table

Using sequential constants for *_FLOOD constants means that we can use a simple lookup table to convert them
into text for display and IGNORE_* constants.
This commit is contained in:
Kevin Easton
2017-01-21 14:17:42 +11:00
parent 81ddf52909
commit 69296c2c5a
2 changed files with 39 additions and 48 deletions

View File

@@ -8,22 +8,22 @@
#define __flood_h_
enum flood_type {
MSG_FLOOD = 0x0001,
PUBLIC_FLOOD = 0x0002,
NOTICE_FLOOD = 0x0004,
WALL_FLOOD = 0x0008,
WALLOP_FLOOD = 0x0010,
CTCP_FLOOD = 0x0020,
INVITE_FLOOD = 0x0040,
CDCC_FLOOD = 0x0080,
CTCP_ACTION_FLOOD = 0x0100,
NICK_FLOOD = 0x0200,
DEOP_FLOOD = 0x0400,
KICK_FLOOD = 0x0800,
JOIN_FLOOD = 0x1000
MSG_FLOOD,
PUBLIC_FLOOD,
NOTICE_FLOOD,
WALL_FLOOD,
WALLOP_FLOOD,
CTCP_FLOOD,
INVITE_FLOOD,
CDCC_FLOOD,
CTCP_ACTION_FLOOD,
NICK_FLOOD,
DEOP_FLOOD,
KICK_FLOOD,
JOIN_FLOOD
};
#define FLOOD_FLAG(t) ((unsigned)(t))
#define FLOOD_FLAG(t) (1U << (t))
int BX_check_flooding(char *nick, enum flood_type type, char *line, char *channel);
int BX_is_other_flood(ChannelList *channel, NickList *nick, enum flood_type type, int *t_flood);