Comparison

plugins/mod_mam/mod_mam.lua @ 8000:42dd766cfe97

mod_mam: Remove dead code (default will be filled in by mamprefs.lib)
author Kim Alvefur <zash@zash.se>
date Thu, 23 Mar 2017 14:45:18 +0100
parent 7979:a1e88642411d
child 8047:eb9784561387
comparison
equal deleted inserted replaced
7998:604beb13596a 8000:42dd766cfe97
33 local tostring = tostring; 33 local tostring = tostring;
34 local time_now = os.time; 34 local time_now = os.time;
35 local m_min = math.min; 35 local m_min = math.min;
36 local timestamp, timestamp_parse = require "util.datetime".datetime, require "util.datetime".parse; 36 local timestamp, timestamp_parse = require "util.datetime".datetime, require "util.datetime".parse;
37 local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50); 37 local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50);
38 local global_default_policy = module:get_option_string("default_archive_policy", true);
39 if global_default_policy ~= "roster" then
40 global_default_policy = module:get_option_boolean("default_archive_policy", global_default_policy);
41 end
42 local strip_tags = module:get_option_set("dont_archive_namespaces", { "http://jabber.org/protocol/chatstates" }); 38 local strip_tags = module:get_option_set("dont_archive_namespaces", { "http://jabber.org/protocol/chatstates" });
43 39
44 local archive_store = module:get_option_string("archive_store", "archive"); 40 local archive_store = module:get_option_string("archive_store", "archive");
45 local archive = assert(module:open_store(archive_store, "archive")); 41 local archive = assert(module:open_store(archive_store, "archive"));
46 42
220 return rule; 216 return rule;
221 end 217 end
222 -- Below could be done by a metatable 218 -- Below could be done by a metatable
223 local default = prefs[false]; 219 local default = prefs[false];
224 module:log("debug", "%s's default rule is %s", user, tostring(default)); 220 module:log("debug", "%s's default rule is %s", user, tostring(default));
225 if default == nil then
226 default = global_default_policy;
227 module:log("debug", "Using global default rule, %s", tostring(default));
228 end
229 if default == "roster" then 221 if default == "roster" then
230 return has_in_roster(user, who); 222 return has_in_roster(user, who);
231 end 223 end
232 return default; 224 return default;
233 end 225 end