aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_vcard_legacy.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-08-22 22:23:04 +0200
committerKim Alvefur <zash@zash.se>2019-08-22 22:23:04 +0200
commit0bf3161a3f25b84af6f78f2e40da17d853761240 (patch)
tree5b27af1e1044135e2fa85236a2dfbbce824a582a /plugins/mod_vcard_legacy.lua
parentbd3c389d48a14a2509b46a4830938c2c83505713 (diff)
downloadprosody-0bf3161a3f25b84af6f78f2e40da17d853761240.tar.gz
prosody-0bf3161a3f25b84af6f78f2e40da17d853761240.zip
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.
Diffstat (limited to 'plugins/mod_vcard_legacy.lua')
-rw-r--r--plugins/mod_vcard_legacy.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua
index 89ef1a4f..91497493 100644
--- a/plugins/mod_vcard_legacy.lua
+++ b/plugins/mod_vcard_legacy.lua
@@ -116,6 +116,14 @@ module:hook("iq-get/bare/vcard-temp:vCard", function (event)
: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);