annotate mod_watch_spam_reports/mod_watch_spam_reports.lua @ 6258:06fbbd45ba75

mod_cloud_notify: Readme: fix links and labels that were removed in the last commit diff --git a/mod_cloud_notify/README.md b/mod_cloud_notify/README.md --- a/mod_cloud_notify/README.md +++ b/mod_cloud_notify/README.md @@ -1,3 +1,9 @@ +---- +-labels: +-- 'Stage-Beta' +-summary: 'XEP-0357: Cloud push notifications' +---- + # Introduction This module enables support for sending "push notifications" to clients @@ -32,15 +38,15 @@ notification to your device. When your d it will display it or wake up the app so it can connect to XMPP and receive any pending messages. -This protocol is described for developers in \[XEP-0357: Push -Notifications\]. +This protocol is described for developers in [XEP-0357: Push +Notifications]. -For this module to work reliably, you must have \[mod_smacks\], -\[mod_mam\] and \[mod_carbons\] also enabled on your server. +For this module to work reliably, you must have [mod_smacks], +[mod_mam] and [mod_carbons] also enabled on your server. Some clients, notably Siskin and Snikket iOS need some additional extensions that are not currently defined in a standard XEP. To support -these clients, see \[mod_cloud_notify_extensions\]. +these clients, see [mod_cloud_notify_extensions]. # Configuration @@ -58,18 +64,18 @@ these clients, see \[mod_cloud_notify_ex # Internal design notes App servers are notified about offline messages, messages stored by -\[mod_mam\] or messages waiting in the smacks queue. The business rules +[mod_mam] or messages waiting in the smacks queue. The business rules outlined [here](//mail.jabber.org/pipermail/standards/2016-February/030925.html) are all honored[^2]. -To cooperate with \[mod_smacks\] this module consumes some events: +To cooperate with [mod_smacks] this module consumes some events: `smacks-ack-delayed`, `smacks-hibernation-start` and `smacks-hibernation-end`. These events allow this module to send out notifications for messages received while the session is hibernated by -\[mod_smacks\] or even when smacks acknowledgements for messages are +[mod_smacks] or even when smacks acknowledgements for messages are delayed by a certain amount of seconds configurable with the -\[mod_smacks\] setting `smacks_max_ack_delay`. +[mod_smacks] setting `smacks_max_ack_delay`. The `smacks_max_ack_delay` setting allows to send out notifications to clients which aren't already in smacks hibernation state (because the
author Menel <menel@snikket.de>
date Fri, 13 Jun 2025 10:44:37 +0200
parents 97d34d520cfa
children
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";
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)