summaryrefslogtreecommitdiffstats
blob: cc87929445c3ae5b8a98f4c85b6442a3a1d3b63b (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-2016 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

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

#include <memory>

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

    CarbonsReceivedSerializer::~CarbonsReceivedSerializer() {
    }

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