summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-08-22 08:55:08 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-08-24 17:10:23 (GMT)
commitb6a34463dfcedd454ab42230a47cdb7294a76f21 (patch)
tree832b0243325451932c0d15e9e33d53948fce0110 /Swiften/Serializer/PayloadSerializers
parent6e4b357141a6d09632f1e96d0eaf54f79daf52c9 (diff)
downloadswift-contrib-b6a34463dfcedd454ab42230a47cdb7294a76f21.zip
swift-contrib-b6a34463dfcedd454ab42230a47cdb7294a76f21.tar.bz2
Implemented VCardManager.
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
index 19a6b6e..8975818 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
@@ -10,6 +10,7 @@
#include "Swiften/Serializer/XML/XMLElement.h"
#include "Swiften/Serializer/XML/XMLTextNode.h"
+#include "Swiften/StringCodecs/Hexify.h"
namespace Swift {
@@ -49,7 +50,20 @@ String VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) const
nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getNickname())));
queryElement.addNode(nickElement);
}
- // TODO
+ if (!vcard->getPhoto().isEmpty() || !vcard->getPhotoType().isEmpty()) {
+ XMLElement::ref photoElement(new XMLElement("PHOTO"));
+ if (!vcard->getPhotoType().isEmpty()) {
+ XMLElement::ref typeElement(new XMLElement("TYPE"));
+ typeElement->addNode(XMLTextNode::ref(new XMLTextNode(vcard->getPhotoType())));
+ photoElement->addNode(typeElement);
+ }
+ if (!vcard->getPhoto().isEmpty()) {
+ XMLElement::ref binvalElement(new XMLElement("BINVAL"));
+ binvalElement->addNode(XMLTextNode::ref(new XMLTextNode(Hexify::hexify(vcard->getPhoto()))));
+ photoElement->addNode(binvalElement);
+ }
+ queryElement.addNode(photoElement);
+ }
return queryElement.serialize();
}