diff mod_watch_spam_reports/mod_watch_spam_reports.lua @ 4046:d518f97dad6f

mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
author Martin Dosch <martin@mdosch.de>
date Tue, 16 Jun 2020 11:21:58 +0200
parents
children 91e2e510e17c
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_watch_spam_reports/mod_watch_spam_reports.lua	Tue Jun 16 11:21:58 2020 +0200
@@ -0,0 +1,14 @@
+local st = require "util.stanza";
+local admins = module:get_option_inherited_set("admins");
+local host = module.host;
+
+module:depends("spam_reporting")
+
+module:hook("spam_reporting/spam-report", function(event)
+	for admin_jid in admins
+		do
+			module:send(st.message({from=host,
+			type="chat",to=admin_jid},
+			event.stanza.attr.from.." reported "..event.jid.." as spammer: "..event.reason));
+		end
+end)