Mercurial > prosody-hg
comparison 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 |
| parents | aa6b036150eb |
| children | a1e88642411d |
comparison
equal
deleted
inserted
replaced
| 7907:8e2446cdf6fa | 7908:dbdaa8487ecd |
|---|---|
| 289 -- Check with the users preferences | 289 -- Check with the users preferences |
| 290 if shall_store(store_user, with) then | 290 if shall_store(store_user, with) then |
| 291 log("debug", "Archiving stanza: %s", stanza:top_tag()); | 291 log("debug", "Archiving stanza: %s", stanza:top_tag()); |
| 292 | 292 |
| 293 -- And stash it | 293 -- And stash it |
| 294 local ok, id = archive:append(store_user, nil, stanza, time_now(), with); | 294 local ok = archive:append(store_user, nil, stanza, time_now(), with); |
| 295 if ok then | 295 if ok then |
| 296 local id = ok; | |
| 296 stanza:tag("stanza-id", { xmlns = xmlns_st_id, by = store_user.."@"..host, id = id }):up(); | 297 stanza:tag("stanza-id", { xmlns = xmlns_st_id, by = store_user.."@"..host, id = id }):up(); |
| 297 if cleanup then cleanup[store_user] = true; end | 298 if cleanup then cleanup[store_user] = true; end |
| 298 module:fire_event("archive-message-added", { origin = origin, stanza = stanza, for_user = store_user, id = id }); | 299 module:fire_event("archive-message-added", { origin = origin, stanza = stanza, for_user = store_user, id = id }); |
| 299 end | 300 end |
| 300 else | 301 else |
