From db3b671328d0e6890b17c23baf9d4280d086e89b Mon Sep 17 00:00:00 2001 From: vague666 Date: Tue, 5 Jun 2018 14:43:37 +0200 Subject: Added HIDDEN level to ignores --- src/core/ignore.c | 17 ++++++++++++++--- src/core/ignore.h | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/ignore.c b/src/core/ignore.c index cec91e6b..8aece6fc 100644 --- a/src/core/ignore.c +++ b/src/core/ignore.c @@ -82,9 +82,9 @@ static int ignore_match_pattern(IGNORE_REC *rec, const char *text) * However we also want to allow NO_ACT combined with levels, so mask it out and * match levels if set. */ #define ignore_match_level(rec, level) \ - (((level & MSGLEVEL_NO_ACT) != 0) ? \ - ((~MSGLEVEL_NO_ACT & level) & (rec)->level) != 0 : \ - ((rec)->level & MSGLEVEL_NO_ACT ? 0 : \ + (((level & (MSGLEVEL_NO_ACT|MSGLEVEL_HIDDEN)) != 0) ? \ + ((~(MSGLEVEL_NO_ACT|MSGLEVEL_HIDDEN) & level) & (rec)->level) != 0 : \ + ((rec)->level & (MSGLEVEL_NO_ACT|MSGLEVEL_HIDDEN) ? 0 : \ (level & (rec)->level) != 0)) #define ignore_match_nickmask(rec, nick, nickmask) \ @@ -212,6 +212,12 @@ IGNORE_REC *ignore_find_full(const char *servertag, const char *mask, const char if (!(flags & IGNORE_FIND_NOACT) && (rec->level & MSGLEVEL_NO_ACT) != 0) continue; + if ((flags & IGNORE_FIND_HIDDEN) && (rec->level & MSGLEVEL_HIDDEN) == 0) + continue; + + if (!(flags & IGNORE_FIND_HIDDEN) && (rec->level & MSGLEVEL_HIDDEN) != 0) + continue; + if ((rec->mask == NULL && mask != NULL) || (rec->mask != NULL && mask == NULL)) continue; @@ -264,6 +270,11 @@ IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask, char **ch return ignore_find_full(servertag, mask, NULL, channels, IGNORE_FIND_NOACT); } +IGNORE_REC *ignore_find_hidden(const char *servertag, const char *mask, char **channels, int hidden) +{ + return ignore_find_full(servertag, mask, NULL, channels, IGNORE_FIND_HIDDEN); +} + static void ignore_set_config(IGNORE_REC *rec) { CONFIG_NODE *node; diff --git a/src/core/ignore.h b/src/core/ignore.h index 31171b58..439927ed 100644 --- a/src/core/ignore.h +++ b/src/core/ignore.h @@ -29,6 +29,7 @@ int ignore_check(SERVER_REC *server, const char *nick, const char *host, enum { IGNORE_FIND_PATTERN = 0x01, /* Match the pattern */ IGNORE_FIND_NOACT = 0x02, /* Exclude the targets with NOACT level */ + IGNORE_FIND_HIDDEN = 0x03, /* Exclude the targets with HIDDEN level */ }; IGNORE_REC *ignore_find_full (const char *servertag, const char *mask, const char *pattern, @@ -38,6 +39,7 @@ IGNORE_REC *ignore_find_full (const char *servertag, const char *mask, const cha IGNORE_REC *ignore_find(const char *servertag, const char *mask, char **channels); IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask, char **channels, int noact); +IGNORE_REC *ignore_find_hidden(const char *servertag, const char *mask, char **channels, int hidden); void ignore_add_rec(IGNORE_REC *rec); void ignore_update_rec(IGNORE_REC *rec); -- cgit v1.2.3 From ac3af3fb56d98b884d03646e3c15435c8a435bf3 Mon Sep 17 00:00:00 2001 From: vague666 Date: Wed, 6 Jun 2018 10:00:38 +0200 Subject: these were bitflags --- src/core/ignore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/ignore.h b/src/core/ignore.h index 439927ed..958aa801 100644 --- a/src/core/ignore.h +++ b/src/core/ignore.h @@ -29,7 +29,7 @@ int ignore_check(SERVER_REC *server, const char *nick, const char *host, enum { IGNORE_FIND_PATTERN = 0x01, /* Match the pattern */ IGNORE_FIND_NOACT = 0x02, /* Exclude the targets with NOACT level */ - IGNORE_FIND_HIDDEN = 0x03, /* Exclude the targets with HIDDEN level */ + IGNORE_FIND_HIDDEN = 0x04, /* Exclude the targets with HIDDEN level */ }; IGNORE_REC *ignore_find_full (const char *servertag, const char *mask, const char *pattern, -- cgit v1.2.3 From d2e1caf7205220c9fd73861604de8248eb07f0d6 Mon Sep 17 00:00:00 2001 From: vague666 Date: Thu, 7 Jun 2018 15:17:46 +0200 Subject: simplifying code --- src/core/ignore.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/core') diff --git a/src/core/ignore.c b/src/core/ignore.c index 8aece6fc..574ecb5d 100644 --- a/src/core/ignore.c +++ b/src/core/ignore.c @@ -81,10 +81,11 @@ static int ignore_match_pattern(IGNORE_REC *rec, const char *text) * used as a flag to indicate it should only look at ignore items with NO_ACT. * However we also want to allow NO_ACT combined with levels, so mask it out and * match levels if set. */ +#define FLAG_MSGLEVELS ( MSGLEVEL_NO_ACT | MSGLEVEL_HIDDEN ) #define ignore_match_level(rec, level) \ - (((level & (MSGLEVEL_NO_ACT|MSGLEVEL_HIDDEN)) != 0) ? \ - ((~(MSGLEVEL_NO_ACT|MSGLEVEL_HIDDEN) & level) & (rec)->level) != 0 : \ - ((rec)->level & (MSGLEVEL_NO_ACT|MSGLEVEL_HIDDEN) ? 0 : \ + (((level & FLAG_MSGLEVELS)!= 0) ? \ + ((~FLAG_MSGLEVELS & level) & (rec)->level) != 0 : \ + ((rec)->level & FLAG_MSGLEVELS ? 0 : \ (level & (rec)->level) != 0)) #define ignore_match_nickmask(rec, nick, nickmask) \ -- cgit v1.2.3 From ba2554dd1485259b95b4b37f281c989086b24739 Mon Sep 17 00:00:00 2001 From: vague666 Date: Sat, 9 Jun 2018 05:55:25 +0200 Subject: missing space --- src/core/ignore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/ignore.c b/src/core/ignore.c index 574ecb5d..8745c434 100644 --- a/src/core/ignore.c +++ b/src/core/ignore.c @@ -83,7 +83,7 @@ static int ignore_match_pattern(IGNORE_REC *rec, const char *text) * match levels if set. */ #define FLAG_MSGLEVELS ( MSGLEVEL_NO_ACT | MSGLEVEL_HIDDEN ) #define ignore_match_level(rec, level) \ - (((level & FLAG_MSGLEVELS)!= 0) ? \ + (((level & FLAG_MSGLEVELS) != 0) ? \ ((~FLAG_MSGLEVELS & level) & (rec)->level) != 0 : \ ((rec)->level & FLAG_MSGLEVELS ? 0 : \ (level & (rec)->level) != 0)) -- cgit v1.2.3