From d84811b19230901698a89a5ec89f23d97fc2697b Mon Sep 17 00:00:00 2001 From: David Leadbeater Date: Sun, 29 Jun 2014 20:13:49 +0100 Subject: [PATCH] Don't expand ALL when combined with NEVER/NO_ACT --- src/core/levels.c | 20 +++++++++++++------- 1 file 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);