]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add task:set_flag example 724/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 16 Jul 2016 09:11:29 +0000 (12:11 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 16 Jul 2016 09:11:29 +0000 (12:11 +0300)
src/lua/lua_task.c

index c7e446a24f3c2cc9d5f40f3c5fd10a19c88201b7..a3e3b0564ed1e147188d46b75d9bd6aafe978f01 100644 (file)
@@ -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);