annotate mod_muc_mam_markers/mod_muc_mam_markers.lua @ 3943:f5e6368a1c39

mod_cloud_notify: Cleanup code and drop support for prosody 0.9 This removes some legacy stuff that was needed for prosody 0.9 We now use util.stanza:find instead of our own patched version to be more mainstream The unneeded module unloading code was removed, too
author tmolitor <thilo@eightysoft.de>
date Wed, 11 Mar 2020 20:00:50 +0100
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");