annotate mod_muc_mam_markers/mod_muc_mam_markers.lua @ 4542:fb4a50bf60f1

mod_prometheus: Invoke stats collection if in 'manual' mode Since 10d13e0554f9 a special value for statistics_interval "manual" exists, where a module is expected to invoke processing in connection to collection of stats. This makes internal collection and exporting to Prometheus happens at the same time with no chance of timers getting out of sync.
author Kim Alvefur <zash@zash.se>
date Tue, 13 Apr 2021 23:53:53 +0200
parents a1fc677d0cc8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3499
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
1 -- mod_muc_mam_markers
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
2 --
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
3 -- Copyright (C) 2019 Marcos de Vera Piquero <marcos.devera@quobis.com>
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
4 --
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
5 -- This file is MIT/X11 licensed.
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
6 --
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
7 -- A module to make chat markers get stored in the MUC archives
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
8 --
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
9
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
10 module:depends"muc_mam"
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
11
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
12 local function handle_muc_message (event)
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
13 local stanza = event.stanza;
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
14 local is_received = stanza:get_child("received", "urn:xmpp:chat-markers:0");
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
15 local is_displayed = stanza:get_child("displayed", "urn:xmpp:chat-markers:0");
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
16 local is_acked = stanza:get_child("acknowledged", "urn:xmpp:chat-markers:0");
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
17 if (is_received or is_displayed or is_acked) then
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
18 return true;
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
19 end
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
20 return nil;
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
21 end
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
22
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
23 module:hook("muc-message-is-historic", handle_muc_message);
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
24
a1fc677d0cc8 muc_mam_markers: store chat markers in the Group Chat archives
marc0s <marcos.devera@quobis.com>
parents:
diff changeset
25 module:log("debug", "Module loaded");