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 | 30d35c0029d273e2778b7dd0d91f265626c44d53 (patch) | |
tree | e90f17879a58aa656f0b89165c1944360dd73d6f | |
parent | 20b0974876511efab915288d9cd793aceab5bebc (diff) | |
download | prosody-30d35c0029d273e2778b7dd0d91f265626c44d53.tar.gz prosody-30d35c0029d273e2778b7dd0d91f265626c44d53.zip |
mod_vcard_legacy: Add translation of telephone field
-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 |