changeset 672:8ae5317ba032

mod_mam: local tostring and some comments
author Kim Alvefur <zash@zash.se>
date Thu, 24 May 2012 22:37:14 +0200
parents 74efb2db00a6
children 9dcf98018644
files mod_mam/mod_mam.lua
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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