Diff

mod_mam/mod_mam.lua @ 675:da33325453fb

mod_mam: Put name of store in a single variable
author Kim Alvefur <zash@zash.se>
date Thu, 24 May 2012 23:52:36 +0200
parent 674:699187d18f11
child 701:cc5805f83583
line wrap: on
line diff
--- a/mod_mam/mod_mam.lua	Thu May 24 23:02:46 2012 +0200
+++ b/mod_mam/mod_mam.lua	Thu May 24 23:52:36 2012 +0200
@@ -42,7 +42,8 @@
 	};
 end
 
-local prefs_store = "archive2_prefs";
+local archive_store = "archive2";
+local prefs_store = archive_store .. "_prefs";
 local function get_prefs(user)
 	return dm_load(user, host, prefs_store) or
 		{ [false] = global_default_policy };
@@ -124,7 +125,7 @@
 		qstart, qend = (qstart and timestamp_parse(qstart)), (qend and timestamp_parse(qend))
 
 		-- Load all the data!
-		local data, err = dm_list_load(origin.username, origin.host, "archive2");
+		local data, err = dm_list_load(origin.username, origin.host, archive_store);
 		if not data then
 			if (not err) then
 				module:log("debug", "The archive was empty.");
@@ -228,7 +229,7 @@
 		local id = uuid();
 		local when = time_now();
 		-- And stash it
-		local ok, err = dm_list_append(store_user, store_host, "archive2", {
+		local ok, err = dm_list_append(store_user, store_host, archive_store, {
 			-- WARNING This format may change.
 			id = id,
 			when = when, -- This might be an UNIX timestamp. Probably.