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
parent
9adedc660b
commit
61bd4079a0
2
filter.c
2
filter.c
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue