summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp')
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp
new file mode 100644
index 0000000..83a73af
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2013 Remko Tronçon
+ * Licensed under the GNU General Public License.
+ * See the COPYING file for more information.
+ */
+
+#pragma clang diagnostic ignored "-Wunused-private-field"
+
+#include <Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+
+
+using namespace Swift;
+
+PubSubSubscribeSerializer::PubSubSubscribeSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) {
+}
+
+PubSubSubscribeSerializer::~PubSubSubscribeSerializer() {
+}
+
+std::string PubSubSubscribeSerializer::serializePayload(boost::shared_ptr<PubSubSubscribe> payload) const {
+ if (!payload) {
+ return "";
+ }
+ XMLElement element("subscribe", "http://jabber.org/protocol/pubsub");
+ if (payload->getNode()) {
+ element.setAttribute("node", *payload->getNode());
+ }
+ element.setAttribute("jid", payload->getJID());
+ return element.serialize();
+}
+
+