Mercurial > prosody-modules
comparison mod_watch_spam_reports/mod_watch_spam_reports.lua @ 4051:91e2e510e17c
mod_watch_spam_reports: Show reporters bare JID instead of full JID
author | Martin Dosch <martin@mdosch.de> |
---|---|
date | Wed, 24 Jun 2020 08:51:07 +0200 |
parents | d518f97dad6f |
children | 0d6841e0cb18 |
comparison
equal
deleted
inserted
replaced
4050:1eb2b9483081 | 4051:91e2e510e17c |
---|---|
1 local jid = require "util.jid"; | |
1 local st = require "util.stanza"; | 2 local st = require "util.stanza"; |
2 local admins = module:get_option_inherited_set("admins"); | 3 local admins = module:get_option_inherited_set("admins"); |
3 local host = module.host; | 4 local host = module.host; |
4 | 5 |
5 module:depends("spam_reporting") | 6 module:depends("spam_reporting") |
6 | 7 |
7 module:hook("spam_reporting/spam-report", function(event) | 8 module:hook("spam_reporting/spam-report", function(event) |
9 local reporter_bare_jid = jid.bare(event.stanza.attr.from) | |
8 for admin_jid in admins | 10 for admin_jid in admins |
9 do | 11 do |
10 module:send(st.message({from=host, | 12 module:send(st.message({from=host, |
11 type="chat",to=admin_jid}, | 13 type="chat",to=admin_jid}, |
12 event.stanza.attr.from.." reported "..event.jid.." as spammer: "..event.reason)); | 14 reporter_bare_jid.." reported "..event.jid.." as spammer: "..event.reason)); |
13 end | 15 end |
14 end) | 16 end) |