Software /
code /
prosody-modules
Annotate
mod_muc_mam_hints/mod_muc_mam_hints.lua @ 3463:2aaf93d2b219
mod_muc_mam_hints: Respect XEP-0334 hints in MUC messages
Hook muc-message-is-historic and check if Message Processing
Hints are present to compute the return value.
author | marc0s <marcos@tenak.net> |
---|---|
date | Wed, 13 Feb 2019 15:52:58 +0100 |
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) |