From c885ad2cc4b36e61bdc05a0a35bf3918d3809a48 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 18 Sep 2017 18:35:01 +0200 Subject: mod_mam: Log a message when not archiving because it only had ignored tags --- plugins/mod_mam/mod_mam.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins') diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index 298c770c..6134fc66 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -294,6 +294,7 @@ local function message_handler(event, c2s) end end); if #clone_for_storage.tags == 0 then + log("debug", "Not archiving stanza: %s (empty when stripped)", stanza:top_tag()); return; end else -- cgit v1.2.3 From b6c066f717f02a43f9b506c145302c05294101cc Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 19 Sep 2017 23:38:08 +0200 Subject: mod_mam: Also return the preferences on set Fixes #995. --- plugins/mod_mam/mod_mam.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index 6134fc66..7499c9ea 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -67,20 +67,18 @@ end module:hook("iq/self/"..xmlns_mam..":prefs", function(event) local origin, stanza = event.origin, event.stanza; local user = origin.username; - if stanza.attr.type == "get" then - local prefs = prefs_to_stanza(get_prefs(user)); - local reply = st.reply(stanza):add_child(prefs); - origin.send(reply); - else -- type == "set" + if stanza.attr.type == "set" then local new_prefs = stanza:get_child("prefs", xmlns_mam); local prefs = prefs_from_stanza(new_prefs); local ok, err = set_prefs(user, prefs); if not ok then origin.send(st.error_reply(stanza, "cancel", "internal-server-error", "Error storing preferences: "..tostring(err))); - else - origin.send(st.reply(stanza)); + return true; end end + local prefs = prefs_to_stanza(get_prefs(user)); + local reply = st.reply(stanza):add_child(prefs); + origin.send(reply); return true; end); -- cgit v1.2.3