Mercurial > prosody-modules
annotate mod_offline_hints/mod_offline_hints.lua @ 5801:73887dcb2129
mod_pubsub_serverinfo: New module that uses pub/sub to make accessible server info
This first implemetnation is laughably simple: it only adds a disco#info
feature. This flags 'opt-in' for inclusion of local domain names in the
data exposed by other domains (per the domain), which will allow servers to
be listed in the XMPP Network Graph at https://xmppnetwork.goodbytes.im
Hopefully, this bare-boned implementation acts as a stepping stone for
future improvements.
author | Guus der Kinderen <guus.der.kinderen@gmail.com> |
---|---|
date | Thu, 28 Dec 2023 11:02:35 +0100 |
parents | e86315c9b5c4 |
children |
rev | line source |
---|---|
3500
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
1 -- mod_offline_hints |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
2 -- |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
3 -- Copyright (C) 2019 Marcos de Vera Piquero <marcos.devera@quobis.com> |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
4 -- |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
5 -- This file is MIT/X11 licensed. |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
6 -- |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
7 -- A module to discard hinted messages with no-store at mod_offline |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
8 -- |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
9 |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
10 module:depends"offline"; |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
11 |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
12 local function handle_offline (event) |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
13 local stanza = event.stanza; |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
14 if (stanza:get_child("no-store", "urn:xmpp:hints") or |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
15 stanza:get_child("no-permanent-store", "urn:xmpp:hints")) then |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
16 module:log("debug", "Not storing offline stanza: %s (urn:xmpp:hints)", stanza); |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
17 return false; |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
18 end |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
19 return nil; |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
20 end |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
21 |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
22 module:hook("message/offline/handle", handle_offline); |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
23 |
e86315c9b5c4
offline_hints: discard no-store hinted messages at mod_offline
marc0s <marcos.devera@quobis.com>
parents:
diff
changeset
|
24 module:log("debug", "Module loaded"); |