summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorvague666 <jari.matilainen@gmail.com>2018-06-05 14:43:37 +0200
committervague666 <jari.matilainen@gmail.com>2018-06-05 15:29:40 +0200
commitdb3b671328d0e6890b17c23baf9d4280d086e89b (patch)
treec1687870246f4135d6f314c18d6136b3fc56b3fc /src/core
parentdaf6ce86cb668d24f278dca91846fc7b8619757d (diff)
downloadirssi-db3b671328d0e6890b17c23baf9d4280d086e89b.zip
Added HIDDEN level to ignores
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ignore.c17
-rw-r--r--src/core/ignore.h2
2 files changed, 16 insertions, 3 deletions
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);