diff options
author | Kim Alvefur <zash@zash.se> | 2018-09-01 23:46:19 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-09-01 23:46:19 +0200 |
commit | a28e20077f5e58afc86e77b20785ddcc984127ca (patch) | |
tree | e90f17879a58aa656f0b89165c1944360dd73d6f /plugins/mod_vcard_legacy.lua | |
parent | d1258d3a174b2eebfd76037b3459b124df0b8ec7 (diff) | |
download | prosody-a28e20077f5e58afc86e77b20785ddcc984127ca.tar.gz prosody-a28e20077f5e58afc86e77b20785ddcc984127ca.zip |
mod_vcard_legacy: Add translation of telephone field
Diffstat (limited to 'plugins/mod_vcard_legacy.lua')
-rw-r--r-- | plugins/mod_vcard_legacy.lua | 14 |
1 files changed, 14 insertions, 0 deletions
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 |