# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1534862086 -7200
# Node ID 2ffbcad8ec5072e03f388e90ca43f0fec35b1df1
# Parent  dbe3ae6f97465de39c9ac459464d6f559af3687b
mod_vcard_legacy: Add support for address field

diff -r dbe3ae6f9746 -r 2ffbcad8ec50 plugins/mod_vcard_legacy.lua
--- a/plugins/mod_vcard_legacy.lua	Mon Aug 20 09:18:21 2018 +0200
+++ b/plugins/mod_vcard_legacy.lua	Tue Aug 21 16:34:46 2018 +0200
@@ -73,6 +73,21 @@
 					end
 					vcard_temp:up();
 				end
+			elseif tag.name == "adr" then
+				vcard_temp:tag("ADR")
+					:text_tag("POBOX", tag:get_child_text("pobox"))
+					:text_tag("EXTADD", tag:get_child_text("ext"))
+					:text_tag("STREET", tag:get_child_text("street"))
+					:text_tag("LOCALITY", tag:get_child_text("locality"))
+					:text_tag("REGION", tag:get_child_text("region"))
+					:text_tag("PCODE", tag:get_child_text("code"))
+					:text_tag("CTRY", tag:get_child_text("country"));
+				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