summaryrefslogtreecommitdiff
path: root/src/core/levels.c
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-09-08 15:19:40 +0200
committerailin-nemui <ailin-nemui@users.noreply.github.com>2017-09-21 14:20:31 +0200
commit8dfeca57ede1e726de07522a87203ce13676882d (patch)
tree47d7f3e78826c57f8ab9ec86a996e0257647c8f1 /src/core/levels.c
parentbe70fa5eb750ed337a55463c68d5a51b47d1efcd (diff)
downloadirssi-8dfeca57ede1e726de07522a87203ce13676882d.zip
hidden lines
Diffstat (limited to 'src/core/levels.c')
-rw-r--r--src/core/levels.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/core/levels.c b/src/core/levels.c
index e623c4de..eb7efcf7 100644
--- a/src/core/levels.c
+++ b/src/core/levels.c
@@ -21,6 +21,7 @@
#include "module.h"
#include "levels.h"
+/* the order of these levels must match the bits in levels.h */
static const char *levels[] = {
"CRAP",
"MSGS",
@@ -44,9 +45,6 @@ static const char *levels[] = {
"CLIENTCRAP",
"CLIENTERRORS",
"HILIGHTS",
-
- "NOHILIGHT",
- "NO_ACT",
NULL
};
@@ -63,6 +61,9 @@ int level_get(const char *level)
if (g_ascii_strcasecmp(level, "NO_ACT") == 0)
return MSGLEVEL_NO_ACT;
+ if (g_ascii_strcasecmp(level, "HIDDEN") == 0)
+ return MSGLEVEL_HIDDEN;
+
len = strlen(level);
if (len == 0) return 0;
@@ -138,17 +139,13 @@ char *bits2level(int bits)
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;
- }
- if (bits == MSGLEVEL_ALL) {
+ if ((bits & MSGLEVEL_ALL) == MSGLEVEL_ALL) {
g_string_append(str, "ALL ");
} else {
for (n = 0; levels[n] != NULL; n++) {
@@ -156,6 +153,10 @@ char *bits2level(int bits)
g_string_append_printf(str, "%s ", levels[n]);
}
}
+
+ if (bits & MSGLEVEL_HIDDEN)
+ g_string_append(str, "HIDDEN ");
+
if (str->len > 0)
g_string_truncate(str, str->len-1);