diff options
author | Kim Alvefur <zash@zash.se> | 2020-04-26 19:38:38 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-04-26 19:38:38 +0200 |
commit | 2853b3ac5db9ecefacbfd575924c8ba663b7e7c2 (patch) | |
tree | a0a304a4b358dc58e3ba2a78b02eb948bb9cc1c6 /plugins | |
parent | 3f78f7638d37ea987beea1f06789582a34ef71d5 (diff) | |
download | prosody-2853b3ac5db9ecefacbfd575924c8ba663b7e7c2.tar.gz prosody-2853b3ac5db9ecefacbfd575924c8ba663b7e7c2.zip |
MUC: Adapt rules for what should be stored from mod_mam
This is the subset of mod_mam rules I believe makes sense in MUC.
Note that mod_muc_mam does not have its own rules, but uses these.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/muc/history.lib.lua | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/muc/history.lib.lua b/plugins/muc/history.lib.lua index f9ddabbf..1b7167af 100644 --- a/plugins/muc/history.lib.lua +++ b/plugins/muc/history.lib.lua @@ -200,7 +200,27 @@ module:hook("muc-broadcast-message", function(event) end); module:hook("muc-message-is-historic", function (event) - return event.stanza:get_child("body"); + local stanza = event.stanza; + if stanza:get_child("no-store", "urn:xmpp:hints") + or stanza:get_child("no-permanent-store", "urn:xmpp:hints") then + -- XXX Experimental XEP + return false, "hint"; + end + if stanza:get_child("store", "urn:xmpp:hints") then + return true, "hint"; + end + if stanza:get_child("body") then + return true; + end + if stanza:get_child("encryption", "urn:xmpp:eme:0") then + -- Since we can't know what an encrypted message contains, we assume it's important + -- XXX Experimental XEP + return true, "encrypted"; + end + if stanza:get_child(nil, "urn:xmpp:chat-markers:0") then + -- XXX Experimental XEP + return true, "marker"; + end end, -1); return { |