From 43383d32287a76a6895aeea3d4b7523667a76bd5 Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Sat, 16 Jul 2016 12:11:29 +0300 Subject: [PATCH] [Minor] Add task:set_flag example --- src/lua/lua_task.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index c7e446a24f..a3e3b0564e 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); -- 2.47.3