aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_mam
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-09-19 23:38:08 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-09-19 23:38:08 +0200
commitf1180275589adb35c13652ba60deedc5b5c83b06 (patch)
treeed6b67be9926cc0bd023562be24fd98043ab1bcf /plugins/mod_mam
parent59d5cc9beb139b744d4fe114f853fbcc877ee3ea (diff)
downloadprosody-f1180275589adb35c13652ba60deedc5b5c83b06.tar.gz
prosody-f1180275589adb35c13652ba60deedc5b5c83b06.zip
mod_mam: Also return the preferences on set
Fixes #995.
Diffstat (limited to 'plugins/mod_mam')
-rw-r--r--plugins/mod_mam/mod_mam.lua12
1 files changed, 5 insertions, 7 deletions
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);