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
commit761731222d7836a8567bb6cc1fe1788aa15748a0 (patch)
tree5b27af1e1044135e2fa85236a2dfbbce824a582a /plugins/mod_vcard_legacy.lua
parente0125bcb4c3a1c0f58d6fc291580ca4d54d8f331 (diff)
downloadprosody-761731222d7836a8567bb6cc1fe1788aa15748a0.tar.gz
prosody-761731222d7836a8567bb6cc1fe1788aa15748a0.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);