summaryrefslogtreecommitdiffstats
blob: 39550c2e9239c115e65f278cd77c57a538cd3365 (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
27
28
29
30
/*
 * Copyright (c) 2013-2016 Isode Limited.
 * All rights reserved.
 * See the COPYING file for more information.
 */

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

#include <memory>

#include <Swiften/Serializer/XML/XMLElement.h>

using namespace Swift;

PubSubSubscribeOptionsSerializer::PubSubSubscribeOptionsSerializer(PayloadSerializerCollection* /*serializers*/) {
}

PubSubSubscribeOptionsSerializer::~PubSubSubscribeOptionsSerializer() {
}

std::string PubSubSubscribeOptionsSerializer::serializePayload(std::shared_ptr<PubSubSubscribeOptions> payload) const {
    if (!payload) {
        return "";
    }
    XMLElement element("subscribe-options", "http://jabber.org/protocol/pubsub");
    element.addNode(payload->isRequired() ? std::make_shared<XMLElement>("required", "") : std::shared_ptr<XMLElement>());
    return element.serialize();
}