annotate mod_watch_spam_reports/mod_watch_spam_reports.lua @ 4298:020dd0a59f1f

mod_muc_markers: Add option for @id rewriting, default off (may break some clients) XEP-0333 was updated to clarify that stanza-id should be used instead of the 'id' attribute when in a MUC. Some clients still use the id attribute, which is why we were rewriting it. Rewriting is bad because mod_muc advertises stable_id, indicating that Prosody does *not* rewrite ids. Recent versions of Conversations actually depend on this being true. All clients should migrate to using stanza-id for markers. See XEP-0333.
author Matthew Wild <mwild1@gmail.com>
date Mon, 14 Dec 2020 12:09:25 +0000
parents 9745a623c7ed
children 7a9e1c81c63e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4051
91e2e510e17c mod_watch_spam_reports: Show reporters bare JID instead of full JID
Martin Dosch <martin@mdosch.de>
parents: 4046
diff changeset
1 local jid = require "util.jid";
4046
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
2 local st = require "util.stanza";
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
3 local admins = module:get_option_inherited_set("admins");
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
4 local host = module.host;
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
5
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
6 module:depends("spam_reporting")
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
7
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
8 module:hook("spam_reporting/spam-report", function(event)
4061
9745a623c7ed mod_watch_spam_reports: Define variable prior to using it
Martin Dosch <martin@mdosch.de>
parents: 4054
diff changeset
9 local reporter_bare_jid = jid.bare(event.stanza.attr.from)
4053
b0bc36d026d9 mod_watch_spam_reports: Fix ugly whitespace typo
Martin Dosch <martin@mdosch.de>
parents: 4052
diff changeset
10 local report = reporter_bare_jid.." reported "..event.jid.." as spammer: "..event.reason
4046
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
11 for admin_jid in admins
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
12 do
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
13 module:send(st.message({from=host,
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
14 type="chat",to=admin_jid},
4061
9745a623c7ed mod_watch_spam_reports: Define variable prior to using it
Martin Dosch <martin@mdosch.de>
parents: 4054
diff changeset
15 report));
4046
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
16 end
d518f97dad6f mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff changeset
17 end)