annotate mod_offline_hints/mod_offline_hints.lua @ 5256:44f7edd4f845

mod_http_oauth2: Reject non-local hosts in more code paths We're not issuing tokens for users on remote hosts, we can't even authenticate them since they're remote. Thus the host is always the local module.host so no need to pass around the host in most cases or use it for anything but enforcing the same host.
author Kim Alvefur <zash@zash.se>
date Thu, 16 Mar 2023 17:52:10 +0100
parents e86315c9b5c4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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");