Comparison

plugins/mod_vcard_legacy.lua @ 10117:8643b784626c

mod_vcard_legacy: Add support for JABBERID - impp/uri conversion
author Kim Alvefur <zash@zash.se>
date Sat, 19 Jan 2019 22:01:54 +0100
parent 9814:5eb4ef537e98
child 10118:199dae5b6f11
comparison
equal deleted inserted replaced
10116:4807535b8673 10117:8643b784626c
103 vcard_temp:tag("HOME"):up(); 103 vcard_temp:tag("HOME"):up();
104 elseif tag:find"parameters/type/text#" == "work" then 104 elseif tag:find"parameters/type/text#" == "work" then
105 vcard_temp:tag("WORK"):up(); 105 vcard_temp:tag("WORK"):up();
106 end 106 end
107 vcard_temp:up(); 107 vcard_temp:up();
108 elseif tag.name == "impp" then
109 local uri = tag:get_child_text("uri");
110 if uri and uri:sub(1, 5) == "xmpp:" then
111 vcard_temp:text_tag("JABBERID", uri:sub(6))
112 end
108 end 113 end
109 end 114 end
110 end 115 end
111 116
112 local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from); 117 local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from);
214 vcard4:text_tag("text", "home"); 219 vcard4:text_tag("text", "home");
215 elseif tag:get_child("WORK") then 220 elseif tag:get_child("WORK") then
216 vcard4:text_tag("text", "work"); 221 vcard4:text_tag("text", "work");
217 end 222 end
218 vcard4:up():up():up(); 223 vcard4:up():up():up();
224 elseif tag.name == "JABBERID" then
225 vcard4:tag("impp")
226 :text_tag("uri", "xmpp:" .. tag:get_text())
227 :up();
219 elseif tag.name == "PHOTO" then 228 elseif tag.name == "PHOTO" then
220 local avatar_type = tag:get_child_text("TYPE"); 229 local avatar_type = tag:get_child_text("TYPE");
221 local avatar_payload = tag:get_child_text("BINVAL"); 230 local avatar_payload = tag:get_child_text("BINVAL");
222 -- Can EXTVAL be translated? No way to know the sha1 of the data? 231 -- Can EXTVAL be translated? No way to know the sha1 of the data?
223 232