diff options
author | Kim Alvefur <zash@zash.se> | 2019-12-24 00:39:45 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-12-24 00:39:45 +0100 |
commit | 929103b8672e1395eedd663fb172a91ce197ec33 (patch) | |
tree | 94b4ebcb9443e8e6751e1903ade3c9dc8ec9d678 /plugins/mod_vcard_legacy.lua | |
parent | b22125f0645b3281d99843dcdb7b44e92b9167cd (diff) | |
parent | cf87960bda697b3727b5b62ab8c983a48b8c5314 (diff) | |
download | prosody-929103b8672e1395eedd663fb172a91ce197ec33.tar.gz prosody-929103b8672e1395eedd663fb172a91ce197ec33.zip |
Merge 0.11->trunk
Diffstat (limited to 'plugins/mod_vcard_legacy.lua')
-rw-r--r-- | plugins/mod_vcard_legacy.lua | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua index 5e75947a..a6ff47d0 100644 --- a/plugins/mod_vcard_legacy.lua +++ b/plugins/mod_vcard_legacy.lua @@ -38,7 +38,7 @@ local simple_map = { module:hook("iq-get/bare/vcard-temp:vCard", function (event) local origin, stanza = event.origin, event.stanza; local pep_service = mod_pep.get_pep_service(jid_split(stanza.attr.to) or origin.username); - local ok, id, vcard4_item = pep_service:get_last_item("urn:xmpp:vcard4", stanza.attr.from); + local ok, _, vcard4_item = pep_service:get_last_item("urn:xmpp:vcard4", stanza.attr.from); local vcard_temp = st.stanza("vCard", { xmlns = "vcard-temp" }); if ok and vcard4_item then @@ -105,6 +105,23 @@ module:hook("iq-get/bare/vcard-temp:vCard", function (event) vcard_temp:tag("WORK"):up(); end vcard_temp:up(); + elseif tag.name == "impp" then + local uri = tag:get_child_text("uri"); + if uri and uri:sub(1, 5) == "xmpp:" then + vcard_temp:text_tag("JABBERID", uri:sub(6)) + end + elseif tag.name == "org" then + vcard_temp:tag("ORG") + :text_tag("ORGNAME", tag:get_child_text("text")) + :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 @@ -216,6 +233,10 @@ function vcard_to_pep(vcard_temp) vcard4:text_tag("text", "work"); end vcard4:up():up():up(); + elseif tag.name == "JABBERID" then + vcard4:tag("impp") + :text_tag("uri", "xmpp:" .. tag:get_text()) + :up(); elseif tag.name == "PHOTO" then local avatar_type = tag:get_child_text("TYPE"); local avatar_payload = tag:get_child_text("BINVAL"); |