changeset 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 2969ed764fe8
files mod_omemo_all_access/mod_omemo_all_access.lua
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_omemo_all_access/mod_omemo_all_access.lua	Fri Aug 03 11:24:36 2018 +0100
+++ b/mod_omemo_all_access/mod_omemo_all_access.lua	Fri Aug 03 11:33:31 2018 +0100
@@ -9,11 +9,25 @@
 local white_listed_namespace = "eu.siacs.conversations.axolotl."
 local disco_feature_namespace = white_listed_namespace .. "whitelisted"
 
-local mod_pep = module:depends"pep";
+local mm = require "core.modulemanager";
+
+
+-- COMPAT w/trunk
+local pep_module_name = "pep";
+if mm.get_modules_for_host then
+	if mm.get_modules_for_host(module.host):contains("pep_simple") then
+		pep_module_name = "pep_simple";
+	end
+end
+
+local mod_pep = module:depends(pep_module_name);
 local pep_data = mod_pep.module.save().data;
 
 if not pep_data then
 	module:log("error", "This module is not compatible with your version of mod_pep");
+	if mm.get_modules_for_host then
+		module:log("error", "Please use mod_pep_simple instead of mod_pep to continue using this module");
+	end
 	return false;
 end