mirror of
https://github.com/irssi/irssi.git
synced 2026-08-17 15:42:26 +02:00
Change NO_ACT so it can be used in addition to other ignores
This results in a more flexible system and is less surprising as it means levels can be used in the way they normally can in an ignore. As an example the current approach to NO_ACT provides no way to let HILIGHTS be shown, with this change /set activity_hide_targets can be recreated with: /ignore #channel NO_ACT /ignore #channel -except -regexp -pattern . NO_ACT HILIGHTS (but obviously this can be configured in many more ways if desired).
This commit is contained in:
parent
2b6bba3fd2
commit
819f9d16c9
5 changed files with 62 additions and 13 deletions
|
|
@ -104,8 +104,15 @@ static int ignore_match_pattern(IGNORE_REC *rec, const char *text)
|
|||
stristr(text, rec->pattern) != NULL;
|
||||
}
|
||||
|
||||
/* MSGLEVEL_NO_ACT is special in ignores, when provided to ignore_check() it's
|
||||
* used as a flag to indicate it should only look at ignore items with NO_ACT.
|
||||
* However we also want to allow NO_ACT combined with levels, so mask it out and
|
||||
* match levels if set. */
|
||||
#define ignore_match_level(rec, level) \
|
||||
((level & (rec)->level) != 0)
|
||||
(((level & MSGLEVEL_NO_ACT) != 0) ? \
|
||||
((~MSGLEVEL_NO_ACT & level) & (rec)->level) != 0 : \
|
||||
((rec)->level & MSGLEVEL_NO_ACT ? 0 : \
|
||||
(level & (rec)->level) != 0))
|
||||
|
||||
#define ignore_match_nickmask(rec, nick, nickmask) \
|
||||
((rec)->mask == NULL || \
|
||||
|
|
@ -180,7 +187,14 @@ int ignore_check(SERVER_REC *server, const char *nick, const char *host,
|
|||
}
|
||||
|
||||
IGNORE_REC *ignore_find(const char *servertag, const char *mask,
|
||||
char **channels)
|
||||
char **channels)
|
||||
{
|
||||
return ignore_find_noact(servertag, mask, channels, 0);
|
||||
}
|
||||
|
||||
|
||||
IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask,
|
||||
char **channels, int noact)
|
||||
{
|
||||
GSList *tmp;
|
||||
char **chan;
|
||||
|
|
@ -202,6 +216,12 @@ IGNORE_REC *ignore_find(const char *servertag, const char *mask,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (noact && (rec->level & MSGLEVEL_NO_ACT) == 0)
|
||||
continue;
|
||||
|
||||
if (!noact && (rec->level & MSGLEVEL_NO_ACT) != 0)
|
||||
continue;
|
||||
|
||||
if ((rec->mask == NULL && mask != NULL) ||
|
||||
(rec->mask != NULL && mask == NULL)) continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ int ignore_check(SERVER_REC *server, const char *nick, const char *host,
|
|||
const char *channel, const char *text, int level);
|
||||
|
||||
IGNORE_REC *ignore_find(const char *servertag, const char *mask, char **channels);
|
||||
IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask, char **channels, int noact);
|
||||
|
||||
void ignore_add_rec(IGNORE_REC *rec);
|
||||
void ignore_update_rec(IGNORE_REC *rec);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue