# HG changeset patch # User Kim Alvefur # Date 1401307347 -7200 # Node ID 877dc87539ffd4fa83be984c8fe0e5d1e68de49a # Parent a0375f84d65aca8edf6e6a9dca5c62e75f2f13fe mod_profile: Replacement for mod_vcard with vcard4 support and integration with mod_pep_plus diff -r a0375f84d65a -r 877dc87539ff mod_profile/mod_profile.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_profile/mod_profile.lua Wed May 28 22:02:27 2014 +0200 @@ -0,0 +1,151 @@ +-- mod_profile + +local st = require"util.stanza"; +local jid_split, jid_bare = import("util.jid", "split", "bare"); +local is_admin = require"core.usermanager".is_admin; +local vcard = require"util.vcard"; +local base64 = require"util.encodings".base64; +local sha1 = require"util.hashes".sha1; + +local pep_plus; +if module:get_host_type() == "local" and module:get_option_boolean("vcard_to_pep") then + pep_plus = module:depends"pep_plus"; +end + +local storage = module:open_store(); +local legacy_storage = module:open_store("vcard"); + +local function get_item(vcard, name) + local item; + for i=1, #vcard do + item=vcard[i]; + if item.name == name then + return item, i; + end + end +end + +local magic_mime = { + ["\137PNG\r\n\026\n"] = "image/png"; + ["\255\216"] = "image/jpeg"; + ["GIF87a"] = "image/gif"; + ["GIF89a"] = "image/gif"; + ["