Software /
code /
prosody-modules
Annotate
mod_offline_hints/mod_offline_hints.lua @ 4301:bcb2b9adfcde
mod_muc_http_auth: Use get_option_set API properly
author | Seve Ferrer <seve@delape.net> |
---|---|
date | Tue, 15 Dec 2020 14:16:11 +0100 |
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"); |