# HG changeset patch # User Martin Dosch # Date 1592299318 -7200 # Node ID d518f97dad6f15a2897dac0df60e52a9d104e6ec # Parent 4fc6cf528a9a5abc86293155f2c94e13cb4a4417 mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports diff -r 4fc6cf528a9a -r d518f97dad6f mod_watch_spam_reports/README.markdown --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_watch_spam_reports/README.markdown Tue Jun 16 11:21:58 2020 +0200 @@ -0,0 +1,11 @@ +--- +depends: +- 'mod\_spam\_reporting' +labels: +- 'Stage-Alpha' +summary: 'Notify admins about incoming XEP-0377 spam reports' +--- + +This module sends a message to the server admins for incoming +[XEP-0377](https://xmpp.org/extensions/xep-0377.html) spam +reports. It doesn't require any configuration. diff -r 4fc6cf528a9a -r d518f97dad6f mod_watch_spam_reports/mod_watch_spam_reports.lua --- /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)