From a28e20077f5e58afc86e77b20785ddcc984127ca Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 1 Sep 2018 23:46:19 +0200 Subject: mod_vcard_legacy: Add translation of telephone field --- plugins/mod_vcard_legacy.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'plugins/mod_vcard_legacy.lua') diff --git a/plugins/mod_vcard_legacy.lua b/plugins/mod_vcard_legacy.lua index 81d35309..c44c2520 100644 --- a/plugins/mod_vcard_legacy.lua +++ b/plugins/mod_vcard_legacy.lua @@ -59,6 +59,20 @@ module:hook("iq-get/bare/vcard-temp:vCard", function (event) end vcard_temp:up(); end + elseif tag.name == "tel" then + local text = tag:get_child_text("uri"); + if text then + if text:sub(1, 4) == "tel:" then + text = text:sub(5) + end + vcard_temp:tag("TEL"):text_tag("NUMBER", text); + if tag:find"parameters/type/text#" == "home" then + vcard_temp:tag("HOME"):up(); + elseif tag:find"parameters/type/text#" == "work" then + vcard_temp:tag("WORK"):up(); + end + vcard_temp:up(); + end end end end -- cgit v1.2.3