Changeset

9251:3f31e10e8256

mod_vcard_legacy: Add translation of email field
author Kim Alvefur <zash@zash.se>
date Sat, 01 Sep 2018 23:45:58 +0200
parents 9250:9a8006f9e983
children 9252:292d283c7694
files plugins/mod_vcard_legacy.lua
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_vcard_legacy.lua	Mon Aug 20 07:36:03 2018 +0200
+++ b/plugins/mod_vcard_legacy.lua	Sat Sep 01 23:45:58 2018 +0200
@@ -46,6 +46,19 @@
 				if text then
 					vcard_temp:text_tag(tag.name:upper(), text);
 				end
+			elseif tag.name == "email" then
+				local text = tag:get_child_text("text");
+				if text then
+					vcard_temp:tag("EMAIL")
+						:text_tag("USERID", text)
+						:tag("INTERNET"):up();
+					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