From: Vsevolod Stakhov Date: Tue, 9 Oct 2018 17:30:35 +0000 (+0100) Subject: [Feature] Allow to disable actions by users settings X-Git-Tag: 1.8.1~53 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d556c229f400feef1c0f5aa26d40131027b8e40e;p=rspamd.git [Feature] Allow to disable actions by users settings --- 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)); + } } } }