Diff

plugins/mod_mam/mod_mam.lua @ 8538:3eb4cafb3b64

mod_mam: Implement option to enable MAM implicitly when client support is detected (#867)
author Kim Alvefur <zash@zash.se>
date Wed, 21 Feb 2018 21:02:16 +0100
parent 8252:63e505578d4f
child 8575:5040c8ce32dd
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua	Sun Feb 04 01:17:22 2018 +0100
+++ b/plugins/mod_mam/mod_mam.lua	Wed Feb 21 21:02:16 2018 +0100
@@ -76,7 +76,7 @@
 			return true;
 		end
 	end
-	local prefs = prefs_to_stanza(get_prefs(user));
+	local prefs = prefs_to_stanza(get_prefs(user, true));
 	local reply = st.reply(stanza):add_child(prefs);
 	origin.send(reply);
 	return true;
@@ -92,6 +92,7 @@
 -- Serve form
 module:hook("iq-get/self/"..xmlns_mam..":query", function(event)
 	local origin, stanza = event.origin, event.stanza;
+	get_prefs(origin.username, true);
 	origin.send(st.reply(stanza):query(xmlns_mam):add_child(query_form:form()));
 	return true;
 end);
@@ -102,6 +103,7 @@
 	local query = stanza.tags[1];
 	local qid = query.attr.queryid;
 
+	get_prefs(origin.username, true);
 	schedule_cleanup(origin.username);
 
 	-- Search query parameters