Software /
code /
prosody-modules
Changeset
3221:b98c7c33550e
mod_pep_vcard_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:36:22 +0100 |
parents | 3220:0e78523f8c20 |
children | 3222:c22b6283d226 |
files | mod_pep_vcard_avatar/mod_pep_vcard_avatar.lua |
diffstat | 1 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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);