Mercurial > prosody-modules
annotate mod_muc_mam_markers/mod_muc_mam_markers.lua @ 5640:f193e7db325b
mod_bidi: Fix README again
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 27 Aug 2023 15:31:46 +0200 |
parents | a1fc677d0cc8 |
children |
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"); |