Changeset

7979:a1e88642411d

mod_mam: Handle default_archive_policy option consistently
author Kim Alvefur <zash@zash.se>
date Thu, 16 Mar 2017 21:01:45 +0100
parents 7978:01aa6344a556
children 7980:241f02bd66ce
files plugins/mod_mam/mamprefs.lib.lua plugins/mod_mam/mod_mam.lua
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_mam/mamprefs.lib.lua	Thu Mar 16 20:53:08 2017 +0100
+++ b/plugins/mod_mam/mamprefs.lib.lua	Thu Mar 16 21:01:45 2017 +0100
@@ -10,7 +10,10 @@
 --
 -- luacheck: ignore 122/prosody
 
-local global_default_policy = module:get_option("default_archive_policy", true);
+local global_default_policy = module:get_option_string("default_archive_policy", true);
+if global_default_policy ~= "roster" then
+	global_default_policy = module:get_option_boolean("default_archive_policy", global_default_policy);
+end
 
 do
 	-- luacheck: ignore 211/prefs_format
--- a/plugins/mod_mam/mod_mam.lua	Thu Mar 16 20:53:08 2017 +0100
+++ b/plugins/mod_mam/mod_mam.lua	Thu Mar 16 21:01:45 2017 +0100
@@ -35,7 +35,7 @@
 local m_min = math.min;
 local timestamp, timestamp_parse = require "util.datetime".datetime, require "util.datetime".parse;
 local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50);
-local global_default_policy = module:get_option("default_archive_policy", true);
+local global_default_policy = module:get_option_string("default_archive_policy", true);
 if global_default_policy ~= "roster" then
 	global_default_policy = module:get_option_boolean("default_archive_policy", global_default_policy);
 end