Software /
code /
prosody-modules
Annotate
mod_muc_mam_hints/mod_muc_mam_hints.lua @ 5763:100110d539d3
mod_storage_xmlarchive: Migrate all users/rooms if no JID argument given
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 28 Nov 2023 19:48:34 +0100 |
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) |