filter: add #defines for nick,user,host

This commit is contained in:
Ed Kellett 2018-08-10 15:04:32 +01:00
parent 11c11f30e7
commit 81e41406f4
No known key found for this signature in database
GPG key ID: CB9986DEF342FABC

View file

@ -43,6 +43,10 @@
#include <hs_common.h> #include <hs_common.h>
#include <hs_runtime.h> #include <hs_runtime.h>
#define FILTER_NICK 0
#define FILTER_USER 0
#define FILTER_HOST 0
static void filter_msg_user(void *data); static void filter_msg_user(void *data);
static void filter_msg_channel(void *data); static void filter_msg_channel(void *data);
static void on_client_exit(void *data); static void on_client_exit(void *data);
@ -307,7 +311,21 @@ filter_msg_user(void *data_)
strip_colour(text); strip_colour(text);
strip_unprintable(text); strip_unprintable(text);
snprintf(check_buffer, sizeof check_buffer, ":%s!%s@%s#%c %s 0 :%s", snprintf(check_buffer, sizeof check_buffer, ":%s!%s@%s#%c %s 0 :%s",
s->name, s->username, s->host, #if FILTER_NICK
s->name,
#else
"*",
#endif
#if FILTER_USER
s->username,
#else
"*",
#endif
#if FILTER_HOST
s->host,
#else
"*",
#endif
s->user && s->user->suser[0] != '\0' ? '1' : '0', s->user && s->user->suser[0] != '\0' ? '1' : '0',
cmdname[data->msgtype], cmdname[data->msgtype],
text); text);
@ -344,7 +362,21 @@ filter_msg_channel(void *data_)
strip_colour(text); strip_colour(text);
strip_unprintable(text); strip_unprintable(text);
snprintf(check_buffer, sizeof check_buffer, ":%s!%s@%s#%c %s %s :%s", snprintf(check_buffer, sizeof check_buffer, ":%s!%s@%s#%c %s %s :%s",
s->name, s->username, s->host, #if FILTER_NICK
s->name,
#else
"*",
#endif
#if FILTER_USER
s->username,
#else
"*",
#endif
#if FILTER_HOST
s->host,
#else
"*",
#endif
s->user && s->user->suser[0] != '\0' ? '1' : '0', s->user && s->user->suser[0] != '\0' ? '1' : '0',
cmdname[data->msgtype], cmdname[data->msgtype],
data->chptr->chname, data->chptr->chname,