# HG changeset patch # User Kim Alvefur # Date 1337891834 -7200 # Node ID 8ae5317ba03226558f0db2caf00d016c73933a6c # Parent 74efb2db00a681541a58e1b12319157d02472bd7 mod_mam: local tostring and some comments diff -r 74efb2db00a6 -r 8ae5317ba032 mod_mam/mod_mam.lua --- a/mod_mam/mod_mam.lua Thu May 24 22:29:17 2012 +0200 +++ b/mod_mam/mod_mam.lua Thu May 24 22:37:14 2012 +0200 @@ -19,12 +19,14 @@ local dm_list_append = require "util.datamanager".list_append; local rm_load_roster = require "core.rostermanager".load_roster; +local tostring = tostring; local time_now = os.time; local timestamp, timestamp_parse = require "util.datetime".datetime, require "util.datetime".parse; local uuid = require "util.uuid".generate; local global_default_policy = module:get_option("default_archive_policy", false); -- TODO Should be possible to enforce it too +-- For translating preference names from string to boolean and back local default_attrs = { always = true, [true] = "always", never = false, [false] = "never", @@ -225,7 +227,7 @@ local id = uuid(); local when = time_now(); -- And stash it - dm_list_append(store_user, store_host, "archive2", { + local ok, err = dm_list_append(store_user, store_host, "archive2", { -- WARNING This format may change. id = id, when = when, -- This might be an UNIX timestamp. Probably. @@ -234,6 +236,11 @@ with_bare = target_bare, -- Optimization, to avoid loads of jid_bare() calls when filtering. stanza = st.preserialize(stanza) }); + --[[ This was dropped from the spec + if ok then + stanza:tag("archived", { xmlns = xmlns_mam, by = host, id = id }):up(); + end + --]] else module:log("debug", "Not archiving stanza: %s", stanza:top_tag()); end