Merge pull request #80 from dgl/noact

Change NO_ACT so it can be combined with other levels
This commit is contained in:
Alexander Færøy 2014-07-04 23:48:41 +02:00
commit ed51629514
9 changed files with 139 additions and 51 deletions

View file

@ -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) {