mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-02 23:43:13 +02:00
Add the ability to SPAMFILTER message-tags.
The new target type is called 'T' and we match against "name=value" of each message tag (or just "name" if it is without value). Example: SPAMFILTER ADD -simple T kill 0 this_is_a_test +typing=active (No this is not a suggestion :D) This probably won't be used much at all, but it is good to have the option available in case there is some massive problem, especially since more message tags may pop up sooner or later. Caveat: this is actually a bit slow as we may have to check multiple message tags for a single line. If there are zero message-tag spamfilters then we will automatically short-circuit and save all this CPU, which will be the most common case.
This commit is contained in:
@@ -67,7 +67,8 @@ void (*tkl_stats)(Client *client, int type, char *para, int *cnt);
|
||||
void (*tkl_sync)(Client *client);
|
||||
void (*cmd_tkl)(Client *client, MessageTag *mtags, int parc, char *parv[]);
|
||||
int (*place_host_ban)(Client *client, BanAction action, char *reason, long duration);
|
||||
int (*match_spamfilter)(Client *client, char *str_in, int type, char *target, int flags, TKL **rettk);
|
||||
int (*match_spamfilter)(Client *client, char *str_in, int type, char *cmd, char *target, int flags, TKL **rettk);
|
||||
int (*match_spamfilter_mtags)(Client *client, MessageTag *mtags, char *cmd);
|
||||
int (*join_viruschan)(Client *client, TKL *tk, int type);
|
||||
unsigned char *(*StripColors)(unsigned char *text);
|
||||
const char *(*StripControlCodes)(unsigned char *text);
|
||||
@@ -307,6 +308,7 @@ void efunctions_init(void)
|
||||
efunc_init_function(EFUNC_CMD_TKL, cmd_tkl, NULL);
|
||||
efunc_init_function(EFUNC_PLACE_HOST_BAN, place_host_ban, NULL);
|
||||
efunc_init_function(EFUNC_DOSPAMFILTER, match_spamfilter, NULL);
|
||||
efunc_init_function(EFUNC_MATCH_SPAMFILTER_MTAGS, match_spamfilter_mtags, NULL);
|
||||
efunc_init_function(EFUNC_DOSPAMFILTER_VIRUSCHAN, join_viruschan, NULL);
|
||||
efunc_init_function(EFUNC_STRIPCOLORS, StripColors, NULL);
|
||||
efunc_init_function(EFUNC_STRIPCONTROLCODES, StripControlCodes, NULL);
|
||||
|
||||
Reference in New Issue
Block a user