summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer')
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp25
-rw-r--r--Swiften/Serializer/PayloadSerializers/NicknameSerializer.h21
3 files changed, 48 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
index d63c723..8598f17 100644
--- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
@@ -34,6 +34,7 @@
#include "Swiften/Serializer/PayloadSerializers/DelaySerializer.h"
#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
#include "Swiften/Serializer/PayloadSerializers/CommandSerializer.h"
+#include "Swiften/Serializer/PayloadSerializers/NicknameSerializer.h"
namespace Swift {
@@ -65,6 +66,7 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() {
serializers_.push_back(new FormSerializer());
serializers_.push_back(new PrivateStorageSerializer(this));
serializers_.push_back(new CommandSerializer());
+ serializers_.push_back(new NicknameSerializer());
foreach(PayloadSerializer* serializer, serializers_) {
addSerializer(serializer);
}
diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp
new file mode 100644
index 0000000..55d5bb6
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include "Swiften/Serializer/PayloadSerializers/NicknameSerializer.h"
+
+#include <boost/shared_ptr.hpp>
+
+#include "Swiften/Serializer/XML/XMLElement.h"
+#include "Swiften/Serializer/XML/XMLTextNode.h"
+
+namespace Swift {
+
+NicknameSerializer::NicknameSerializer() : GenericPayloadSerializer<Nickname>() {
+}
+
+String NicknameSerializer::serializePayload(boost::shared_ptr<Nickname> nick) const {
+ XMLElement nickElement("nick", "http://jabber.org/protocol/nick");
+ nickElement.addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(nick->getNickname())));
+ return nickElement.serialize();
+}
+
+}
diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h
new file mode 100644
index 0000000..e296ffd
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include "Swiften/Serializer/GenericPayloadSerializer.h"
+#include "Swiften/Elements/Nickname.h"
+
+namespace Swift {
+ class NicknameSerializer : public GenericPayloadSerializer<Nickname> {
+ public:
+ NicknameSerializer();
+
+ virtual String serializePayload(boost::shared_ptr<Nickname>) const;
+ };
+}
+
+