From: Alexander Moisseev Date: Sat, 16 Jul 2016 09:11:29 +0000 (+0300) Subject: [Minor] Add task:set_flag example X-Git-Tag: 1.3.0~71^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F724%2Fhead;p=thirdparty%2Frspamd.git [Minor] Add task:set_flag example --- 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);