summaryrefslogtreecommitdiff
path: root/src/fe-common/core/fe-ignore.c
diff options
context:
space:
mode:
authorDavid Leadbeater <dgl@dgl.cx>2014-06-29 22:07:33 +0100
committerDavid Leadbeater <dgl@dgl.cx>2014-06-30 00:31:53 +0100
commit819f9d16c9fbb014f6bd4ed88b57689347674727 (patch)
treef3965125a401ceaaf9631d68660dfbb91e9be5ac /src/fe-common/core/fe-ignore.c
parent2b6bba3fd2019158990f13d9e8913fd3bbb20b61 (diff)
downloadirssi-819f9d16c9fbb014f6bd4ed88b57689347674727.zip
Change NO_ACT so it can be used in addition to other ignores
This results in a more flexible system and is less surprising as it means levels can be used in the way they normally can in an ignore. As an example the current approach to NO_ACT provides no way to let HILIGHTS be shown, with this change /set activity_hide_targets can be recreated with: /ignore #channel NO_ACT /ignore #channel -except -regexp -pattern . NO_ACT HILIGHTS (but obviously this can be configured in many more ways if desired).
Diffstat (limited to 'src/fe-common/core/fe-ignore.c')
-rw-r--r--src/fe-common/core/fe-ignore.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/fe-common/core/fe-ignore.c b/src/fe-common/core/fe-ignore.c
index 7c23ad94..3b57f5f3 100644
--- a/src/fe-common/core/fe-ignore.c
+++ b/src/fe-common/core/fe-ignore.c
@@ -118,7 +118,7 @@ static void cmd_ignore(const char *data)
char *patternarg, *chanarg, *mask, *levels, *timestr, *servertag;
char **channels;
void *free_arg;
- int new_ignore, msecs;
+ int new_ignore, msecs, level;
if (*data == '\0') {
cmd_ignore_show();
@@ -138,6 +138,7 @@ static void cmd_ignore(const char *data)
if (*mask == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
if (*levels == '\0') levels = "ALL";
+ level = level2bits(levels, NULL);
msecs = 0;
timestr = g_hash_table_lookup(optlist, "time");
@@ -154,7 +155,8 @@ static void cmd_ignore(const char *data)
channels = (chanarg == NULL || *chanarg == '\0') ? NULL :
g_strsplit(chanarg, ",", -1);
- rec = patternarg != NULL ? NULL: ignore_find(servertag, mask, channels);
+ rec = patternarg != NULL ? NULL: ignore_find_noact(servertag, mask, channels,
+ (level & MSGLEVEL_NO_ACT));
new_ignore = rec == NULL;
if (rec == NULL) {
@@ -170,6 +172,12 @@ static void cmd_ignore(const char *data)
rec->level = combine_level(rec->level, levels);
+ if (rec->level == MSGLEVEL_NO_ACT) {
+ /* If only NO_ACT was specified add all levels; it makes no
+ * sense on its own. */
+ rec->level |= MSGLEVEL_ALL;
+ }
+
if (new_ignore && rec->level == 0) {
/* tried to unignore levels from nonexisting ignore */
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
@@ -226,7 +234,10 @@ static void cmd_unignore(const char *data)
chans[0] = mask;
mask = NULL;
}
- rec = ignore_find("*", mask, (char **) chans);
+ rec = ignore_find_noact("*", mask, (char **) chans, 0);
+ if (rec == NULL) {
+ rec = ignore_find_noact("*", mask, (char **) chans, 1);
+ }
}
if (rec != NULL) {