diff options
author | David Leadbeater <dgl@dgl.cx> | 2014-06-29 20:13:49 +0100 |
---|---|---|
committer | David Leadbeater <dgl@dgl.cx> | 2014-06-30 00:31:59 +0100 |
commit | d84811b19230901698a89a5ec89f23d97fc2697b (patch) | |
tree | acca4ed51d8402367ccf67e41c6817f6a04f608a | |
parent | 819f9d16c9fbb014f6bd4ed88b57689347674727 (diff) | |
download | irssi-d84811b19230901698a89a5ec89f23d97fc2697b.zip |
Don't expand ALL when combined with NEVER/NO_ACT
-rw-r--r-- | src/core/levels.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/core/levels.c b/src/core/levels.c index b47079ba..7997ba98 100644 --- a/src/core/levels.c +++ b/src/core/levels.c @@ -136,19 +136,25 @@ char *bits2level(int bits) if (bits == 0) return g_strdup(""); - if (bits == MSGLEVEL_ALL) - return g_strdup("ALL"); str = g_string_new(NULL); - if (bits & MSGLEVEL_NEVER) + if (bits & MSGLEVEL_NEVER) { g_string_append(str, "NEVER "); + bits &= ~MSGLEVEL_NEVER; + } - if (bits & MSGLEVEL_NO_ACT) + if (bits & MSGLEVEL_NO_ACT) { g_string_append(str, "NO_ACT "); + bits &= ~MSGLEVEL_NO_ACT; + } - for (n = 0; levels[n] != NULL; n++) { - if (bits & (1L << n)) - g_string_append_printf(str, "%s ", levels[n]); + if (bits == MSGLEVEL_ALL) { + g_string_append(str, "ALL "); + } else { + for (n = 0; levels[n] != NULL; n++) { + if (bits & (1L << n)) + g_string_append_printf(str, "%s ", levels[n]); + } } if (str->len > 0) g_string_truncate(str, str->len-1); |