# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1346019227 -7200
# Node ID f374daa3db4d6a60561d0f597463c6df101e4f8b
# Parent  de6e59e751eb6c311e0c1d08c5fcd396d9357327
plugins.vcard: Update for never util.vcard

diff -r de6e59e751eb -r f374daa3db4d plugins/vcard.lua
--- a/plugins/vcard.lua	Mon Aug 27 00:04:30 2012 +0200
+++ b/plugins/vcard.lua	Mon Aug 27 00:13:47 2012 +0200
@@ -8,13 +8,10 @@
 		stream:send_iq(verse.iq({to = jid, type="get"})
 			:tag("vCard", {xmlns=xmlns_vcard}), callback and function(stanza)
 				local lCard, xCard;
-				xCard = stanza:get_child("vCard", xmlns_vcard);
-				if stanza.attr.type == "result" and xCard then
-					lCard = vcard.xep54_to_lua(xCard)
-					vCard = vcard.xep54_to_text(xCard)
-					-- FIXME This is only until util.vcard.lua_to_text() is implemented
-					lCard._text = vCard;
-					callback(lCard)
+				vCard = stanza:get_child("vCard", xmlns_vcard);
+				if stanza.attr.type == "result" and vCard then
+					vCard = vcard.from_xep54(xCard)
+					callback(vCard)
 				else
 					callback(false) -- FIXME add error
 				end
@@ -26,8 +23,9 @@
 		if type(aCard) == "table" and aCard.name then
 			xCard = aCard;
 		elseif type(aCard) == "string" then
-			xCard = vcard.text_to_xep54(aCard)[1];
+			xCard = vcard.from_text(aCard)[1];
 		elseif type(aCard) == "table" then
+			xCard = vcard.to_xep54(aCard);
 			error("Converting a table to vCard not implemented")
 		end
 		if not xCard then return false end