diff options
-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 |