diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2018-01-07 11:23:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-07 11:23:22 +0100 |
commit | e75ee2f74cd8b3de2f28e7b9b8e8b3da90f5c608 (patch) | |
tree | 37a3768f0da742a37f8fa458140ac7869f2a10bf /src/core | |
parent | c8012b2e574c6e1e25cf20ed31182323a492a98e (diff) | |
parent | 466d074200e4893f57c4c716c746e8549af65339 (diff) | |
download | irssi-e75ee2f74cd8b3de2f28e7b9b8e8b3da90f5c608.zip |
Merge pull request #746 from ailin-nemui/hide-lines
Add method to hide lines in a view
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/levels.c | 21 | ||||
-rw-r--r-- | src/core/levels.h | 4 |
2 files changed, 14 insertions, 11 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); diff --git a/src/core/levels.h b/src/core/levels.h index 9f7e588f..b0ebafba 100644 --- a/src/core/levels.h +++ b/src/core/levels.h @@ -36,7 +36,9 @@ enum { MSGLEVEL_NOHILIGHT = 0x1000000, /* Don't highlight this message */ MSGLEVEL_NO_ACT = 0x2000000, /* Don't trigger channel activity */ MSGLEVEL_NEVER = 0x4000000, /* never ignore / never log */ - MSGLEVEL_LASTLOG = 0x8000000 /* never ignore / never log */ + MSGLEVEL_LASTLOG = 0x8000000, /* used for /lastlog */ + + MSGLEVEL_HIDDEN = 0x10000000 /* Hidden from view */ }; int level_get(const char *level); |