summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2014-08-29 12:36:17 (GMT)
committerKevin Smith <git@kismith.co.uk>2014-09-17 09:52:35 (GMT)
commit5bb5e4eb3024dfba3ae2b5041b90472ee478aebe (patch)
tree6e3c47ba3236a65fa0a49eb6595f3e09db31bb3e /Swiften/Serializer/PayloadSerializers
parentfc2714bf30ddd447405082ba4f8fa93bda369a6f (diff)
downloadswift-5bb5e4eb3024dfba3ae2b5041b90472ee478aebe.zip
swift-5bb5e4eb3024dfba3ae2b5041b90472ee478aebe.tar.bz2
Handle Isode's IQ Forwarding
Change-Id: I3b358e6a60f1ff546f2e578b6e0a54072b4c6da5
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp105
-rw-r--r--Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp33
-rw-r--r--Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h31
3 files changed, 117 insertions, 52 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
index b5269d1..dcfb4ed 100644
--- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
@@ -10,71 +10,71 @@
#include <Swiften/Elements/UnblockPayload.h>
#include <Swiften/Elements/BlockListPayload.h>
#include <Swiften/Serializer/PayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/IBBSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/BodySerializer.h>
#include <Swiften/Serializer/PayloadSerializers/BlockSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/SubjectSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/BodySerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/PrioritySerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/ErrorSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/StatusSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/CommandSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/DelaySerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/StorageSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/DelaySerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ErrorSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/CommandSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/NicknameSerializer.h>
-#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/UserLocationSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/IdleSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/PubSubSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/MAMArchivedSerializer.h>
-
-#include <Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/IBBSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/IdleSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/LastSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MAMArchivedSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/NicknameSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/PrioritySerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/PubSubSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StatusSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StorageSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SubjectSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h>
namespace Swift {
@@ -148,6 +148,7 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() {
serializers_.push_back(new MAMResultSerializer(this));
serializers_.push_back(new MAMQuerySerializer());
serializers_.push_back(new MAMArchivedSerializer());
+ serializers_.push_back(new IsodeIQDelegationSerializer(this));
foreach(PayloadSerializer* serializer, serializers_) {
addSerializer(serializer);
diff --git a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp
new file mode 100644
index 0000000..8e782b4
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014 Remko Tronçon and Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma clang diagnostic ignored "-Wunused-private-field"
+
+#include <Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <boost/smart_ptr/make_shared.hpp>
+
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+
+using namespace Swift;
+
+IsodeIQDelegationSerializer::IsodeIQDelegationSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) {
+}
+
+IsodeIQDelegationSerializer::~IsodeIQDelegationSerializer() {
+}
+
+std::string IsodeIQDelegationSerializer::serializePayload(boost::shared_ptr<IsodeIQDelegation> payload) const {
+ if (!payload) {
+ return "";
+ }
+ XMLElement element("delegate", "http://isode.com/iq_delegation");
+ element.addNode(boost::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(payload->getForward())->serialize(payload->getForward())));
+ return element.serialize();
+}
+
+
diff --git a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h
new file mode 100644
index 0000000..1bcd993
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014 Remko Tronçon and Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/Override.h>
+#include <Swiften/Base/API.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/IsodeIQDelegation.h>
+#include <boost/shared_ptr.hpp>
+
+namespace Swift {
+ class PayloadSerializerCollection;
+
+ class SWIFTEN_API IsodeIQDelegationSerializer : public GenericPayloadSerializer<IsodeIQDelegation> {
+ public:
+ IsodeIQDelegationSerializer(PayloadSerializerCollection* serializers);
+ virtual ~IsodeIQDelegationSerializer();
+
+ virtual std::string serializePayload(boost::shared_ptr<IsodeIQDelegation>) const SWIFTEN_OVERRIDE;
+
+ private:
+
+
+ private:
+ PayloadSerializerCollection* serializers;
+ };
+}