# HG changeset patch # User Kim Alvefur # Date 1587922718 -7200 # Node ID 1641e33f1d3642a0cd42f5f52ef466e8e5484ace # Parent 207691ad98fe7e7a765a2ca04a9adde7dd3f093b 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. diff -r 207691ad98fe -r 1641e33f1d36 plugins/muc/history.lib.lua --- a/plugins/muc/history.lib.lua Sun Apr 26 14:31:43 2020 +0200 +++ b/plugins/muc/history.lib.lua Sun Apr 26 19:38:38 2020 +0200 @@ -200,7 +200,27 @@ 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 {