# HG changeset patch # User Kim Alvefur # Date 1376256238 -7200 # Node ID 296820f18ba610370f1041e7161e0eb4d86c487c # Parent d055c44a7f615993c768314f7e82da4a671f5b48 mod_mam: Add support for XEP-0334: Message Processing Hints diff -r d055c44a7f61 -r 296820f18ba6 mod_mam/mod_mam.lua --- a/mod_mam/mod_mam.lua Sun Aug 11 23:19:35 2013 +0200 +++ b/mod_mam/mod_mam.lua Sun Aug 11 23:23:58 2013 +0200 @@ -180,11 +180,16 @@ local orig_to = stanza.attr.to or orig_from; -- Stanza without 'to' are treated as if it was to their own bare jid - -- Don't store messages of these types + -- We don't store messages of these types if orig_type == "error" or orig_type == "headline" or orig_type == "groupchat" - or not stanza:get_child("body") then + -- or that don't have a + or not stanza:get_child("body") + -- or if hints suggest we shouldn't + or stanza:get_child("no-permanent-store", "urn:xmpp:hints") + or stanza:get_child("no-store", "urn:xmpp:hints") then + module:log("debug", "Not archiving stanza: %s (content)", stanza:top_tag()); return; end @@ -203,7 +208,7 @@ stanza:tag("archived", { xmlns = xmlns_mam, by = store_user.."@"..host, id = id }):up(); end else - module:log("debug", "Not archiving stanza: %s", stanza:top_tag()); + module:log("debug", "Not archiving stanza: %s (prefs)", stanza:top_tag()); end end