Changeset

7908:dbdaa8487ecd

mod_mam: Fix to treat first return value from archive:append as assigned ID
author Kim Alvefur <zash@zash.se>
date Mon, 20 Feb 2017 01:26:48 +0100
parents 7907:8e2446cdf6fa
children 7909:428d4abee723 7911:e528d848a185
files plugins/mod_mam/mod_mam.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua	Mon Feb 20 01:26:03 2017 +0100
+++ b/plugins/mod_mam/mod_mam.lua	Mon Feb 20 01:26:48 2017 +0100
@@ -291,8 +291,9 @@
 		log("debug", "Archiving stanza: %s", stanza:top_tag());
 
 		-- And stash it
-		local ok, id = archive:append(store_user, nil, stanza, time_now(), with);
+		local ok = archive:append(store_user, nil, stanza, time_now(), with);
 		if ok then
+			local id = ok;
 			stanza:tag("stanza-id", { xmlns = xmlns_st_id, by = store_user.."@"..host, id = id }):up();
 			if cleanup then cleanup[store_user] = true; end
 			module:fire_event("archive-message-added", { origin = origin, stanza = stanza, for_user = store_user, id = id });