Annotate

mod_reload_components/mod_reload_components.lua @ 6302: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
parent 2391:85d04dd87f14
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2391
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
1 module:set_global();
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
2
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
3 local configmanager = require "core.configmanager";
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
4 local hostmanager = require"core.hostmanager";
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
5
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
6 local function reload_components()
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
7
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
8 --- Check if host configuration is a component
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
9 --- @param h hostname
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
10 local function config_is_component(h)
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
11 return h ~= nil and configmanager.get(h, "component_module") ~= nil; -- If a host has a component module defined within it, then it is a component
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
12 end;
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
13
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
14 --- Check if host / component configuration is active
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
15 --- @param h hostname / component name
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
16 local function component_is_new(h)
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
17 return h ~= "*" and not hosts[h]; -- If a host is not defined in hosts and it is not global, then it is new
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
18 end
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
19
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
20 --- Search for new components that are not activated
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
21 for h, c in pairs(configmanager.getconfig()) do
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
22 if config_is_component(h) and component_is_new(h) then
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
23 module:log ("debug", "Loading new component %s", h );
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
24 hostmanager.activate(h, c);
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
25 end
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
26 end
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
27
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
28 --- Search for active components that are not enabled in the configmanager anymore
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
29 local enabled = {}
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
30 for h in pairs(configmanager.getconfig()) do
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
31 enabled[h] = true; -- Set true if it is defined in the configuration file
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
32 end
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
33 for h, c in pairs(hosts) do
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
34 if not enabled[h] then -- Deactivate if not present in the configuration file
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
35 hostmanager.deactivate(h,c);
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
36 end
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
37 end
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
38 end
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
39
85d04dd87f14 mod_reload_components: add new module and README file.
Camilo <camilo@camilo.fm>
parents:
diff changeset
40 module:hook("config-reloaded", reload_components);