filter: add DROP and ABORT
This commit is contained in:
parent
dc141aad45
commit
344af24c2f
1 changed files with 23 additions and 1 deletions
|
@ -126,7 +126,7 @@ moddeinit(void)
|
||||||
|
|
||||||
mapi_clist_av1 filter_clist[] = { &setfilter_msgtab, NULL };
|
mapi_clist_av1 filter_clist[] = { &setfilter_msgtab, NULL };
|
||||||
|
|
||||||
DECLARE_MODULE_AV1(filter, modinit, moddeinit, filter_clist, NULL, filter_hfnlist, "0.3");
|
DECLARE_MODULE_AV1(filter, modinit, moddeinit, filter_clist, NULL, filter_hfnlist, "0.4");
|
||||||
|
|
||||||
static int
|
static int
|
||||||
setfilter(const char *check, const char *data, const char **error)
|
setfilter(const char *check, const char *data, const char **error)
|
||||||
|
@ -162,6 +162,28 @@ setfilter(const char *check, const char *data, const char **error)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcasecmp(data, "drop")) {
|
||||||
|
if (!filter_db) {
|
||||||
|
if (error) *error = "no database to drop";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
hs_free_database(filter_db);
|
||||||
|
filter_db = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcasecmp(data, "abort")) {
|
||||||
|
if (state != FILTER_FILLING) {
|
||||||
|
if (error) *error = "not filling";
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
state = filter_db ? FILTER_LOADED : FILTER_EMPTY;
|
||||||
|
rb_free(filter_data);
|
||||||
|
filter_data = 0;
|
||||||
|
filter_data_len = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(check, check_str) != 0) {
|
if (strcmp(check, check_str) != 0) {
|
||||||
if (error) *error = "check strings don't match";
|
if (error) *error = "check strings don't match";
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in a new issue