Preserve order of filters when removing

Filters should be kept in order since the first one that matches,
wins. This lets highlights or ignores take priority over each other,
if desired.
master
C. McEnroe 2021-01-23 16:15:39 -05:00
parent 9adedc660b
commit 61bd4079a0
1 changed files with 1 additions and 1 deletions

View File

@ -74,7 +74,7 @@ bool filterRemove(struct Filter filter) {
if (filter.chan && strcasecmp(filters[i].chan, filter.chan)) continue; if (filter.chan && strcasecmp(filters[i].chan, filter.chan)) continue;
if (filter.mesg && strcasecmp(filters[i].mesg, filter.mesg)) continue; if (filter.mesg && strcasecmp(filters[i].mesg, filter.mesg)) continue;
free(filters[i].mask); free(filters[i].mask);
filters[i] = filters[--len]; memmove(&filters[i], &filters[i + 1], sizeof(*filters) * --len);
filters[len] = (struct Filter) {0}; filters[len] = (struct Filter) {0};
found = true; found = true;
} }