Diff

plugins/mod_mam/mod_mam.lua @ 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
parent 7906:aa6b036150eb
child 7979:a1e88642411d
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 });