summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2016-07-16 12:11:29 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2016-07-16 12:11:29 +0300
commit43383d32287a76a6895aeea3d4b7523667a76bd5 (patch)
tree8be267c6a14be025fcb346f70ee5b567ec2de99d /src/lua
parenta0603aa75c6211e18a311349ed17214daee59b44 (diff)
downloadrspamd-43383d32287a76a6895aeea3d4b7523667a76bd5.tar.gz
rspamd-43383d32287a76a6895aeea3d4b7523667a76bd5.zip
[Minor] Add task:set_flag example
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_task.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index c7e446a24..a3e3b0564 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -584,6 +584,26 @@ LUA_FUNCTION_DEF (task, get_size);
* - `broken_headers`: header data is broken for a message
* @param {string} flag to set
* @param {boolean} set set or clear flag (default is set)
+@example
+--[[
+For messages with undefined queue ID (scanned with rspamc or WebUI)
+do not include results into statistics and do not log task summary
+(it will not appear in the WebUI history as well).
+]]--
+
+-- Callback function to set flags
+local function no_log_stat_cb(task)
+ if not task:get_queue_id() then
+ task:set_flag('no_log')
+ task:set_flag('no_stat')
+ end
+end
+
+rspamd_config:register_symbol({
+ name = 'LOCAL_NO_LOG_STAT',
+ type = 'postfilter',
+ callback = no_log_stat_cb
+})
*/
LUA_FUNCTION_DEF (task, set_flag);