summaryrefslogtreecommitdiffstats
blob: bf63a6930ceb87e1c07b2b004b568266fbea2518 (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
25
26
/*
 * Copyright (c) 2015 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

#include <Swiften/Serializer/PayloadSerializers/CarbonsReceivedSerializer.h>

#include <boost/make_shared.hpp>

namespace Swift {
	CarbonsReceivedSerializer::CarbonsReceivedSerializer(PayloadSerializerCollection* serializers) : GenericPayloadSerializer<CarbonsReceived>(), serializers_(serializers) {
	}

	CarbonsReceivedSerializer::~CarbonsReceivedSerializer() {	
	}
	
	std::string CarbonsReceivedSerializer::serializePayload(boost::shared_ptr<CarbonsReceived> received) const {
		XMLElement element("received", "urn:xmpp:carbons:2");
		if (received->getForwarded()) {
			element.addNode(boost::make_shared<XMLRawTextNode>(ForwardedSerializer(serializers_).serialize(received->getForwarded())));
		}
		return element.serialize();
	}
}