Mercurial > prosody-modules
comparison mod_mam/mod_mam.lua @ 559:6be3a130c810
mod_mam: Store the message id more accessible.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 15 Jan 2012 20:21:53 +0100 |
parents | 66de25ffc8d9 |
children | cade7dac6159 |
comparison
equal
deleted
inserted
replaced
558:66de25ffc8d9 | 559:6be3a130c810 |
---|---|
220 | 220 |
221 if shall_store(store_user, target_bare) then | 221 if shall_store(store_user, target_bare) then |
222 module:log("debug", "Archiving stanza: %s", stanza:top_tag()); | 222 module:log("debug", "Archiving stanza: %s", stanza:top_tag()); |
223 | 223 |
224 -- Stamp "We archived this" on the message | 224 -- Stamp "We archived this" on the message |
225 stanza:tag("archived", { xmlns = xmlns_mam, by = host, id = uuid() }); | 225 local id = uuid(); |
226 stanza:tag("archived", { xmlns = xmlns_mam, by = host, id = id }); | |
226 | 227 |
227 local when = time_now(); | 228 local when = time_now(); |
228 -- And stash it | 229 -- And stash it |
229 dm_list_append(store_user, store_host, "archive2", { | 230 dm_list_append(store_user, store_host, "archive2", { |
230 -- WARNING This format may change. | 231 -- WARNING This format may change. |
232 id = id, | |
231 when = when, -- This might be an UNIX timestamp. Probably. | 233 when = when, -- This might be an UNIX timestamp. Probably. |
232 timestamp = timestamp(when), -- Textual timestamp. But I'll assume that comparing numbers is faster and less annoying in case of timezones. | 234 timestamp = timestamp(when), -- Textual timestamp. But I'll assume that comparing numbers is faster and less annoying in case of timezones. |
233 with = target_jid, | 235 with = target_jid, |
234 with_bare = target_bare, -- Optimization, to avoid loads of jid_bare() calls when filtering. | 236 with_bare = target_bare, -- Optimization, to avoid loads of jid_bare() calls when filtering. |
235 stanza = st.preserialize(stanza) | 237 stanza = st.preserialize(stanza) |