mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02:00
Merge pull request #80 from dgl/noact
Change NO_ACT so it can be combined with other levels
This commit is contained in:
commit
ed51629514
9 changed files with 139 additions and 51 deletions
|
|
@ -120,7 +120,7 @@ static void cmd_ignore(const char *data)
|
|||
char *patternarg, *chanarg, *mask, *levels, *timestr, *servertag;
|
||||
char **channels;
|
||||
void *free_arg;
|
||||
int new_ignore, msecs;
|
||||
int new_ignore, msecs, level;
|
||||
|
||||
if (*data == '\0') {
|
||||
cmd_ignore_show();
|
||||
|
|
@ -140,6 +140,7 @@ static void cmd_ignore(const char *data)
|
|||
|
||||
if (*mask == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
|
||||
if (*levels == '\0') levels = "ALL";
|
||||
level = level2bits(levels, NULL);
|
||||
|
||||
msecs = 0;
|
||||
timestr = g_hash_table_lookup(optlist, "time");
|
||||
|
|
@ -156,7 +157,8 @@ static void cmd_ignore(const char *data)
|
|||
channels = (chanarg == NULL || *chanarg == '\0') ? NULL :
|
||||
g_strsplit(chanarg, ",", -1);
|
||||
|
||||
rec = patternarg != NULL ? NULL: ignore_find(servertag, mask, channels);
|
||||
rec = patternarg != NULL ? NULL: ignore_find_noact(servertag, mask, channels,
|
||||
(level & MSGLEVEL_NO_ACT));
|
||||
new_ignore = rec == NULL;
|
||||
|
||||
if (rec == NULL) {
|
||||
|
|
@ -172,6 +174,12 @@ static void cmd_ignore(const char *data)
|
|||
|
||||
rec->level = combine_level(rec->level, levels);
|
||||
|
||||
if (rec->level == MSGLEVEL_NO_ACT) {
|
||||
/* If only NO_ACT 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,
|
||||
|
|
@ -228,7 +236,10 @@ static void cmd_unignore(const char *data)
|
|||
chans[0] = mask;
|
||||
mask = NULL;
|
||||
}
|
||||
rec = ignore_find("*", mask, (char **) chans);
|
||||
rec = ignore_find_noact("*", mask, (char **) chans, 0);
|
||||
if (rec == NULL) {
|
||||
rec = ignore_find_noact("*", mask, (char **) chans, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (rec != NULL) {
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
|||
if (for_me)
|
||||
level |= MSGLEVEL_HILIGHT;
|
||||
|
||||
if (ignore_check(server, nick, address, target, msg, MSGLEVEL_NO_ACT))
|
||||
if (ignore_check(server, nick, address, target, msg, level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
if (settings_get_bool("emphasis"))
|
||||
|
|
@ -238,13 +238,17 @@ static void sig_message_private(SERVER_REC *server, const char *msg,
|
|||
{
|
||||
QUERY_REC *query;
|
||||
char *freemsg = NULL;
|
||||
int level = MSGLEVEL_MSGS;
|
||||
|
||||
query = query_find(server, nick);
|
||||
|
||||
if (settings_get_bool("emphasis"))
|
||||
msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg);
|
||||
|
||||
printformat(server, nick, MSGLEVEL_MSGS,
|
||||
if (ignore_check(server, nick, address, NULL, msg, level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
printformat(server, nick, level,
|
||||
query == NULL ? TXT_MSG_PRIVATE :
|
||||
TXT_MSG_PRIVATE_QUERY, nick, address, msg);
|
||||
|
||||
|
|
@ -330,7 +334,7 @@ static void sig_message_join(SERVER_REC *server, const char *channel,
|
|||
{
|
||||
int level = MSGLEVEL_JOINS;
|
||||
|
||||
if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_NO_ACT))
|
||||
if (ignore_check(server, nick, address, channel, NULL, level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
printformat(server, channel, level,
|
||||
|
|
@ -343,7 +347,7 @@ static void sig_message_part(SERVER_REC *server, const char *channel,
|
|||
{
|
||||
int level = MSGLEVEL_PARTS;
|
||||
|
||||
if (ignore_check(server, nick, address, channel, NULL, MSGLEVEL_NO_ACT))
|
||||
if (ignore_check(server, nick, address, channel, NULL, level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
printformat(server, channel, level,
|
||||
|
|
@ -362,7 +366,7 @@ static void sig_message_quit(SERVER_REC *server, const char *nick,
|
|||
if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_QUITS))
|
||||
return;
|
||||
|
||||
if (ignore_check(server, nick, address, NULL, reason, MSGLEVEL_NO_ACT))
|
||||
if (ignore_check(server, nick, address, NULL, reason, level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
print_channel = NULL;
|
||||
|
|
@ -432,7 +436,7 @@ static void sig_message_kick(SERVER_REC *server, const char *channel,
|
|||
{
|
||||
int level = MSGLEVEL_KICKS;
|
||||
|
||||
if (ignore_check(server, kicker, address, channel, reason, MSGLEVEL_NO_ACT))
|
||||
if (ignore_check(server, kicker, address, channel, reason, level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
printformat(server, channel, level,
|
||||
|
|
@ -453,7 +457,7 @@ static void print_nick_change_channel(SERVER_REC *server, const char *channel,
|
|||
level = MSGLEVEL_NICKS;
|
||||
if (ownnick) level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
if (!(level & MSGLEVEL_NO_ACT) && ignore_check(server, oldnick, address, channel, newnick, MSGLEVEL_NO_ACT))
|
||||
if (!(level & MSGLEVEL_NO_ACT) && ignore_check(server, oldnick, address, channel, newnick, level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
printformat(server, channel, level,
|
||||
|
|
@ -532,7 +536,7 @@ static void sig_message_topic(SERVER_REC *server, const char *channel,
|
|||
{
|
||||
int level = MSGLEVEL_TOPICS;
|
||||
|
||||
if (ignore_check(server, nick, address, channel, topic, MSGLEVEL_NO_ACT))
|
||||
if (ignore_check(server, nick, address, channel, topic, level | MSGLEVEL_NO_ACT))
|
||||
level |= MSGLEVEL_NO_ACT;
|
||||
|
||||
printformat(server, channel, level,
|
||||
|
|
|
|||
|
|
@ -336,6 +336,12 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
|
|||
if (!nick_match || (dest->level & MSGLEVEL_HILIGHT)) {
|
||||
/* update the level / hilight info */
|
||||
hilight_update_text_dest(dest, hilight);
|
||||
/* Remove NO_ACT, this means explicitly defined hilights will bypass
|
||||
* /IGNORE ... NO_ACT.
|
||||
* (It's still possible to use /hilight -actcolor %n to hide
|
||||
* hilight/beep).
|
||||
*/
|
||||
dest->level &= ~MSGLEVEL_NO_ACT;
|
||||
}
|
||||
|
||||
if (nick_match)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue