mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
Add NO_ACT level
This patch adds a new NO_ACT level that can be used with /ignore to ignore activity notifications
This commit is contained in:
parent
b7c1fbd2b9
commit
7d87a02522
@ -46,6 +46,7 @@ static const char *levels[] = {
|
|||||||
"HILIGHTS",
|
"HILIGHTS",
|
||||||
|
|
||||||
"NOHILIGHT",
|
"NOHILIGHT",
|
||||||
|
"NO_ACT",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -59,6 +60,9 @@ int level_get(const char *level)
|
|||||||
if (g_ascii_strcasecmp(level, "NEVER") == 0)
|
if (g_ascii_strcasecmp(level, "NEVER") == 0)
|
||||||
return MSGLEVEL_NEVER;
|
return MSGLEVEL_NEVER;
|
||||||
|
|
||||||
|
if (g_ascii_strcasecmp(level, "NO_ACT") == 0)
|
||||||
|
return MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
len = strlen(level);
|
len = strlen(level);
|
||||||
if (len == 0) return 0;
|
if (len == 0) return 0;
|
||||||
|
|
||||||
@ -139,6 +143,9 @@ char *bits2level(int bits)
|
|||||||
if (bits & MSGLEVEL_NEVER)
|
if (bits & MSGLEVEL_NEVER)
|
||||||
g_string_append(str, "NEVER ");
|
g_string_append(str, "NEVER ");
|
||||||
|
|
||||||
|
if (bits & MSGLEVEL_NO_ACT)
|
||||||
|
g_string_append(str, "NO_ACT ");
|
||||||
|
|
||||||
for (n = 0; levels[n] != NULL; n++) {
|
for (n = 0; levels[n] != NULL; n++) {
|
||||||
if (bits & (1L << n))
|
if (bits & (1L << n))
|
||||||
g_string_append_printf(str, "%s ", levels[n]);
|
g_string_append_printf(str, "%s ", levels[n]);
|
||||||
|
@ -190,6 +190,9 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
|||||||
if (for_me)
|
if (for_me)
|
||||||
level |= MSGLEVEL_HILIGHT;
|
level |= MSGLEVEL_HILIGHT;
|
||||||
|
|
||||||
|
if (ignore_check(server, nick, address, target, msg, MSGLEVEL_NO_ACT))
|
||||||
|
level |= MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
if (settings_get_bool("emphasis"))
|
if (settings_get_bool("emphasis"))
|
||||||
msg = freemsg = expand_emphasis((WI_ITEM_REC *) chanrec, msg);
|
msg = freemsg = expand_emphasis((WI_ITEM_REC *) chanrec, msg);
|
||||||
|
|
||||||
@ -325,7 +328,12 @@ static void sig_message_own_private(SERVER_REC *server, const char *msg,
|
|||||||
static void sig_message_join(SERVER_REC *server, const char *channel,
|
static void sig_message_join(SERVER_REC *server, const char *channel,
|
||||||
const char *nick, const char *address)
|
const char *nick, const char *address)
|
||||||
{
|
{
|
||||||
printformat(server, channel, MSGLEVEL_JOINS,
|
int level = MSGLEVEL_JOINS;
|
||||||
|
|
||||||
|
if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_NO_ACT))
|
||||||
|
level |= MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
|
printformat(server, channel, level,
|
||||||
TXT_JOIN, nick, address, channel);
|
TXT_JOIN, nick, address, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +341,12 @@ static void sig_message_part(SERVER_REC *server, const char *channel,
|
|||||||
const char *nick, const char *address,
|
const char *nick, const char *address,
|
||||||
const char *reason)
|
const char *reason)
|
||||||
{
|
{
|
||||||
printformat(server, channel, MSGLEVEL_PARTS,
|
int level = MSGLEVEL_PARTS;
|
||||||
|
|
||||||
|
if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_NO_ACT))
|
||||||
|
level |= MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
|
printformat(server, channel, level,
|
||||||
TXT_PART, nick, address, channel, reason);
|
TXT_PART, nick, address, channel, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,17 +357,21 @@ static void sig_message_quit(SERVER_REC *server, const char *nick,
|
|||||||
GString *chans;
|
GString *chans;
|
||||||
GSList *tmp, *windows;
|
GSList *tmp, *windows;
|
||||||
char *print_channel;
|
char *print_channel;
|
||||||
int once, count;
|
int once, count, level = MSGLEVEL_QUITS;
|
||||||
|
|
||||||
if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_QUITS))
|
if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_QUITS))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_NO_ACT))
|
||||||
|
level |= MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
print_channel = NULL;
|
print_channel = NULL;
|
||||||
once = settings_get_bool("show_quit_once");
|
once = settings_get_bool("show_quit_once");
|
||||||
|
|
||||||
count = 0; windows = NULL;
|
count = 0; windows = NULL;
|
||||||
chans = g_string_new(NULL);
|
chans = g_string_new(NULL);
|
||||||
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
||||||
|
level = MSGLEVEL_QUITS;
|
||||||
CHANNEL_REC *rec = tmp->data;
|
CHANNEL_REC *rec = tmp->data;
|
||||||
|
|
||||||
if (!nicklist_find(rec, nick))
|
if (!nicklist_find(rec, nick))
|
||||||
@ -366,6 +383,9 @@ static void sig_message_quit(SERVER_REC *server, const char *nick,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ignore_check(server, nick, address, rec->visible_name, reason, MSGLEVEL_NO_ACT))
|
||||||
|
level |= MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
if (print_channel == NULL ||
|
if (print_channel == NULL ||
|
||||||
active_win->active == (WI_ITEM_REC *) rec)
|
active_win->active == (WI_ITEM_REC *) rec)
|
||||||
print_channel = rec->visible_name;
|
print_channel = rec->visible_name;
|
||||||
@ -377,7 +397,7 @@ static void sig_message_quit(SERVER_REC *server, const char *nick,
|
|||||||
if (g_slist_find(windows, window) == NULL) {
|
if (g_slist_find(windows, window) == NULL) {
|
||||||
windows = g_slist_append(windows, window);
|
windows = g_slist_append(windows, window);
|
||||||
printformat(server, rec->visible_name,
|
printformat(server, rec->visible_name,
|
||||||
MSGLEVEL_QUITS,
|
level,
|
||||||
TXT_QUIT, nick, address, reason,
|
TXT_QUIT, nick, address, reason,
|
||||||
rec->visible_name);
|
rec->visible_name);
|
||||||
}
|
}
|
||||||
@ -391,7 +411,7 @@ static void sig_message_quit(SERVER_REC *server, const char *nick,
|
|||||||
display the quit there too */
|
display the quit there too */
|
||||||
QUERY_REC *query = query_find(server, nick);
|
QUERY_REC *query = query_find(server, nick);
|
||||||
if (query != NULL) {
|
if (query != NULL) {
|
||||||
printformat(server, nick, MSGLEVEL_QUITS,
|
printformat(server, nick, level,
|
||||||
TXT_QUIT, nick, address, reason, "");
|
TXT_QUIT, nick, address, reason, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -410,7 +430,12 @@ static void sig_message_kick(SERVER_REC *server, const char *channel,
|
|||||||
const char *nick, const char *kicker,
|
const char *nick, const char *kicker,
|
||||||
const char *address, const char *reason)
|
const char *address, const char *reason)
|
||||||
{
|
{
|
||||||
printformat(server, channel, MSGLEVEL_KICKS,
|
int level = MSGLEVEL_KICKS;
|
||||||
|
|
||||||
|
if (ignore_check(server, kicker, address, channel, reason, MSGLEVEL_NO_ACT))
|
||||||
|
level |= MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
|
printformat(server, channel, level,
|
||||||
TXT_KICK, nick, channel, kicker, reason, address);
|
TXT_KICK, nick, channel, kicker, reason, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,6 +453,9 @@ static void print_nick_change_channel(SERVER_REC *server, const char *channel,
|
|||||||
level = MSGLEVEL_NICKS;
|
level = MSGLEVEL_NICKS;
|
||||||
if (ownnick) level |= MSGLEVEL_NO_ACT;
|
if (ownnick) level |= MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
|
if (!(level & MSGLEVEL_NO_ACT) && ignore_check(server, oldnick, address, channel, newnick, MSGLEVEL_NO_ACT))
|
||||||
|
level |= MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
printformat(server, channel, level,
|
printformat(server, channel, level,
|
||||||
ownnick ? TXT_YOUR_NICK_CHANGED : TXT_NICK_CHANGED,
|
ownnick ? TXT_YOUR_NICK_CHANGED : TXT_NICK_CHANGED,
|
||||||
oldnick, newnick, channel, address);
|
oldnick, newnick, channel, address);
|
||||||
@ -502,7 +530,12 @@ static void sig_message_topic(SERVER_REC *server, const char *channel,
|
|||||||
const char *topic,
|
const char *topic,
|
||||||
const char *nick, const char *address)
|
const char *nick, const char *address)
|
||||||
{
|
{
|
||||||
printformat(server, channel, MSGLEVEL_TOPICS,
|
int level = MSGLEVEL_TOPICS;
|
||||||
|
|
||||||
|
if (ignore_check(server, nick, address, channel, topic, MSGLEVEL_NO_ACT))
|
||||||
|
level |= MSGLEVEL_NO_ACT;
|
||||||
|
|
||||||
|
printformat(server, channel, level,
|
||||||
*topic != '\0' ? TXT_NEW_TOPIC : TXT_TOPIC_UNSET,
|
*topic != '\0' ? TXT_NEW_TOPIC : TXT_TOPIC_UNSET,
|
||||||
nick, channel, topic, address);
|
nick, channel, topic, address);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user