aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/once_received.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/lua/once_received.lua')
-rw-r--r--src/plugins/lua/once_received.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua
new file mode 100644
index 000000000..409ec4aff
--- /dev/null
+++ b/src/plugins/lua/once_received.lua
@@ -0,0 +1,15 @@
+-- 0 or 1 received: = spam
+
+local metric = 'default'
+local symbol = 'ONCE_RECEIVED'
+
+function check_quantity_received (task)
+ local recvh = task:get_received_headers()
+ if table.maxn(recvh) <= 1 then
+ task:insert_result(metric, symbol, 1)
+ end
+end
+
+-- Register symbol's callback
+local m = rspamd_config:get_metric(metric)
+m:register_symbol(symbol, 1.0, 'check_quantity_received')