From 37511b6d30cb9cb6c1f5b1fdcca5f6658e4425da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be> Date: Fri, 10 Sep 2010 10:02:14 +0200 Subject: Fixed VCard photo serializing bug. diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp index 11b24dc..82a3ec8 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp @@ -71,7 +71,7 @@ class VCardSerializerTest : public CppUnit::TestFixture "<NICKNAME>DreamGirl</NICKNAME>" "<PHOTO>" "<TYPE>image/png</TYPE>" - "<BINVAL>616263646566</BINVAL>" + "<BINVAL>YWJjZGVm</BINVAL>" "</PHOTO>" "<BDAY>1234</BDAY>" "<MAILER>mutt</MAILER>" diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp index 5953ef6..bb09469 100644 --- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp @@ -11,7 +11,7 @@ #include "Swiften/Serializer/XML/XMLElement.h" #include "Swiften/Serializer/XML/XMLTextNode.h" #include "Swiften/Serializer/XML/XMLRawTextNode.h" -#include "Swiften/StringCodecs/Hexify.h" +#include "Swiften/StringCodecs/Base64.h" #include "Swiften/Base/foreach.h" namespace Swift { @@ -96,7 +96,7 @@ String VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) const } if (!vcard->getPhoto().isEmpty()) { XMLElement::ref binvalElement(new XMLElement("BINVAL")); - binvalElement->addNode(XMLTextNode::ref(new XMLTextNode(Hexify::hexify(vcard->getPhoto())))); + binvalElement->addNode(XMLTextNode::ref(new XMLTextNode(Base64::encode(vcard->getPhoto())))); photoElement->addNode(binvalElement); } queryElement.addNode(photoElement); -- cgit v0.10.2-6-g49f6