From d556c229f400feef1c0f5aa26d40131027b8e40e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 9 Oct 2018 18:30:35 +0100 Subject: [PATCH] [Feature] Allow to disable actions by users settings --- src/lua/lua_task.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index c51881df8..1fb7313c0 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -4136,9 +4136,18 @@ lua_task_set_settings (lua_State *L) rspamd_action_to_str_alt (i), NULL); if (elt) { - mres->actions_limits[i] = ucl_object_todouble (elt); - msg_debug_task ("adjusted action %s to %.2f", - ucl_object_key (elt), mres->actions_limits[i]); + + if (ucl_object_type (elt) == UCL_FLOAT || + ucl_object_type (elt) == UCL_INT) { + mres->actions_limits[i] = ucl_object_todouble (elt); + msg_debug_task ("adjusted action %s to %.2f", + ucl_object_key (elt), mres->actions_limits[i]); + } + else if (ucl_object_type (elt) == UCL_NULL) { + mres->actions_limits[i] = NAN; + msg_info_task ("disabled action %s due to settings", + ucl_object_key (elt)); + } } } } -- 2.39.5