changeset 1136:a6d4508f7f28

mod_mam/mamprefs.lib: Switch to storagemanager API
author Kim Alvefur <zash@zash.se>
date Sat, 10 Aug 2013 20:39:24 +0200
parents 0d6ab5e4bc30
children 431627b07b9f
files mod_mam/mamprefs.lib.lua
diffstat 1 files changed, 5 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam/mamprefs.lib.lua	Sat Aug 10 20:38:25 2013 +0200
+++ b/mod_mam/mamprefs.lib.lua	Sat Aug 10 20:39:24 2013 +0200
@@ -1,13 +1,8 @@
 -- XEP-0313: Message Archive Management for Prosody
--- Copyright (C) 2011-2012 Kim Alvefur
+-- Copyright (C) 2011-2013 Kim Alvefur
 --
 -- This file is MIT/X11 licensed.
 
-local host = module.host;
-
-local dm_load = require "util.datamanager".load;
-local dm_store = require "util.datamanager".store;
-
 local global_default_policy = module:get_option("default_archive_policy", false);
 
 do
@@ -20,13 +15,12 @@
 	};
 end
 
-local prefs_store = "archive2_prefs";
+local prefs = module:open_store("archive2_prefs");
 local function get_prefs(user)
-	return dm_load(user, host, prefs_store) or
-		{ [false] = global_default_policy };
+	return prefs:get(user) or { [false] = global_default_policy };
 end
-local function set_prefs(user, prefs)
-	return dm_store(user, host, prefs_store, prefs);
+local function set_prefs(user, user_prefs)
+	return prefs:set(user, user_prefs);
 end
 
 return {