diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-10-26 14:53:33 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-10-26 14:53:33 +0100 |
commit | 89f419a1f7ae12c63d51c9b5ad7e9284ca133d07 (patch) | |
tree | 719dceecbafe04f71e944a0a17baebd6cf697d93 | |
parent | 50c99730b9d5523701f852ba3e92fd0a3d9591aa (diff) | |
download | rspamd-89f419a1f7ae12c63d51c9b5ad7e9284ca133d07.tar.gz rspamd-89f419a1f7ae12c63d51c9b5ad7e9284ca133d07.zip |
[Minor] Unify set_pre_result invocations
-rw-r--r-- | src/lua/lua_task.c | 2 | ||||
-rw-r--r-- | src/plugins/lua/spamtrap.lua | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 3d81391b0..bc9ab8750 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -2321,7 +2321,7 @@ lua_task_set_pre_result (lua_State * L) action->name, action->threshold); } - return luaL_error (L, "unknown action %s", lua_tostring (L, 2)); + return luaL_error (L, "unknown action %s", act_str); } if (module == NULL) { diff --git a/src/plugins/lua/spamtrap.lua b/src/plugins/lua/spamtrap.lua index 0803d7d64..6147ad680 100644 --- a/src/plugins/lua/spamtrap.lua +++ b/src/plugins/lua/spamtrap.lua @@ -63,23 +63,23 @@ local function spamtrap_cb(task) end task:insert_result(settings['symbol'], 1, rcpt) - if settings['action'] then + if settings.action then rspamd_logger.infox(task, 'spamtrap found: <%s>', rcpt) + local smtp_message if settings.smtp_message then - task:set_pre_result(settings['action'], - lua_util.template(settings.smtp_message, { rcpt = rcpt}), 'spamtrap') + smtp_message = lua_util.template(settings.smtp_message, { rcpt = rcpt}) else - local smtp_message = 'unknown error' + smtp_message = 'unknown error' if settings.action == 'no action' then smtp_message = 'message accepted' elseif settings.action == 'reject' then smtp_message = 'message rejected' end - task:set_pre_result{action = settings['action'], - message = smtp_message, - module = 'spamtrap', - flags = act_flags} end + task:set_pre_result{action = settings.action, + message = smtp_message, + module = 'spamtrap', + flags = act_flags} end end |