Introduce an enum flood_type for the *_FLOOD constants

This allows the debugger to show the decoded constant name.
This commit is contained in:
Kevin Easton
2017-01-19 17:10:32 +11:00
parent fef98f43ba
commit 81ddf52909
3 changed files with 29 additions and 27 deletions

View File

@@ -7,27 +7,29 @@
#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 *nick, char *userhost, int flood_type, int ignoretime, char *channel);
void clean_flood_list(void);
#define MSG_FLOOD 0x0001
#define PUBLIC_FLOOD 0x0002
#define NOTICE_FLOOD 0x0004
#define WALL_FLOOD 0x0008
#define WALLOP_FLOOD 0x0010
#define CTCP_FLOOD 0x0020
#define INVITE_FLOOD 0x0040
#define CDCC_FLOOD 0x0080
#define CTCP_ACTION_FLOOD 0x0100
#define NICK_FLOOD 0x0200
#define DEOP_FLOOD 0x0400
#define KICK_FLOOD 0x0800
#define JOIN_FLOOD 0x1000
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
};
#define FLOOD_FLAG(t) ((unsigned)(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);
int BX_flood_prot(char *nick, char *userhost, enum flood_type flood_type, int ignoretime, char *channel);
void clean_flood_list(void);
#include "hash.h"
#define FLOOD_HASHSIZE 31
extern HashEntry no_flood_list[FLOOD_HASHSIZE];

View File

@@ -594,9 +594,9 @@ 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 *, int , int , char *))global[FLOOD_PROT])
#define is_other_flood (*(int (*)(ChannelList *, NickList *, enum flood_type, int *))global[IS_OTHER_FLOOD])
#define check_flooding (*(int (*)(char *, enum flood_type, char *, char *))global[CHECK_FLOODING])
#define flood_prot (*(int (*)(char *, char *, enum flood_type, int, char *))global[FLOOD_PROT])
/* expr.c */
#define next_unit (*(char *(*)(char *, const char *, int *, int ))global[NEXT_UNIT])