diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-01-14 16:48:52 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-01-14 16:48:52 +0000 |
commit | aa07f4bc9eff2a252743e20faa334f2aa7d589d5 (patch) | |
tree | 177051f9fe263c7b1523aff6f83e8c1675d7d8b0 /src/libserver/cfg_utils.c | |
parent | 137f4b1e53572d5f43a5a6368482f82149652091 (diff) | |
download | rspamd-aa07f4bc9eff2a252743e20faa334f2aa7d589d5.tar.gz rspamd-aa07f4bc9eff2a252743e20faa334f2aa7d589d5.zip |
[Project] More work towards flexible actions
Diffstat (limited to 'src/libserver/cfg_utils.c')
-rw-r--r-- | src/libserver/cfg_utils.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 1ab2ff054..26bf4e4b0 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -141,7 +141,7 @@ rspamd_config_new (enum rspamd_config_init_flags flags) action->threshold = NAN; action->name = rspamd_mempool_strdup (cfg->cfg_pool, rspamd_action_to_str (i)); - action->action = i; + action->action_type = i; if (i == METRIC_ACTION_SOFT_REJECT) { action->flags |= RSPAMD_ACTION_NO_THRESHOLD; @@ -1946,10 +1946,10 @@ rspamd_config_action_from_ucl (struct rspamd_config *cfg, act->flags = flags; if (rspamd_action_from_str (act->name, &std_act)) { - act->action = std_act; + act->action_type = std_act; } else { - act->action = METRIC_ACTION_CUSTOM; + act->action_type = METRIC_ACTION_CUSTOM; } rspamd_actions_sort (cfg); @@ -2060,6 +2060,21 @@ rspamd_config_get_action (struct rspamd_config *cfg, const gchar *name) return res; } +struct rspamd_action * +rspamd_config_get_action_by_type (struct rspamd_config *cfg, + enum rspamd_action_type type) +{ + struct rspamd_action *cur, *tmp; + + HASH_ITER (hh, cfg->actions, cur, tmp) { + if (cur->action_type == type) { + return cur; + } + } + + return NULL; +} + gboolean rspamd_config_radix_from_ucl (struct rspamd_config *cfg, const ucl_object_t *obj, |