summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_config.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-14 09:58:18 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-01-14 09:58:18 +0000
commitdce02c48d87886154ce05285f4000c371cd1e26f (patch)
treec4b95a45c34d5c4c4562e573d8b94439735044e4 /src/lua/lua_config.c
parent96986ba7f75858395a35c87305427b16eca96547 (diff)
downloadrspamd-dce02c48d87886154ce05285f4000c371cd1e26f.tar.gz
rspamd-dce02c48d87886154ce05285f4000c371cd1e26f.zip
[Project] Move action definition to avoid uthash pollution
Diffstat (limited to 'src/lua/lua_config.c')
-rw-r--r--src/lua/lua_config.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c
index 0b9811272..1b7eaaa4d 100644
--- a/src/lua/lua_config.c
+++ b/src/lua/lua_config.c
@@ -17,6 +17,7 @@
#include "libmime/message.h"
#include "libutil/expression.h"
#include "libserver/composites.h"
+#include "libserver/cfg_file_private.h"
#include "libmime/lang_detection.h"
#include "lua/lua_map.h"
#include "lua/lua_thread_pool.h"
@@ -2220,15 +2221,15 @@ lua_config_get_all_actions (lua_State * L)
{
LUA_TRACE_POINT;
struct rspamd_config *cfg = lua_check_config (L, 1);
- gint act = 0;
+ struct rspamd_action *act, *tmp;
if (cfg) {
- lua_newtable (L);
+ lua_createtable (L, 0, HASH_COUNT (cfg->actions));
- for (act = METRIC_ACTION_REJECT; act < METRIC_ACTION_MAX; act ++) {
- if (!isnan (cfg->actions[act].threshold)) {
- lua_pushstring (L, rspamd_action_to_str (act));
- lua_pushnumber (L, cfg->actions[act].threshold);
+ HASH_ITER (hh, cfg->actions, act, tmp) {
+ if (!isnan (act->threshold)) {
+ lua_pushstring (L, act->name);
+ lua_pushnumber (L, act->threshold);
lua_settable (L, -3);
}
}