Mercurial > prosody-modules
annotate mod_watch_spam_reports/mod_watch_spam_reports.lua @ 6083:ffd0184cd478
mod_compliance_latest: New module that depends on and therefore loads the latest compliance tester mod.
diff --git a/mod_compliance_latest/README.md b/mod_compliance_latest/README.md
new file mode 100644
--- /dev/null
+++ b/mod_compliance_latest/README.md
@@ -0,0 +1,25 @@
+---
+summary: XMPP Compliance Suites self-test
+labels:
+- Stage-Beta
+rockspec:
+ dependencies:
+ - mod_compliance_2023
+...
+
+# Introduction
+
+This module will always require and load to the lastest compliance tester we have in the community modules.
+Currently this is [mod_compliance_2023].
+
+# Configuration
+
+Just load this module as any other module and it will automatically install [mod_compliance_2023] if you use the Prosody plugin installer.
+See the linked module for further details.
+
+# Compatibility
+
+ Prosody-Version Status
+ --------------- ----------------------
+ trunk Works as of 2024-12-22
+ 0.12 Works
diff --git a/mod_compliance_latest/mod_compliance_latest.lua b/mod_compliance_latest/mod_compliance_latest.lua
new file mode 100644
--- /dev/null
+++ b/mod_compliance_latest/mod_compliance_latest.lua
@@ -0,0 +1,1 @@
+module:depends("compliance_2023");
| author | Menel <menel@snikket.de> |
|---|---|
| date | Sun, 22 Dec 2024 18:12:42 +0100 |
| parents | 97d34d520cfa |
| children |
| 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"; |
|
4663
6e5572fc6840
mod_watch_spam_reports: Support for fetching admins from authz provider
Matthew Wild <mwild1@gmail.com>
parents:
4657
diff
changeset
|
2 local set = require "util.set"; |
|
4046
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 st = require "util.stanza"; |
|
4663
6e5572fc6840
mod_watch_spam_reports: Support for fetching admins from authz provider
Matthew Wild <mwild1@gmail.com>
parents:
4657
diff
changeset
|
4 local usermanager = require "core.usermanager"; |
|
4046
d518f97dad6f
mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff
changeset
|
5 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
|
6 |
|
4663
6e5572fc6840
mod_watch_spam_reports: Support for fetching admins from authz provider
Matthew Wild <mwild1@gmail.com>
parents:
4657
diff
changeset
|
7 local admins; |
|
6e5572fc6840
mod_watch_spam_reports: Support for fetching admins from authz provider
Matthew Wild <mwild1@gmail.com>
parents:
4657
diff
changeset
|
8 if usermanager.get_jids_with_role then |
|
5022
97d34d520cfa
mod_watch_spam_reports: Fix traceback due to misplaced parenthesis (thanks Menel)
Kim Alvefur <zash@zash.se>
parents:
4663
diff
changeset
|
9 admins = set.new(usermanager.get_jids_with_role("prosody:admin", host)); |
|
4663
6e5572fc6840
mod_watch_spam_reports: Support for fetching admins from authz provider
Matthew Wild <mwild1@gmail.com>
parents:
4657
diff
changeset
|
10 else -- COMPAT w/pre-0.12 |
|
6e5572fc6840
mod_watch_spam_reports: Support for fetching admins from authz provider
Matthew Wild <mwild1@gmail.com>
parents:
4657
diff
changeset
|
11 admins = module:get_option_inherited_set("admins"); |
|
6e5572fc6840
mod_watch_spam_reports: Support for fetching admins from authz provider
Matthew Wild <mwild1@gmail.com>
parents:
4657
diff
changeset
|
12 end |
|
6e5572fc6840
mod_watch_spam_reports: Support for fetching admins from authz provider
Matthew Wild <mwild1@gmail.com>
parents:
4657
diff
changeset
|
13 |
|
4046
d518f97dad6f
mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff
changeset
|
14 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
|
15 |
|
d518f97dad6f
mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff
changeset
|
16 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
|
17 local reporter_bare_jid = jid.bare(event.stanza.attr.from) |
|
4657
78ef5d9e2361
mod_watch_spam_reports: Prepare for changing 'reason' to an optional value
Kim Alvefur <zash@zash.se>
parents:
4611
diff
changeset
|
18 local report = reporter_bare_jid.." reported spam from "..event.jid..": "..(event.reason or "no reason given") |
|
4046
d518f97dad6f
mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff
changeset
|
19 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
|
20 do |
|
d518f97dad6f
mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff
changeset
|
21 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
|
22 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
|
23 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
|
24 end |
|
d518f97dad6f
mod_watch_spam_reports: Module to notify admins about incoming XEP-0377 spam reports
Martin Dosch <martin@mdosch.de>
parents:
diff
changeset
|
25 end) |
|
4611
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
26 |
|
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
27 module:hook("spam_reporting/abuse-report", function(event) |
|
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
28 local reporter_bare_jid = jid.bare(event.stanza.attr.from) |
|
4657
78ef5d9e2361
mod_watch_spam_reports: Prepare for changing 'reason' to an optional value
Kim Alvefur <zash@zash.se>
parents:
4611
diff
changeset
|
29 local report = reporter_bare_jid.." reported abuse from "..event.jid..": "..(event.reason or "no reason given") |
|
4611
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
30 for admin_jid in admins |
|
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
31 do |
|
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
32 module:send(st.message({from=host, |
|
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
33 type="chat",to=admin_jid}, |
|
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
34 report)); |
|
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
35 end |
|
7a9e1c81c63e
mod_watch_spam_reports: Support spam_reporting/abuse-report
Martin Dosch <martin@mdosch.de>
parents:
4061
diff
changeset
|
36 end) |
