# HG changeset patch # User Kim Alvefur # Date 1403721901 -7200 # Node ID 843769eb40c331a1573326b3e5afd420f91d5968 # Parent ae1d7665cde91bc3d9f640bdd91d57fbd24fc721 mod_profile: Don't include photo in vCard4 version (use XEP-0084 instead) diff -r ae1d7665cde9 -r 843769eb40c3 mod_profile/mod_profile.lua --- a/mod_profile/mod_profile.lua Mon Jun 23 20:25:08 2014 +0200 +++ b/mod_profile/mod_profile.lua Wed Jun 25 20:45:01 2014 +0200 @@ -6,6 +6,7 @@ local vcard = require"util.vcard"; local base64 = require"util.encodings".base64; local sha1 = require"util.hashes".sha1; +local t_insert, t_remove = table.insert, table.remove; local pep_plus; if module:get_host_type() == "local" and module:get_option_boolean("vcard_to_pep", true) then @@ -44,10 +45,13 @@ local function update_pep(username, data) local pep = pep_plus.get_pep_service(username.."@"..module.host); + local photo, p = get_item(data, "PHOTO"); if vcard.to_vcard4 then + if p then t_remove(data, p); end pep:purge("urn:xmpp:vcard4", true); pep:publish("urn:xmpp:vcard4", true, "current", st.stanza("item", {id="current"}) :add_child(vcard.to_vcard4(data))); + if p then t_insert(data, p, photo); end end local nickname = get_item(data, "NICKNAME"); @@ -57,7 +61,6 @@ :tag("nick", { xmlns="http://jabber.org/protocol/nick" }):text(nickname[1])); end - local photo = get_item(data, "PHOTO"); if photo and photo[1] then local photo_raw = base64.decode(photo[1]); local photo_hash = sha1(photo_raw, true);