changeset 1115:91d210b6106a

mod_mam_adhoc: Use mod_mam/mamprefs.lib
author Kim Alvefur <zash@zash.se>
date Sat, 13 Jul 2013 17:30:56 +0200
parents 6c0e1f9926f6
children 2345a30dd8b4
files mod_mam_adhoc/mod_mam_adhoc.lua
diffstat 1 files changed, 2 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam_adhoc/mod_mam_adhoc.lua	Sat Jul 13 17:00:13 2013 +0200
+++ b/mod_mam_adhoc/mod_mam_adhoc.lua	Sat Jul 13 17:30:56 2013 +0200
@@ -1,9 +1,9 @@
 module:depends"adhoc";
 local dataforms_new = require "util.dataforms".new;
-local dm_load = require "util.datamanager".load;
-local dm_store = require "util.datamanager".store;
 local jid_split = require "util.jid".split;
 local t_insert = table.insert;
+local prefs = module:require"mod_mam/mamprefs";
+local set_prefs, get_prefs = prefs.set, prefs.get;
 
 local mam_prefs_form = dataforms_new{
 	title = "Archive preferences";
@@ -38,17 +38,6 @@
 	roster = "roster",
 }
 
-local global_default_policy = module:get_option("default_archive_policy", false);
-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 };
-end
-local function set_prefs(user, prefs)
-	return dm_store(user, host, prefs_store, prefs);
-end
-
 local function mam_prefs_handler(self, data, state)
 	local username, hostname = jid_split(data.from);
 	if state then -- the second return value