diff options
author | vague666 <jari.matilainen@gmail.com> | 2018-06-05 14:43:37 +0200 |
---|---|---|
committer | vague666 <jari.matilainen@gmail.com> | 2018-06-05 15:29:40 +0200 |
commit | db3b671328d0e6890b17c23baf9d4280d086e89b (patch) | |
tree | c1687870246f4135d6f314c18d6136b3fc56b3fc /src/fe-common | |
parent | daf6ce86cb668d24f278dca91846fc7b8619757d (diff) | |
download | irssi-db3b671328d0e6890b17c23baf9d4280d086e89b.zip |
Added HIDDEN level to ignores
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/core/fe-ignore.c | 9 | ||||
-rw-r--r-- | src/fe-common/core/fe-messages.c | 27 | ||||
-rw-r--r-- | src/fe-common/core/window-activity.c | 2 | ||||
-rw-r--r-- | src/fe-common/irc/dcc/fe-dcc-chat-messages.c | 12 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-messages.c | 9 |
5 files changed, 57 insertions, 2 deletions
diff --git a/src/fe-common/core/fe-ignore.c b/src/fe-common/core/fe-ignore.c index 03fd4dd2..88dc48f7 100644 --- a/src/fe-common/core/fe-ignore.c +++ b/src/fe-common/core/fe-ignore.c @@ -157,7 +157,8 @@ static void cmd_ignore(const char *data) g_strsplit(chanarg, ",", -1); rec = ignore_find_full(servertag, mask, patternarg, channels, - IGNORE_FIND_PATTERN | ((level & MSGLEVEL_NO_ACT) ? IGNORE_FIND_NOACT : 0)); + IGNORE_FIND_PATTERN | ((level & MSGLEVEL_NO_ACT) ? IGNORE_FIND_NOACT : 0) | + ((level & MSGLEVEL_HIDDEN) ? IGNORE_FIND_HIDDEN : 0)); new_ignore = rec == NULL; if (rec == NULL) { @@ -179,6 +180,12 @@ static void cmd_ignore(const char *data) rec->level |= MSGLEVEL_ALL; } + if (rec->level == MSGLEVEL_HIDDEN) { + /* If only HIDDEN 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, diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c index 487a5754..05c64d70 100644 --- a/src/fe-common/core/fe-messages.c +++ b/src/fe-common/core/fe-messages.c @@ -204,6 +204,9 @@ static void sig_message_public(SERVER_REC *server, const char *msg, if (ignore_check(server, nick, address, target, msg, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(server, nick, address, target, msg, level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + if (settings_get_bool("emphasis")) msg = freemsg = expand_emphasis((WI_ITEM_REC *) chanrec, msg); @@ -263,6 +266,9 @@ static void sig_message_private(SERVER_REC *server, const char *msg, if (ignore_check(server, nick, address, NULL, msg, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(server, nick, address, NULL, msg, level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + if (own) { printformat(server, target, level, query == NULL ? TXT_OWN_MSG_PRIVATE : @@ -358,6 +364,9 @@ static void sig_message_join(SERVER_REC *server, const char *channel, if (ignore_check(server, nick, address, channel, NULL, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(server, nick, address, channel, NULL, level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + printformat(server, channel, level, TXT_JOIN, nick, address, channel); } @@ -371,6 +380,9 @@ static void sig_message_part(SERVER_REC *server, const char *channel, if (ignore_check(server, nick, address, channel, NULL, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(server, nick, address, channel, NULL, level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + printformat(server, channel, level, TXT_PART, nick, address, channel, reason); } @@ -390,6 +402,9 @@ static void sig_message_quit(SERVER_REC *server, const char *nick, if (ignore_check(server, nick, address, NULL, reason, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(server, nick, address, NULL, reason, level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + print_channel = NULL; once = settings_get_bool("show_quit_once"); @@ -412,6 +427,9 @@ static void sig_message_quit(SERVER_REC *server, const char *nick, if (ignore_check(server, nick, address, rec->visible_name, reason, MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(server, nick, address, rec->visible_name, reason, MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + if (print_channel == NULL || active_win->active == (WI_ITEM_REC *) rec) print_channel = rec->visible_name; @@ -461,6 +479,9 @@ static void sig_message_kick(SERVER_REC *server, const char *channel, if (ignore_check(server, kicker, address, channel, reason, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(server, kicker, address, channel, reason, level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + printformat(server, channel, level, TXT_KICK, nick, channel, kicker, reason, address); } @@ -482,6 +503,9 @@ static void print_nick_change_channel(SERVER_REC *server, const char *channel, if (!(level & MSGLEVEL_NO_ACT) && ignore_check(server, oldnick, address, channel, newnick, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (!(level & MSGLEVEL_HIDDEN) && ignore_check(server, oldnick, address, channel, newnick, level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + printformat(server, channel, level, ownnick ? TXT_YOUR_NICK_CHANGED : TXT_NICK_CHANGED, oldnick, newnick, channel, address); @@ -561,6 +585,9 @@ static void sig_message_topic(SERVER_REC *server, const char *channel, if (ignore_check(server, nick, address, channel, topic, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(server, nick, address, channel, topic, level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + printformat(server, channel, level, *topic != '\0' ? TXT_NEW_TOPIC : TXT_TOPIC_UNSET, nick, channel, topic, address); diff --git a/src/fe-common/core/window-activity.c b/src/fe-common/core/window-activity.c index 3be30ae7..89493aea 100644 --- a/src/fe-common/core/window-activity.c +++ b/src/fe-common/core/window-activity.c @@ -125,7 +125,7 @@ static void read_settings(void) hide_targets = *targets == '\0' ? NULL : g_strsplit(targets, " ", -1); - hide_level = MSGLEVEL_NEVER | MSGLEVEL_NO_ACT | + hide_level = MSGLEVEL_NEVER | MSGLEVEL_NO_ACT | MSGLEVEL_HIDDEN | settings_get_level("activity_hide_level"); msg_level = settings_get_level("activity_msg_level"); hilight_level = MSGLEVEL_HILIGHT | diff --git a/src/fe-common/irc/dcc/fe-dcc-chat-messages.c b/src/fe-common/irc/dcc/fe-dcc-chat-messages.c index 45791f56..3a45a36b 100644 --- a/src/fe-common/irc/dcc/fe-dcc-chat-messages.c +++ b/src/fe-common/irc/dcc/fe-dcc-chat-messages.c @@ -96,6 +96,10 @@ static void sig_message_dcc(CHAT_DCC_REC *dcc, const char *msg) level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(SERVER(dcc->server), tag, dcc->addrstr, NULL, msg, + level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + format_create_dest_tag(&dest, dcc->server, dcc->servertag, tag, level, NULL); @@ -118,6 +122,10 @@ static void sig_message_dcc_action(CHAT_DCC_REC *dcc, const char *msg) level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(SERVER(dcc->server), tag, dcc->addrstr, NULL, msg, + level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + format_create_dest_tag(&dest, dcc->server, dcc->servertag, tag, level, NULL); @@ -139,6 +147,10 @@ static void sig_message_dcc_ctcp(CHAT_DCC_REC *dcc, const char *cmd, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(SERVER(dcc->server), tag, dcc->addrstr, NULL, cmd, + level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + format_create_dest_tag(&dest, dcc->server, dcc->servertag, tag, level, NULL); diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index 40ca306d..e8558a17 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -162,6 +162,10 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(SERVER(server), nick, address, target, msg, + level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + if (server_ischannel(SERVER(server), target)) { item = irc_channel_find(server, target); } else { @@ -241,6 +245,11 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg, msg, level | MSGLEVEL_NO_ACT)) level |= MSGLEVEL_NO_ACT; + if (ignore_check(server, nick, address, + server_ischannel(SERVER(server), target) ? target : NULL, + msg, level | MSGLEVEL_HIDDEN)) + level |= MSGLEVEL_HIDDEN; + if (server_ischannel(SERVER(server), target)) { /* notice in some channel */ printformat(server, target, level, |