summaryrefslogtreecommitdiffstats
blob: cc4d573dc00263b0c7a0f9b5739d576043ab9208 (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 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(boost::shared_ptr<Thread> thread)  const {
		XMLElement threadNode("thread", "", thread->getText());
		if (!thread->getParent().empty()) {
			threadNode.setAttribute("parent", thread->getParent());
		}
		return threadNode.serialize();
	}
}