summaryrefslogtreecommitdiffstats
blob: 26e1623102cd3a0c29e9153004000f8e30383bab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "Swiften/Serializer/PayloadSerializers/VCardSerializer.h"

#include <boost/shared_ptr.hpp>

#include "Swiften/Serializer/XML/XMLElement.h"
#include "Swiften/Serializer/XML/XMLTextNode.h"

namespace Swift {

VCardSerializer::VCardSerializer() : GenericPayloadSerializer<VCard>() {
}

String VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard)  const {
	XMLElement queryElement("vCard", "vcard-temp");
	if (!vcard->getNickname().isEmpty()) {
		boost::shared_ptr<XMLElement> nickElement(new XMLElement("NICKNAME"));
		nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getNickname())));
		queryElement.addNode(nickElement);
	}
	// TODO
	return queryElement.serialize();
}

}