Changeset

10215:82abf88db13f

mod_vcard_legacy: Use PEP nickname if vcard4 data is unavailable Last remaining nice feature from mod_profile. Allows setting eg nickname and avatar as completely public while restricting private details in vcard4 to only contacts.
author Kim Alvefur <zash@zash.se>
date Thu, 22 Aug 2019 22:23:04 +0200
parents 10214:f864e685e618
children 10216:a51d017e6173
files plugins/mod_vcard_legacy.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_vcard_legacy.lua	Wed Aug 21 23:18:08 2019 +0200
+++ b/plugins/mod_vcard_legacy.lua	Thu Aug 22 22:23:04 2019 +0200
@@ -116,6 +116,14 @@
 				:up();
 			end
 		end
+	else
+		local ok, _, nick_item = pep_service:get_last_item("http://jabber.org/protocol/nick", stanza.attr.from);
+		if ok and nick_item then
+			local nickname = nick_item:get_child_text("nick", "http://jabber.org/protocol/nick");
+			if nickname then
+				vcard_temp:text_tag("NICKNAME", nickname);
+			end
+		end
 	end
 
 	local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from);