summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-06-01 17:13:40 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-06-01 17:13:40 (GMT)
commite8ab1af885ff61715ab0350c3cb22ed6988a082a (patch)
treeabfd1f18bf6bda8865c1269c1ecb4a1b4ff802d0 /Swiften/Serializer/PayloadSerializers
parent4f9ad66f222d4bf1cb740a9e1b4b4496cfbc0910 (diff)
downloadswift-contrib-e8ab1af885ff61715ab0350c3cb22ed6988a082a.zip
swift-contrib-e8ab1af885ff61715ab0350c3cb22ed6988a082a.tar.bz2
Added simple whiteboard payload and it's parser and serializer
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h21
2 files changed, 23 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
index 93fd70f..b4822cd 100644
--- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
@@ -50,6 +50,7 @@
#include <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/LastSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h>
@@ -108,6 +109,7 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() {
serializers_.push_back(new SearchPayloadSerializer());
serializers_.push_back(new ReplaceSerializer());
serializers_.push_back(new LastSerializer());
+ serializers_.push_back(new WhiteboardSerializer());
serializers_.push_back(new StreamInitiationFileInfoSerializer());
serializers_.push_back(new JingleContentPayloadSerializer());
diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h
new file mode 100644
index 0000000..a7d04f1
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2012 Mateusz Piękos
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Elements/WhiteboardPayload.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+
+namespace Swift {
+ class WhiteboardSerializer : public GenericPayloadSerializer<WhiteboardPayload> {
+ public:
+ std::string serializePayload(boost::shared_ptr<WhiteboardPayload> payload) const {
+ XMLElement element("wb");
+ element.addNode(XMLTextNode::ref(new XMLTextNode(payload->getData())));
+ return element.serialize();
+ }
+ };
+}