Mercurial > prosody-modules
annotate mod_offline_hints/mod_offline_hints.lua @ 4525:b68b801ddc50
mod_rest: Restore 'kind' property in JSON-mapped objects
The datamapper schema has no 'kind' field, instead handling it as a
top-level property of the currently unused <xmpp> element and doing this
early dispatch on the top level element name.
This puts the field back into the output JSON.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 23 Mar 2021 17:44:49 +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"); |