Software /
code /
prosody
Changeset
9252:292d283c7694
mod_vcard_legacy: Add translation of telephone field
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 01 Sep 2018 23:46:19 +0200 |
parents | 9251:3f31e10e8256 |
children | 9253:dbe3ae6f9746 |
files | plugins/mod_vcard_legacy.lua |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_vcard_legacy.lua Sat Sep 01 23:45:58 2018 +0200 +++ b/plugins/mod_vcard_legacy.lua Sat Sep 01 23:46:19 2018 +0200 @@ -59,6 +59,20 @@ 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