mod_omemo_all_access: Add compatibility with mod_pep_simple
authorMatthew Wild <mwild1@gmail.com>
Fri, 03 Aug 2018 11:33:31 +0100
changeset 3214 9505282ad24f
parent 3213 5b02241a254e
child 3215 2969ed764fe8
mod_omemo_all_access: Add compatibility with mod_pep_simple
mod_omemo_all_access/mod_omemo_all_access.lua
--- 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