Comparison

plugins/mod_vcard_legacy.lua @ 10434:8f709577fe8e

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Sat, 23 Nov 2019 23:12:01 +0100
parent 10270:c2b9ff42db03
child 10549:3e50f86e5a2e
comparison
equal deleted inserted replaced
10433:7777f25d5266 10434:8f709577fe8e
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
113 elseif tag.name == "org" then
114 vcard_temp:tag("ORG")
115 :text_tag("ORGNAME", tag:get_child_text("text"))
116 :up();
117 end
118 end
119 else
120 local ok, _, nick_item = pep_service:get_last_item("http://jabber.org/protocol/nick", stanza.attr.from);
121 if ok and nick_item then
122 local nickname = nick_item:get_child_text("nick", "http://jabber.org/protocol/nick");
123 if nickname then
124 vcard_temp:text_tag("NICKNAME", nickname);
108 end 125 end
109 end 126 end
110 end 127 end
111 128
112 local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from); 129 local meta_ok, avatar_meta = pep_service:get_items("urn:xmpp:avatar:metadata", stanza.attr.from);
214 vcard4:text_tag("text", "home"); 231 vcard4:text_tag("text", "home");
215 elseif tag:get_child("WORK") then 232 elseif tag:get_child("WORK") then
216 vcard4:text_tag("text", "work"); 233 vcard4:text_tag("text", "work");
217 end 234 end
218 vcard4:up():up():up(); 235 vcard4:up():up():up();
236 elseif tag.name == "JABBERID" then
237 vcard4:tag("impp")
238 :text_tag("uri", "xmpp:" .. tag:get_text())
239 :up();
219 elseif tag.name == "PHOTO" then 240 elseif tag.name == "PHOTO" then
220 local avatar_type = tag:get_child_text("TYPE"); 241 local avatar_type = tag:get_child_text("TYPE");
221 local avatar_payload = tag:get_child_text("BINVAL"); 242 local avatar_payload = tag:get_child_text("BINVAL");
222 -- Can EXTVAL be translated? No way to know the sha1 of the data? 243 -- Can EXTVAL be translated? No way to know the sha1 of the data?
223 244