Changeset

9256:12d3d96e3918

mod_vcard_legacy: Respond with old vcard
author Kim Alvefur <zash@zash.se>
date Tue, 21 Aug 2018 17:16:30 +0200
parents 9255:2aa40526df7b
children 9257:05bd21c122ae
files plugins/mod_vcard_legacy.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_vcard_legacy.lua	Tue Aug 21 17:16:27 2018 +0200
+++ b/plugins/mod_vcard_legacy.lua	Tue Aug 21 17:16:30 2018 +0200
@@ -6,6 +6,8 @@
 local sha1 = require "util.hashes".sha1;
 local base64_decode = require "util.encodings".base64.decode;
 
+local vcards = module:open_store("vcard");
+
 module:add_feature("vcard-temp");
 module:add_feature("urn:xmpp:pep-vcard-conversion:0");
 
@@ -93,6 +95,10 @@
 				vcard_temp:up();
 			end
 		end
+	else
+		local legacy_vcard = st.deserialize(vcards:get(jid_split(stanza.attr.to) or origin.username));
+		origin.send(st.reply(stanza):add_child(legacy_vcard or vcard_temp));
+		return true;
 	end
 
 	local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from);