diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-09 18:30:35 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-09 18:30:57 +0100 |
commit | d556c229f400feef1c0f5aa26d40131027b8e40e (patch) | |
tree | 55a158441900c27eb7593fa493d3c8746a983f10 /src/lua | |
parent | 3f87ae074c909ba08ec20b85ab513db4261efc52 (diff) | |
download | rspamd-d556c229f400feef1c0f5aa26d40131027b8e40e.tar.gz rspamd-d556c229f400feef1c0f5aa26d40131027b8e40e.zip |
[Feature] Allow to disable actions by users settings
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_task.c | 15 |
1 files 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)); + } } } } |