mod_pep_vcard_avatar: Log error when used with new mod_pep, add compat with mod_pep_simple
--- a/mod_pep_vcard_avatar/mod_pep_vcard_avatar.lua Wed Aug 08 15:58:50 2018 +0200
+++ b/mod_pep_vcard_avatar/mod_pep_vcard_avatar.lua Thu Aug 09 22:36:22 2018 +0100
@@ -13,9 +13,27 @@
local base64 = require"util.encodings".base64;
local sha1 = require"util.hashes".sha1;
-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
+
module:hook("account-disco-info", function (event)
event.reply:tag("feature", { var = "urn:xmpp:pep-vcard-conversion:0" }):up();
end);