Introduce an enum flood_type for the *_FLOOD constants
This allows the debugger to show the decoded constant name.
This commit is contained in:
@@ -7,27 +7,29 @@
|
|||||||
#ifndef __flood_h_
|
#ifndef __flood_h_
|
||||||
#define __flood_h_
|
#define __flood_h_
|
||||||
|
|
||||||
int BX_check_flooding(char *, int, char *, char *);
|
enum flood_type {
|
||||||
int BX_is_other_flood(ChannelList *, NickList *, int, int *);
|
MSG_FLOOD = 0x0001,
|
||||||
int BX_flood_prot(char *nick, char *userhost, int flood_type, int ignoretime, char *channel);
|
PUBLIC_FLOOD = 0x0002,
|
||||||
void clean_flood_list(void);
|
NOTICE_FLOOD = 0x0004,
|
||||||
|
WALL_FLOOD = 0x0008,
|
||||||
#define MSG_FLOOD 0x0001
|
WALLOP_FLOOD = 0x0010,
|
||||||
#define PUBLIC_FLOOD 0x0002
|
CTCP_FLOOD = 0x0020,
|
||||||
#define NOTICE_FLOOD 0x0004
|
INVITE_FLOOD = 0x0040,
|
||||||
#define WALL_FLOOD 0x0008
|
CDCC_FLOOD = 0x0080,
|
||||||
#define WALLOP_FLOOD 0x0010
|
CTCP_ACTION_FLOOD = 0x0100,
|
||||||
#define CTCP_FLOOD 0x0020
|
NICK_FLOOD = 0x0200,
|
||||||
#define INVITE_FLOOD 0x0040
|
DEOP_FLOOD = 0x0400,
|
||||||
#define CDCC_FLOOD 0x0080
|
KICK_FLOOD = 0x0800,
|
||||||
#define CTCP_ACTION_FLOOD 0x0100
|
JOIN_FLOOD = 0x1000
|
||||||
#define NICK_FLOOD 0x0200
|
};
|
||||||
#define DEOP_FLOOD 0x0400
|
|
||||||
#define KICK_FLOOD 0x0800
|
|
||||||
#define JOIN_FLOOD 0x1000
|
|
||||||
|
|
||||||
#define FLOOD_FLAG(t) ((unsigned)(t))
|
#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"
|
#include "hash.h"
|
||||||
#define FLOOD_HASHSIZE 31
|
#define FLOOD_HASHSIZE 31
|
||||||
extern HashEntry no_flood_list[FLOOD_HASHSIZE];
|
extern HashEntry no_flood_list[FLOOD_HASHSIZE];
|
||||||
|
|||||||
@@ -594,9 +594,9 @@ extern Function_ptr *global;
|
|||||||
|
|
||||||
|
|
||||||
/* flood.c */
|
/* flood.c */
|
||||||
#define is_other_flood (*(int (*)(ChannelList *, NickList *, int, int *))global[IS_OTHER_FLOOD])
|
#define is_other_flood (*(int (*)(ChannelList *, NickList *, enum flood_type, int *))global[IS_OTHER_FLOOD])
|
||||||
#define check_flooding (*(int (*)(char *, int , char *, char *))global[CHECK_FLOODING])
|
#define check_flooding (*(int (*)(char *, enum flood_type, char *, char *))global[CHECK_FLOODING])
|
||||||
#define flood_prot (*(int (*)(char *, char *, int , int , char *))global[FLOOD_PROT])
|
#define flood_prot (*(int (*)(char *, char *, enum flood_type, int, char *))global[FLOOD_PROT])
|
||||||
|
|
||||||
/* expr.c */
|
/* expr.c */
|
||||||
#define next_unit (*(char *(*)(char *, const char *, int *, int ))global[NEXT_UNIT])
|
#define next_unit (*(char *(*)(char *, const char *, int *, int ))global[NEXT_UNIT])
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ int get_flood_count(int type, ChannelList * channel)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void get_flood_val(ChannelList *chan, int type, int *flood_count, int *flood_rate)
|
static void get_flood_val(ChannelList *chan, enum flood_type type, int *flood_count, int *flood_rate)
|
||||||
{
|
{
|
||||||
*flood_count = get_int_var(FLOOD_AFTER_VAR);
|
*flood_count = get_int_var(FLOOD_AFTER_VAR);
|
||||||
*flood_rate = get_int_var(FLOOD_RATE_VAR);
|
*flood_rate = get_int_var(FLOOD_RATE_VAR);
|
||||||
@@ -212,7 +212,7 @@ void get_flood_val(ChannelList *chan, int type, int *flood_count, int *flood_rat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_flood(int type, time_t flood_time, int reset, NickList *tmpnick)
|
static int set_flood(enum flood_type type, time_t flood_time, int reset, NickList *tmpnick)
|
||||||
{
|
{
|
||||||
if (!tmpnick)
|
if (!tmpnick)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -259,7 +259,7 @@ int set_flood(int type, time_t flood_time, int reset, NickList *tmpnick)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BX_is_other_flood(ChannelList *channel, NickList *tmpnick, int type, int *t_flood)
|
int BX_is_other_flood(ChannelList *channel, NickList *tmpnick, enum flood_type type, int *t_flood)
|
||||||
{
|
{
|
||||||
time_t diff = 0, flood_time = 0;
|
time_t diff = 0, flood_time = 0;
|
||||||
int doit = 0;
|
int doit = 0;
|
||||||
@@ -387,7 +387,7 @@ static int remove_oldest_flood_hashlist(HashEntry *list)
|
|||||||
* FLOOD is activated.
|
* FLOOD is activated.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int BX_check_flooding(char *nick, int type, char *line, char *channel)
|
int BX_check_flooding(char *nick, enum flood_type type, char *line, char *channel)
|
||||||
{
|
{
|
||||||
Flooding *tmp;
|
Flooding *tmp;
|
||||||
int flood_rate;
|
int flood_rate;
|
||||||
@@ -462,7 +462,7 @@ int BX_check_flooding(char *nick, int type, char *line, char *channel)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_ctcp_ban_flood(char *channel, char *nick)
|
static void check_ctcp_ban_flood(char *channel, char *nick)
|
||||||
{
|
{
|
||||||
NickList *Nick = NULL;
|
NickList *Nick = NULL;
|
||||||
ChannelList *chan = NULL;
|
ChannelList *chan = NULL;
|
||||||
@@ -487,7 +487,7 @@ ChannelList *chan = NULL;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int BX_flood_prot(char *nick, char *userhost, int flood_type, int ignoretime, char *channel)
|
int BX_flood_prot(char *nick, char *userhost, enum flood_type flood_type, int ignoretime, char *channel)
|
||||||
{
|
{
|
||||||
ChannelList *chan;
|
ChannelList *chan;
|
||||||
NickList *Nick;
|
NickList *Nick;
|
||||||
|
|||||||
Reference in New Issue
Block a user