Software / code / prosody
Comparison
plugins/mod_vcard_legacy.lua @ 9256:12d3d96e3918
mod_vcard_legacy: Respond with old vcard
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 21 Aug 2018 17:16:30 +0200 |
| parent | 9255:2aa40526df7b |
| child | 9257:05bd21c122ae |
comparison
equal
deleted
inserted
replaced
| 9255:2aa40526df7b | 9256:12d3d96e3918 |
|---|---|
| 3 | 3 |
| 4 local mod_pep = module:depends("pep"); | 4 local mod_pep = module:depends("pep"); |
| 5 | 5 |
| 6 local sha1 = require "util.hashes".sha1; | 6 local sha1 = require "util.hashes".sha1; |
| 7 local base64_decode = require "util.encodings".base64.decode; | 7 local base64_decode = require "util.encodings".base64.decode; |
| 8 | |
| 9 local vcards = module:open_store("vcard"); | |
| 8 | 10 |
| 9 module:add_feature("vcard-temp"); | 11 module:add_feature("vcard-temp"); |
| 10 module:add_feature("urn:xmpp:pep-vcard-conversion:0"); | 12 module:add_feature("urn:xmpp:pep-vcard-conversion:0"); |
| 11 | 13 |
| 12 -- Simple translations | 14 -- Simple translations |
| 91 vcard_temp:tag("WORK"):up(); | 93 vcard_temp:tag("WORK"):up(); |
| 92 end | 94 end |
| 93 vcard_temp:up(); | 95 vcard_temp:up(); |
| 94 end | 96 end |
| 95 end | 97 end |
| 98 else | |
| 99 local legacy_vcard = st.deserialize(vcards:get(jid_split(stanza.attr.to) or origin.username)); | |
| 100 origin.send(st.reply(stanza):add_child(legacy_vcard or vcard_temp)); | |
| 101 return true; | |
| 96 end | 102 end |
| 97 | 103 |
| 98 local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from); | 104 local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from); |
| 99 local data_ok, avatar_data = pep_service:get_items("urn:xmpp:avatar:data", stanza.attr.from); | 105 local data_ok, avatar_data = pep_service:get_items("urn:xmpp:avatar:data", stanza.attr.from); |
| 100 if meta_ok and data_ok then | 106 if meta_ok and data_ok then |