aboutsummaryrefslogtreecommitdiffstats
path: root/src/controller.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-14 16:48:52 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-14 16:48:52 +0000
commitaa07f4bc9eff2a252743e20faa334f2aa7d589d5 (patch)
tree177051f9fe263c7b1523aff6f83e8c1675d7d8b0 /src/controller.c
parent137f4b1e53572d5f43a5a6368482f82149652091 (diff)
downloadrspamd-aa07f4bc9eff2a252743e20faa334f2aa7d589d5.tar.gz
rspamd-aa07f4bc9eff2a252743e20faa334f2aa7d589d5.zip
[Project] More work towards flexible actions
Diffstat (limited to 'src/controller.c')
-rw-r--r--src/controller.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/controller.c b/src/controller.c
index ee7e80e20..6a839b4df 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -15,6 +15,7 @@
*/
#include "config.h"
#include "libserver/dynamic_cfg.h"
+#include "libserver/cfg_file_private.h"
#include "libutil/rrd.h"
#include "libutil/map.h"
#include "libutil/map_helpers.h"
@@ -864,8 +865,7 @@ rspamd_controller_handle_actions (struct rspamd_http_connection_entry *conn_ent,
struct rspamd_http_message *msg)
{
struct rspamd_controller_session *session = conn_ent->ud;
- struct rspamd_action *act;
- gint i;
+ struct rspamd_action *act, *tmp;
ucl_object_t *obj, *top;
if (!rspamd_controller_check_password (conn_ent, session, msg, FALSE)) {
@@ -874,15 +874,14 @@ rspamd_controller_handle_actions (struct rspamd_http_connection_entry *conn_ent,
top = ucl_object_typed_new (UCL_ARRAY);
- /* Get actions for default metric */
- for (i = METRIC_ACTION_REJECT; i < METRIC_ACTION_MAX; i++) {
- act = &session->cfg->actions[i];
+ HASH_ITER (hh, session->cfg->actions, act, tmp) {
obj = ucl_object_typed_new (UCL_OBJECT);
ucl_object_insert_key (obj,
- ucl_object_fromstring (rspamd_action_to_str (
- act->action)), "action", 0, false);
- ucl_object_insert_key (obj, ucl_object_fromdouble (
- act->threshold), "value", 0, false);
+ ucl_object_fromstring (act->name),
+ "action", 0, false);
+ ucl_object_insert_key (obj,
+ ucl_object_fromdouble (act->threshold),
+ "value", 0, false);
ucl_array_append (top, obj);
}