Mercurial > prosody-modules
comparison mod_spam_report_forwarder/mod_spam_report_forwarder.lua @ 5238:94472eb41d0a
mod_spam_report_forwarder: Forward spam/abuse reports to one or more JIDs
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 11 Mar 2023 20:20:37 +0000 |
parents | |
children | 37e38ee534ea |
comparison
equal
deleted
inserted
replaced
5237:3354f943c1fa | 5238:94472eb41d0a |
---|---|
1 local st = require "util.stanza"; | |
2 | |
3 local destinations = module:get_option_set("spam_report_destinations", {}); | |
4 | |
5 function forward_report(event) | |
6 local report = st.clone(event.report); | |
7 report:text_tag("jid", event.jid, { xmlns = "urn:xmpp:jid:0" }); | |
8 | |
9 local message = st.message({ from = module.host }) | |
10 :add_child(report); | |
11 | |
12 for destination in destinations do | |
13 local m = st.clone(message); | |
14 m.attr.to = destination; | |
15 module:send(m); | |
16 end | |
17 end | |
18 | |
19 module:hook("spam_reporting/abuse-report", forward_report, -1); | |
20 module:hook("spam_reporting/spam-report", forward_report, -1); | |
21 module:hook("spam_reporting/unknown-report", forward_report, -1); |