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

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

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

namespace Swift {
    ThreadSerializer::ThreadSerializer() : GenericPayloadSerializer<Thread>() {
    }

    ThreadSerializer::~ThreadSerializer() {
    }

    std::string ThreadSerializer::serializePayload(std::shared_ptr<Thread> thread)  const {
        XMLElement threadNode("thread", "", thread->getText());
        if (!thread->getParent().empty()) {
            threadNode.setAttribute("parent", thread->getParent());
        }
        return threadNode.serialize();
    }
}