# HG changeset patch # User Kim Alvefur # Date 1373729456 -7200 # Node ID 91d210b6106ad655b5e62199a84f6e78d09caf8c # Parent 6c0e1f9926f642cd364ad91327521e3698c42e07 mod_mam_adhoc: Use mod_mam/mamprefs.lib diff -r 6c0e1f9926f6 -r 91d210b6106a mod_mam_adhoc/mod_mam_adhoc.lua --- 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