aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_mam
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-02-20 01:26:48 +0100
committerKim Alvefur <zash@zash.se>2017-02-20 01:26:48 +0100
commit2a767fee411984dbf1bbc8d845404d73db0234d7 (patch)
tree4a5f2ecef2407eac1e928d1e5cbc282cfcb08d5b /plugins/mod_mam
parent45295a38d8ff09e522b50e476256e1ff2b6dd101 (diff)
downloadprosody-2a767fee411984dbf1bbc8d845404d73db0234d7.tar.gz
prosody-2a767fee411984dbf1bbc8d845404d73db0234d7.zip
mod_mam: Fix to treat first return value from archive:append as assigned ID
Diffstat (limited to 'plugins/mod_mam')
-rw-r--r--plugins/mod_mam/mod_mam.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index 1b935e0e..6e6d6383 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -291,8 +291,9 @@ local function message_handler(event, c2s)
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 });