comparison mod_pep_vcard_png_avatar/mod_pep_vcard_png_avatar.lua @ 3222:c22b6283d226

mod_pep_vcard_png_avatar: Log error when used with new mod_pep, add compat with mod_pep_simple
author Matthew Wild <mwild1@gmail.com>
date Thu, 09 Aug 2018 22:40:18 +0100
parents e6a3bdbce7b9
children
comparison
equal deleted inserted replaced
3221:b98c7c33550e 3222:c22b6283d226
10 local st = require "util.stanza" 10 local st = require "util.stanza"
11 local jid = require "util.jid"; 11 local jid = require "util.jid";
12 local base64 = require"util.encodings".base64; 12 local base64 = require"util.encodings".base64;
13 local sha1 = require"util.hashes".sha1; 13 local sha1 = require"util.hashes".sha1;
14 14
15 local mod_pep = module:depends"pep"; 15 local mm = require "core.modulemanager";
16
17 -- COMPAT w/trunk
18 local pep_module_name = "pep";
19 if mm.get_modules_for_host then
20 if mm.get_modules_for_host(module.host):contains("pep_simple") then
21 pep_module_name = "pep_simple";
22 end
23 end
24
25 local mod_pep = module:depends(pep_module_name);
16 local pep_data = mod_pep.module.save().data; 26 local pep_data = mod_pep.module.save().data;
27
28 if not pep_data then
29 module:log("error", "This module is not compatible with your version of mod_pep");
30 if mm.get_modules_for_host then
31 module:log("error", "Please use mod_pep_simple instead of mod_pep to continue using this module");
32 end
33 return false;
34 end
17 35
18 module:add_feature("http://prosody.im/protocol/vcard-pep-integration"); 36 module:add_feature("http://prosody.im/protocol/vcard-pep-integration");
19 module:depends"vcard"; 37 module:depends"vcard";
20 local vcard_storage = module:open_store("vcard"); 38 local vcard_storage = module:open_store("vcard");
21 39