Software /
code /
prosody-modules
Annotate
mod_offline_hints/mod_offline_hints.lua @ 5483:f9cecbd03e11
mod_invites_adhoc: Fall back to generic allow_user_invites for role-less users
Fixes #1752
Backport of Prosody rev dc0c20753d6c
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 18 May 2023 18:15:50 +0200 |
parent | 3500:e86315c9b5c4 |
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"); |