Software /
code /
prosody-modules
Annotate
mod_muc_mam_hints/mod_muc_mam_hints.lua @ 5941:5c4e102e2563 default tip
mod_pubsub_serverinfo: fix bool logic when reading config
author | Guus der Kinderen <guus.der.kinderen@gmail.com> |
---|---|
date | Mon, 03 Jun 2024 12:52:26 +0200 |
parent | 3463:2aaf93d2b219 |
rev | line source |
---|---|
3463
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
1 -- |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
2 -- A module to indicate if a MUC message qualifies as historic based on XEP-0334 hints |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
3 -- |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
4 |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
5 module:depends"muc_mam" |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
6 |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
7 module:log("debug", "Module loaded"); |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
8 |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
9 module:hook("muc-message-is-historic", function (event) |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
10 if (event.stanza:get_child("no-store", "urn:xmpp:hints") or |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
11 event.stanza:get_child("no-permanent-store", "urn:xmpp:hints")) then |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
12 module:log("debug", "Not archiving stanza: %s (urn:xmpp:hints)", event.stanza) |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
13 return false |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
14 elseif event.stanza:get_child("store", "urn:xmpp:hints") then |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
15 return true |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
16 else |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
17 return nil |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
18 end |
2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
marc0s <marcos@tenak.net>
parents:
diff
changeset
|
19 end) |