# HG changeset patch # User Matthew Wild # Date 1533850818 -3600 # Node ID c22b6283d2268283b9c793d253d11b1e3265ecca # Parent b98c7c33550eb05bc132bbd5256e5a8d1e7508d7 mod_pep_vcard_png_avatar: Log error when used with new mod_pep, add compat with mod_pep_simple diff -r b98c7c33550e -r c22b6283d226 mod_pep_vcard_png_avatar/mod_pep_vcard_png_avatar.lua --- a/mod_pep_vcard_png_avatar/mod_pep_vcard_png_avatar.lua Thu Aug 09 22:36:22 2018 +0100 +++ b/mod_pep_vcard_png_avatar/mod_pep_vcard_png_avatar.lua Thu Aug 09 22:40:18 2018 +0100 @@ -12,9 +12,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:add_feature("http://prosody.im/protocol/vcard-pep-integration"); module:depends"vcard"; local vcard_storage = module:open_store("vcard");