comparison mod_omemo_all_access/mod_omemo_all_access.lua @ 3210:9505282ad24f

mod_omemo_all_access: Add compatibility with mod_pep_simple
author Matthew Wild <mwild1@gmail.com>
date Fri, 03 Aug 2018 11:33:31 +0100
parents 5b02241a254e
children
comparison
equal deleted inserted replaced
3209:5b02241a254e 3210:9505282ad24f
7 local jid_bare = require "util.jid".bare; 7 local jid_bare = require "util.jid".bare;
8 local st = require "util.stanza" 8 local st = require "util.stanza"
9 local white_listed_namespace = "eu.siacs.conversations.axolotl." 9 local white_listed_namespace = "eu.siacs.conversations.axolotl."
10 local disco_feature_namespace = white_listed_namespace .. "whitelisted" 10 local disco_feature_namespace = white_listed_namespace .. "whitelisted"
11 11
12 local mod_pep = module:depends"pep"; 12 local mm = require "core.modulemanager";
13
14
15 -- COMPAT w/trunk
16 local pep_module_name = "pep";
17 if mm.get_modules_for_host then
18 if mm.get_modules_for_host(module.host):contains("pep_simple") then
19 pep_module_name = "pep_simple";
20 end
21 end
22
23 local mod_pep = module:depends(pep_module_name);
13 local pep_data = mod_pep.module.save().data; 24 local pep_data = mod_pep.module.save().data;
14 25
15 if not pep_data then 26 if not pep_data then
16 module:log("error", "This module is not compatible with your version of mod_pep"); 27 module:log("error", "This module is not compatible with your version of mod_pep");
28 if mm.get_modules_for_host then
29 module:log("error", "Please use mod_pep_simple instead of mod_pep to continue using this module");
30 end
17 return false; 31 return false;
18 end 32 end
19 33
20 local function on_account_disco_info(event) 34 local function on_account_disco_info(event)
21 (event.reply or event.stanza):tag("feature", {var=disco_feature_namespace}):up(); 35 (event.reply or event.stanza):tag("feature", {var=disco_feature_namespace}):up();