annotate mod_muc_mam_hints/mod_muc_mam_hints.lua @ 4552:c87181a98f29

mod_pubsub_post: Add support for urlencoded form-data This would allow a subset of JSON payloads to be passed easily with simple `curl -d foo=bar -d hello=there` calls.
author Kim Alvefur <zash@zash.se>
date Mon, 26 Apr 2021 02:49:25 +0200
parents 2aaf93d2b219
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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)