Clean up the ignore_find API to make it more powerful.

This way we prevent the creation of duplicate ignores since the old code
skipped the ignore_find call when a pattern was specified.
It should also cover all the cases where the ignores would be wrongly
overwritten, such as the case outlined in #78.
This commit is contained in:
LemonBoy 2016-01-03 19:49:18 +01:00
commit 609f3ba6c2
4 changed files with 28 additions and 19 deletions

View file

@ -158,8 +158,8 @@ static void cmd_ignore(const char *data)
channels = (chanarg == NULL || *chanarg == '\0') ? NULL :
g_strsplit(chanarg, ",", -1);
rec = patternarg != NULL ? NULL: ignore_find_noact(servertag, mask, channels,
(level & MSGLEVEL_NO_ACT));
rec = ignore_find(servertag, mask, patternarg, channels,
IGNORE_FIND_PATTERN | ((level & MSGLEVEL_NO_ACT) ? IGNORE_FIND_NOACT : 0));
new_ignore = rec == NULL;
if (rec == NULL) {
@ -237,9 +237,9 @@ static void cmd_unignore(const char *data)
chans[0] = mask;
mask = NULL;
}
rec = ignore_find_noact("*", mask, (char **) chans, 0);
rec = ignore_find("*", mask, NULL, (char **) chans, 0);
if (rec == NULL) {
rec = ignore_find_noact("*", mask, (char **) chans, 1);
rec = ignore_find("*", mask, NULL, (char **) chans, IGNORE_FIND_NOACT);
}
}