summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers')
-rw-r--r--Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp13
-rw-r--r--Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/LastSerializer.h2
-rw-r--r--Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h5
-rw-r--r--Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h5
-rw-r--r--Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.h11
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.h11
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp15
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.h11
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp31
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.h29
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.cpp44
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.h26
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.cpp29
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.h (renamed from Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.h)13
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.cpp29
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.h26
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.cpp29
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.cpp43
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.h30
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.h11
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp6
-rw-r--r--Swiften/Serializer/PayloadSerializers/PrioritySerializer.h2
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h5
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h10
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.cpp64
-rw-r--r--Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.h26
-rw-r--r--Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp8
-rw-r--r--Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h5
-rw-r--r--Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h2
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MIXCreateSerializerTest.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MIXDestroySerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MIXJoinSerializerTest.cpp100
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MIXLeaveSerializerTest.cpp30
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MIXPayloadSerializerTest.cpp61
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MIXRegisterNickSerializerTest.cpp22
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MIXSetNickSerializerTest.cpp22
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MIXUpdateSubscriptionSerializerTest.cpp36
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/MIXUserPreferenceSerializerTest.cpp8
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ReferencePayloadSerializerTest.cpp81
-rw-r--r--Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp56
94 files changed, 922 insertions, 405 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp
index 78bb0eb..37a9c03 100644
--- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp
@@ -25,7 +25,7 @@ std::string BytestreamsSerializer::serializePayload(std::shared_ptr<Bytestreams>
std::shared_ptr<XMLElement> streamHostElement(new XMLElement("streamhost"));
streamHostElement->setAttribute("host", streamHost.host);
streamHostElement->setAttribute("jid", streamHost.jid.toString());
- streamHostElement->setAttribute("port", boost::lexical_cast<std::string>(streamHost.port));
+ streamHostElement->setAttribute("port", std::to_string(streamHost.port));
queryElement.addNode(streamHostElement);
}
diff --git a/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h b/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h
index f3eb6fb..439e684 100644
--- a/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016 Isode Limited.
+ * Copyright (c) 2014-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/Forwarded.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API ForwardedSerializer : public GenericPayloadSerializer<Forwarded> {
public:
ForwardedSerializer(PayloadSerializerCollection* serializers);
- virtual ~ForwardedSerializer();
+ virtual ~ForwardedSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<Forwarded>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<Forwarded>) const override;
private:
PayloadSerializerCollection* serializers_;
diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
index 9832bd5..31294f1 100644
--- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
@@ -47,9 +47,14 @@
#include <Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/MIXParticipantSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h>
@@ -64,6 +69,7 @@
#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/PubSubSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h>
@@ -161,9 +167,14 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() {
serializers_.push_back(new ForwardedSerializer(this));
serializers_.push_back(new MIXParticipantSerializer());
serializers_.push_back(new MIXCreateSerializer());
+ serializers_.push_back(new MIXRegisterNickSerializer());
+ serializers_.push_back(new MIXPayloadSerializer());
+ serializers_.push_back(new MIXSetNickSerializer());
serializers_.push_back(new MIXUserPreferenceSerializer());
+ serializers_.push_back(new MIXLeaveSerializer());
serializers_.push_back(new MIXJoinSerializer());
serializers_.push_back(new MIXDestroySerializer());
+ serializers_.push_back(new MIXUpdateSubscriptionSerializer());
serializers_.push_back(new MAMResultSerializer(this));
serializers_.push_back(new MAMQuerySerializer());
serializers_.push_back(new MAMFinSerializer());
@@ -176,6 +187,8 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() {
serializers_.push_back(new IsodeIQDelegationSerializer(this));
+ serializers_.push_back(new ReferencePayloadSerializer(this));
+
for (auto serializer : serializers_) {
addSerializer(serializer);
}
diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
index e41ff8c..74a8e7b 100644
--- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
@@ -26,7 +26,7 @@ std::string IBBSerializer::serializePayload(std::shared_ptr<IBB> ibb) const {
XMLElement ibbElement("data", "http://jabber.org/protocol/ibb");
ibbElement.setAttribute("sid", ibb->getStreamID());
if (ibb->getSequenceNumber() >= 0) {
- ibbElement.setAttribute("seq", boost::lexical_cast<std::string>(ibb->getSequenceNumber()));
+ ibbElement.setAttribute("seq", std::to_string(ibb->getSequenceNumber()));
}
ibbElement.addNode(std::make_shared<XMLTextNode>(Base64::encode(ibb->getData())));
return ibbElement.serialize();
@@ -39,7 +39,7 @@ std::string IBBSerializer::serializePayload(std::shared_ptr<IBB> ibb) const {
case IBB::MessageStanza: ibbElement.setAttribute("stanza", "message"); break;
}
assert(ibb->getBlockSize() > 0);
- ibbElement.setAttribute("block-size", boost::lexical_cast<std::string>(ibb->getBlockSize()));
+ ibbElement.setAttribute("block-size", std::to_string(ibb->getBlockSize()));
return ibbElement.serialize();
}
case IBB::Close: {
diff --git a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h
index e7cfef9..419e2d5 100644
--- a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016 Isode Limited.
+ * Copyright (c) 2014-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/IsodeIQDelegation.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API IsodeIQDelegationSerializer : public GenericPayloadSerializer<IsodeIQDelegation> {
public:
IsodeIQDelegationSerializer(PayloadSerializerCollection* serializers);
- virtual ~IsodeIQDelegationSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<IsodeIQDelegation>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~IsodeIQDelegationSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<IsodeIQDelegation>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp
index 35a0a6e..95996c7 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleFileTransferFileInfoSerializer.cpp
@@ -44,13 +44,13 @@ std::string JingleFileTransferFileInfoSerializer::serializePayload(std::shared_p
if (fileInfo->getSupportsRangeRequests()) {
std::shared_ptr<XMLElement> range = std::make_shared<XMLElement>("range");
if (fileInfo->getRangeOffset() != 0) {
- range->setAttribute("offset", boost::lexical_cast<std::string>(fileInfo->getRangeOffset()));
+ range->setAttribute("offset", std::to_string(fileInfo->getRangeOffset()));
}
fileElement.addNode(range);
}
if (fileInfo->getSize() > 0) {
- fileElement.addNode(std::make_shared<XMLElement>("size", "", boost::lexical_cast<std::string>(fileInfo->getSize())));
+ fileElement.addNode(std::make_shared<XMLElement>("size", "", std::to_string(fileInfo->getSize())));
}
for (const auto& hashElement : fileInfo->getHashes()) {
diff --git a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp
index 9930e44..c5c45e1 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp
@@ -28,7 +28,7 @@ JingleIBBTransportPayloadSerializer::JingleIBBTransportPayloadSerializer() {
std::string JingleIBBTransportPayloadSerializer::serializePayload(std::shared_ptr<JingleIBBTransportPayload> payload) const {
XMLElement payloadXML("transport", "urn:xmpp:jingle:transports:ibb:1");
if (payload->getBlockSize()) {
- payloadXML.setAttribute("block-size", boost::lexical_cast<std::string>(*payload->getBlockSize()));
+ payloadXML.setAttribute("block-size", std::to_string(*payload->getBlockSize()));
}
payloadXML.setAttribute("sid", payload->getSessionID());
diff --git a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp
index 5e74d8e..f9a1832 100644
--- a/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp
@@ -39,8 +39,8 @@ std::string JingleS5BTransportPayloadSerializer::serializePayload(std::shared_pt
candidateXML->setAttribute("cid", candidate.cid);
candidateXML->setAttribute("host", candidate.hostPort.getAddress().toString());
candidateXML->setAttribute("jid", candidate.jid.toString());
- candidateXML->setAttribute("port", boost::lexical_cast<std::string>(candidate.hostPort.getPort()));
- candidateXML->setAttribute("priority", boost::lexical_cast<std::string>(candidate.priority));
+ candidateXML->setAttribute("port", std::to_string(candidate.hostPort.getPort()));
+ candidateXML->setAttribute("priority", std::to_string(candidate.priority));
candidateXML->setAttribute("type", typeToString(candidate.type));
payloadXML.addNode(candidateXML);
}
diff --git a/Swiften/Serializer/PayloadSerializers/LastSerializer.h b/Swiften/Serializer/PayloadSerializers/LastSerializer.h
index 1710bc0..719eff5 100644
--- a/Swiften/Serializer/PayloadSerializers/LastSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/LastSerializer.h
@@ -18,7 +18,7 @@ namespace Swift {
LastSerializer() : GenericPayloadSerializer<Last>() {}
virtual std::string serializePayload(std::shared_ptr<Last> last) const {
- return "<query xmlns='jabber:iq:last' seconds='" + boost::lexical_cast<std::string>(last->getSeconds()) + "'/>";
+ return "<query xmlns='jabber:iq:last' seconds='" + std::to_string(last->getSeconds()) + "'/>";
}
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h b/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h
index 7c5bd29..d8cff6a 100644
--- a/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MAMFinSerializer.h
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/MAMFin.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -17,8 +16,8 @@ namespace Swift {
class SWIFTEN_API MAMFinSerializer : public GenericPayloadSerializer<MAMFin> {
public:
MAMFinSerializer();
- virtual ~MAMFinSerializer();
+ virtual ~MAMFinSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<MAMFin>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<MAMFin>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h b/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h
index 6b2403f..e2ed063 100644
--- a/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/MAMQuery.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -17,8 +16,8 @@ namespace Swift {
class SWIFTEN_API MAMQuerySerializer : public GenericPayloadSerializer<MAMQuery> {
public:
MAMQuerySerializer();
- virtual ~MAMQuerySerializer();
+ virtual ~MAMQuerySerializer() override;
- virtual std::string serializePayload(std::shared_ptr<MAMQuery>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<MAMQuery>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h b/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h
index f4fc054..5cac8c4 100644
--- a/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016 Isode Limited.
+ * Copyright (c) 2014-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/MAMResult.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API MAMResultSerializer : public GenericPayloadSerializer<MAMResult> {
public:
MAMResultSerializer(PayloadSerializerCollection* serializers);
- virtual ~MAMResultSerializer();
+ virtual ~MAMResultSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<MAMResult>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<MAMResult>) const override;
private:
PayloadSerializerCollection* serializers_;
diff --git a/Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.cpp
index 9476df2..2034d86 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.cpp
@@ -24,7 +24,7 @@ std::string MIXCreateSerializer::serializePayload(std::shared_ptr<MIXCreate> pay
if (!payload) {
return "";
}
- XMLElement element("create", "urn:xmpp:mix:1");
+ XMLElement element("create", "urn:xmpp:mix:0");
if(payload->getChannel()) {
element.setAttribute("channel", *payload->getChannel());
diff --git a/Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.h b/Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.h
index 23cc65d..54f3adc 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MIXCreateSerializer.h
@@ -4,12 +4,17 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2017 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#pragma once
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/MIXCreate.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -18,8 +23,8 @@ namespace Swift {
class SWIFTEN_API MIXCreateSerializer : public GenericPayloadSerializer<MIXCreate> {
public:
MIXCreateSerializer();
- virtual ~MIXCreateSerializer();
+ virtual ~MIXCreateSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<MIXCreate>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<MIXCreate>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.cpp
index a395416..ed0d252 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.cpp
@@ -24,7 +24,7 @@ std::string MIXDestroySerializer::serializePayload(std::shared_ptr<MIXDestroy> p
if (!payload) {
return "";
}
- XMLElement element("destroy", "urn:xmpp:mix:1");
+ XMLElement element("destroy", "urn:xmpp:mix:0");
element.setAttribute("channel", payload->getChannel());
return element.serialize();
}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.h b/Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.h
index c14c0dd..a0640a1 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MIXDestroySerializer.h
@@ -4,12 +4,17 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2017 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#pragma once
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/MIXDestroy.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -18,8 +23,8 @@ namespace Swift {
class SWIFTEN_API MIXDestroySerializer : public GenericPayloadSerializer<MIXDestroy> {
public:
MIXDestroySerializer();
- virtual ~MIXDestroySerializer();
+ virtual ~MIXDestroySerializer() override;
- virtual std::string serializePayload(std::shared_ptr<MIXDestroy>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<MIXDestroy>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp
index cae15c2..509e41e 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.cpp
@@ -7,8 +7,8 @@
#include <Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.h>
#include <memory>
+#include <string>
-#include <Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
@@ -25,16 +25,23 @@ std::string MIXJoinSerializer::serializePayload(std::shared_ptr<MIXJoin> payload
if (!payload) {
return "";
}
- XMLElement element("join", "urn:xmpp:mix:1");
+ XMLElement element("join", "urn:xmpp:mix:0");
if (payload->getChannel()) {
element.setAttribute("channel", *payload->getChannel());
}
if (payload->getJID()) {
element.setAttribute("jid", *payload->getJID());
}
- for (const auto& item : payload->getSubscriptions()) {
- element.addNode(std::make_shared<XMLRawTextNode>(MIXSubscribeSerializer().serialize(item)));
+ auto subscriptionData = payload->getSubscriptions();
+ std::vector<std::string> subscriptions(subscriptionData.begin(), subscriptionData.end());
+ std::sort(subscriptions.begin(), subscriptions.end());
+
+ for (const auto& item : subscriptions) {
+ auto subscribeElement = std::make_shared<XMLElement>("subscribe");
+ subscribeElement->setAttribute("node", item);
+ element.addNode(subscribeElement);
}
+
if (payload->getForm()) {
element.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getForm())));
}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.h b/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.h
index a53fbe3..9be6915 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MIXJoinSerializer.h
@@ -4,12 +4,17 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2017 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#pragma once
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/MIXJoin.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -18,8 +23,8 @@ namespace Swift {
class SWIFTEN_API MIXJoinSerializer : public GenericPayloadSerializer<MIXJoin> {
public:
MIXJoinSerializer();
- virtual ~MIXJoinSerializer();
+ virtual ~MIXJoinSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<MIXJoin>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<MIXJoin>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp
new file mode 100644
index 0000000..111186a
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.h>
+
+#include <memory>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+namespace Swift {
+
+MIXLeaveSerializer::MIXLeaveSerializer() {
+}
+
+MIXLeaveSerializer::~MIXLeaveSerializer() {
+}
+
+std::string MIXLeaveSerializer::serializePayload(std::shared_ptr<MIXLeave> payload) const {
+ if (!payload) {
+ return "";
+ }
+ XMLElement element("leave", "urn:xmpp:mix:0");
+ if (payload->getChannel()) {
+ element.setAttribute("channel", *payload->getChannel());
+ }
+ return element.serialize();
+}
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.h b/Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.h
new file mode 100644
index 0000000..dd593b6
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+/*
+ * Copyright (c) 2017 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <memory>
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/MIXLeave.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXLeaveSerializer : public GenericPayloadSerializer<MIXLeave> {
+ public:
+ MIXLeaveSerializer();
+ virtual ~MIXLeaveSerializer() override;
+
+ virtual std::string serializePayload(std::shared_ptr<MIXLeave>) const override;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.cpp
new file mode 100644
index 0000000..843270a
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.h>
+
+#include <memory>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+
+namespace Swift {
+
+MIXPayloadSerializer::MIXPayloadSerializer() : GenericPayloadSerializer<MIXPayload>() {
+}
+
+std::string MIXPayloadSerializer::serializePayload(std::shared_ptr<MIXPayload> payload) const {
+ XMLElement mixElement("mix", "urn:xmpp:mix:0");
+
+ if (payload->getNick()) {
+ std::shared_ptr<XMLElement> nickElement = std::make_shared<XMLElement>("nick");
+ nickElement->addNode(std::make_shared<XMLTextNode>(*payload->getNick()));
+ mixElement.addNode(nickElement);
+ }
+
+ if (payload->getJID()) {
+ std::shared_ptr<XMLElement> jidElement = std::make_shared<XMLElement>("jid");
+ jidElement->addNode(std::make_shared<XMLTextNode>(*payload->getJID()));
+ mixElement.addNode(jidElement);
+ }
+
+ if (payload->getSubmissionID()) {
+ std::shared_ptr<XMLElement> subIDElement = std::make_shared<XMLElement>("submission-id");
+ subIDElement->addNode(std::make_shared<XMLTextNode>(*payload->getSubmissionID()));
+ mixElement.addNode(subIDElement);
+ }
+
+ return mixElement.serialize();
+}
+
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.h
new file mode 100644
index 0000000..bc7ec7f
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+/*
+ * Copyright (c) 2017 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/MIXPayload.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXPayloadSerializer : public GenericPayloadSerializer<MIXPayload> {
+ public:
+ MIXPayloadSerializer();
+
+ virtual std::string serializePayload(std::shared_ptr<MIXPayload> payload) const override;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.cpp
new file mode 100644
index 0000000..9045ffe
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.h>
+
+#include <memory>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+
+namespace Swift {
+
+MIXRegisterNickSerializer::MIXRegisterNickSerializer() : GenericPayloadSerializer<MIXRegisterNick>() {
+}
+
+std::string MIXRegisterNickSerializer::serializePayload(std::shared_ptr<MIXRegisterNick> payload) const {
+ XMLElement registernickElement("register", "urn:xmpp:mix:0");
+
+ auto nickElement = std::make_shared<XMLElement>("nick");
+ nickElement->addNode(std::make_shared<XMLTextNode>(payload->getNick()));
+ registernickElement.addNode(nickElement);
+
+ return registernickElement.serialize();
+}
+
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.h b/Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.h
index b343f86..011fb18 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.h
@@ -6,20 +6,15 @@
#pragma once
-#include <memory>
-
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
-#include <Swiften/Elements/MIXSubscribe.h>
+#include <Swiften/Elements/MIXRegisterNick.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
namespace Swift {
-
- class SWIFTEN_API MIXSubscribeSerializer : public GenericPayloadSerializer<MIXSubscribe> {
+ class SWIFTEN_API MIXRegisterNickSerializer : public GenericPayloadSerializer<MIXRegisterNick> {
public:
- MIXSubscribeSerializer();
- virtual ~MIXSubscribeSerializer();
+ MIXRegisterNickSerializer();
- virtual std::string serializePayload(std::shared_ptr<MIXSubscribe>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<MIXRegisterNick> payload) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.cpp
new file mode 100644
index 0000000..d111d8c
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.h>
+
+#include <memory>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+
+namespace Swift {
+
+MIXSetNickSerializer::MIXSetNickSerializer() : GenericPayloadSerializer<MIXSetNick>() {
+}
+
+std::string MIXSetNickSerializer::serializePayload(std::shared_ptr<MIXSetNick> payload) const {
+ XMLElement setnickElement("setnick", "urn:xmpp:mix:0");
+
+ auto nickElement = std::make_shared<XMLElement>("nick");
+ nickElement->addNode(std::make_shared<XMLTextNode>(payload->getNick()));
+ setnickElement.addNode(nickElement);
+
+ return setnickElement.serialize();
+}
+
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.h b/Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.h
new file mode 100644
index 0000000..7c28d8e
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+/*
+ * Copyright (c) 2017 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/MIXSetNick.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXSetNickSerializer : public GenericPayloadSerializer<MIXSetNick> {
+ public:
+ MIXSetNickSerializer();
+
+ virtual std::string serializePayload(std::shared_ptr<MIXSetNick> payload) const override ;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.cpp
deleted file mode 100644
index 3ce6d89..0000000
--- a/Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2017 Tarun Gupta
- * Licensed under the simplified BSD license.
- * See Documentation/Licenses/BSD-simplified.txt for more information.
- */
-
-#include <Swiften/Serializer/PayloadSerializers/MIXSubscribeSerializer.h>
-
-#include <memory>
-
-#include <Swiften/Serializer/XML/XMLElement.h>
-#include <Swiften/Serializer/XML/XMLRawTextNode.h>
-
-using namespace Swift;
-
-MIXSubscribeSerializer::MIXSubscribeSerializer() {
-}
-
-MIXSubscribeSerializer::~MIXSubscribeSerializer() {
-}
-
-std::string MIXSubscribeSerializer::serializePayload(std::shared_ptr<MIXSubscribe> payload) const {
- if (!payload) {
- return "";
- }
- XMLElement element("subscribe");
- element.setAttribute("node", payload->getNode());
- return element.serialize();
-}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.cpp
new file mode 100644
index 0000000..8e95474
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.h>
+
+#include <memory>
+
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+
+namespace Swift {
+
+MIXUpdateSubscriptionSerializer::MIXUpdateSubscriptionSerializer() {
+}
+
+MIXUpdateSubscriptionSerializer::~MIXUpdateSubscriptionSerializer() {
+}
+
+std::string MIXUpdateSubscriptionSerializer::serializePayload(std::shared_ptr<MIXUpdateSubscription> payload) const {
+ if (!payload) {
+ return "";
+ }
+ XMLElement element("update-subscription", "urn:xmpp:mix:0");
+ if (payload->getJID()) {
+ element.setAttribute("jid", *payload->getJID());
+ }
+ auto subscriptionData = payload->getSubscriptions();
+ std::vector<std::string> subscriptions(subscriptionData.begin(), subscriptionData.end());
+ std::sort(subscriptions.begin(), subscriptions.end());
+
+ for (const auto& item : subscriptions) {
+ auto subscribeElement = std::make_shared<XMLElement>("subscribe");
+ subscribeElement->setAttribute("node", item);
+ element.addNode(subscribeElement);
+ }
+ return element.serialize();
+}
+
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.h b/Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.h
new file mode 100644
index 0000000..4ba9584
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+/*
+ * Copyright (c) 2017-2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <memory>
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/MIXUpdateSubscription.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+
+namespace Swift {
+
+ class SWIFTEN_API MIXUpdateSubscriptionSerializer : public GenericPayloadSerializer<MIXUpdateSubscription> {
+ public:
+ MIXUpdateSubscriptionSerializer();
+ virtual ~MIXUpdateSubscriptionSerializer() override;
+
+ virtual std::string serializePayload(std::shared_ptr<MIXUpdateSubscription>) const override;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.cpp
index 2d057ad..618e0b3 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.cpp
@@ -24,7 +24,7 @@ std::string MIXUserPreferenceSerializer::serializePayload(std::shared_ptr<MIXUse
if (!payload) {
return "";
}
- XMLElement element("user-preference", "urn:xmpp:mix:1");
+ XMLElement element("user-preference", "urn:xmpp:mix:0");
if(payload->getData()) {
element.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(payload->getData())));
}
diff --git a/Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.h b/Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.h
index 301083a..f262b83 100644
--- a/Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MIXUserPreferenceSerializer.h
@@ -4,12 +4,17 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
+/*
+ * Copyright (c) 2017 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
#pragma once
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/MIXUserPreference.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -18,8 +23,8 @@ namespace Swift {
class SWIFTEN_API MIXUserPreferenceSerializer : public GenericPayloadSerializer<MIXUserPreference> {
public:
MIXUserPreferenceSerializer();
- virtual ~MIXUserPreferenceSerializer();
+ virtual ~MIXUserPreferenceSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<MIXUserPreference>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<MIXUserPreference>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp
index 4f0f637..cde129e 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp
@@ -25,15 +25,15 @@ std::string MUCPayloadSerializer::serializePayload(std::shared_ptr<MUCPayload> m
std::shared_ptr<XMLElement> historyElement(new XMLElement("history"));
bool history = false;
if (muc->getMaxChars() >= 0) {
- historyElement->setAttribute("maxchars", boost::lexical_cast<std::string>(muc->getMaxChars()));
+ historyElement->setAttribute("maxchars", std::to_string(muc->getMaxChars()));
history = true;
}
if (muc->getMaxStanzas() >= 0) {
- historyElement->setAttribute("maxstanzas", boost::lexical_cast<std::string>(muc->getMaxStanzas()));
+ historyElement->setAttribute("maxstanzas", std::to_string(muc->getMaxStanzas()));
history = true;
}
if (muc->getSeconds() >= 0) {
- historyElement->setAttribute("seconds", boost::lexical_cast<std::string>(muc->getSeconds()));
+ historyElement->setAttribute("seconds", std::to_string(muc->getSeconds()));
history = true;
}
if (muc->getSince() != boost::posix_time::not_a_date_time) {
diff --git a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h
index 687d07f..fa2cef0 100644
--- a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h
@@ -18,7 +18,7 @@ namespace Swift {
PrioritySerializer() : GenericPayloadSerializer<Priority>() {}
virtual std::string serializePayload(std::shared_ptr<Priority> priority) const {
- return "<priority>" + boost::lexical_cast<std::string>(priority->getPriority()) + "</priority>";
+ return "<priority>" + std::to_string(priority->getPriority()) + "</priority>";
}
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h
index 8862414..9b6dadb 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubAffiliation.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubAffiliationSerializer : public GenericPayloadSerializer<PubSubAffiliation> {
public:
PubSubAffiliationSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubAffiliationSerializer();
+ virtual ~PubSubAffiliationSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubAffiliation>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubAffiliation>) const override;
private:
static std::string serializeType(PubSubAffiliation::Type);
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h
index c51d70e..b8096d3 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubAffiliationsSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubAffiliations.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubAffiliationsSerializer : public GenericPayloadSerializer<PubSubAffiliations> {
public:
PubSubAffiliationsSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubAffiliationsSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubAffiliations>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubAffiliationsSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubAffiliations>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h
index 6a6241c..ead5c4f 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubConfigureSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubConfigure.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubConfigureSerializer : public GenericPayloadSerializer<PubSubConfigure> {
public:
PubSubConfigureSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubConfigureSerializer();
+ virtual ~PubSubConfigureSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubConfigure>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubConfigure>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h
index 876e26f..0aa32af 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubCreateSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubCreate.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubCreateSerializer : public GenericPayloadSerializer<PubSubCreate> {
public:
PubSubCreateSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubCreateSerializer();
+ virtual ~PubSubCreateSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubCreate>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubCreate>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h
index 4f5031b..42419e3 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubDefaultSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubDefault.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubDefaultSerializer : public GenericPayloadSerializer<PubSubDefault> {
public:
PubSubDefaultSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubDefaultSerializer();
+ virtual ~PubSubDefaultSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubDefault>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubDefault>) const override;
private:
static std::string serializeType(PubSubDefault::Type);
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h
index d3d1227..0f075fe 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h
@@ -7,7 +7,6 @@
#pragma once
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubError.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -15,9 +14,9 @@ namespace Swift {
class SWIFTEN_API PubSubErrorSerializer : public GenericPayloadSerializer<PubSubError> {
public:
PubSubErrorSerializer();
- virtual ~PubSubErrorSerializer();
+ virtual ~PubSubErrorSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubError>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubError>) const override;
private:
static std::string serializeType(PubSubError::Type);
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h
index 9348549..766ad93 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventAssociateSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventAssociate.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubEventAssociateSerializer : public GenericPayloadSerializer<PubSubEventAssociate> {
public:
PubSubEventAssociateSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventAssociateSerializer();
+ virtual ~PubSubEventAssociateSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubEventAssociate>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventAssociate>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h
index 33144e9..749abdd 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventCollectionSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventCollection.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubEventCollectionSerializer : public GenericPayloadSerializer<PubSubEventCollection> {
public:
PubSubEventCollectionSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventCollectionSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubEventCollection>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubEventCollectionSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventCollection>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h
index a1e565c..3902840 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventConfigurationSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventConfiguration.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubEventConfigurationSerializer : public GenericPayloadSerializer<PubSubEventConfiguration> {
public:
PubSubEventConfigurationSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventConfigurationSerializer();
+ virtual ~PubSubEventConfigurationSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubEventConfiguration>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventConfiguration>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h
index e02d44c..94f7441 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventDeleteSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventDelete.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubEventDeleteSerializer : public GenericPayloadSerializer<PubSubEventDelete> {
public:
PubSubEventDeleteSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventDeleteSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubEventDelete>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubEventDeleteSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventDelete>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h
index 0d2d426..8f9fd00 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventDisassociateSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventDisassociate.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubEventDisassociateSerializer : public GenericPayloadSerializer<PubSubEventDisassociate> {
public:
PubSubEventDisassociateSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventDisassociateSerializer();
+ virtual ~PubSubEventDisassociateSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubEventDisassociate>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventDisassociate>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h
index f292a53..5bb2b83 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventItemSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventItem.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubEventItemSerializer : public GenericPayloadSerializer<PubSubEventItem> {
public:
PubSubEventItemSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventItemSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubEventItem>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubEventItemSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventItem>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h
index 7220fde..83d3d95 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventItemsSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventItems.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubEventItemsSerializer : public GenericPayloadSerializer<PubSubEventItems> {
public:
PubSubEventItemsSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventItemsSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubEventItems>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubEventItemsSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventItems>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h
index 161a733..533841f 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventPurgeSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventPurge.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubEventPurgeSerializer : public GenericPayloadSerializer<PubSubEventPurge> {
public:
PubSubEventPurgeSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventPurgeSerializer();
+ virtual ~PubSubEventPurgeSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubEventPurge>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventPurge>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h
index 1720847..391d93e 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventRedirectSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventRedirect.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubEventRedirectSerializer : public GenericPayloadSerializer<PubSubEventRedirect> {
public:
PubSubEventRedirectSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventRedirectSerializer();
+ virtual ~PubSubEventRedirectSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubEventRedirect>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventRedirect>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h
index ff2f7e7..5a70fdd 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventRetractSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventRetract.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubEventRetractSerializer : public GenericPayloadSerializer<PubSubEventRetract> {
public:
PubSubEventRetractSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventRetractSerializer();
+ virtual ~PubSubEventRetractSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubEventRetract>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventRetract>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h
index bebb101..f16a749 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -10,7 +10,6 @@
#include <vector>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEvent.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -20,9 +19,9 @@ namespace Swift {
class SWIFTEN_API PubSubEventSerializer : public GenericPayloadSerializer<PubSubEvent> {
public:
PubSubEventSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventSerializer();
+ virtual ~PubSubEventSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubEvent>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEvent>) const override;
private:
std::vector< std::shared_ptr<PayloadSerializer> > pubsubSerializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h
index 7d85ba1..80830ac 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubEventSubscriptionSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubEventSubscription.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubEventSubscriptionSerializer : public GenericPayloadSerializer<PubSubEventSubscription> {
public:
PubSubEventSubscriptionSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubEventSubscriptionSerializer();
+ virtual ~PubSubEventSubscriptionSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubEventSubscription>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubEventSubscription>) const override;
private:
static std::string serializeSubscriptionType(PubSubEventSubscription::SubscriptionType);
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h
index 866d09b..54a8ead 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubItemSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubItem.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubItemSerializer : public GenericPayloadSerializer<PubSubItem> {
public:
PubSubItemSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubItemSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubItem>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubItemSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubItem>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp
index 9786f51..b2c7326 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.cpp
@@ -37,7 +37,7 @@ std::string PubSubItemsSerializer::serializePayload(std::shared_ptr<PubSubItems>
element.addNode(std::make_shared<XMLRawTextNode>(PubSubItemSerializer(serializers).serialize(item)));
}
if (payload->getMaximumItems()) {
- element.setAttribute("max_items", boost::lexical_cast<std::string>(*payload->getMaximumItems()));
+ element.setAttribute("max_items", std::to_string(*payload->getMaximumItems()));
}
if (payload->getSubscriptionID()) {
element.setAttribute("subid", *payload->getSubscriptionID());
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h
index 51b0578..416c47e 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubItemsSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubItems.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubItemsSerializer : public GenericPayloadSerializer<PubSubItems> {
public:
PubSubItemsSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubItemsSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubItems>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubItemsSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubItems>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h
index 0b7a9a7..6f30756 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOptionsSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOptions.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubOptionsSerializer : public GenericPayloadSerializer<PubSubOptions> {
public:
PubSubOptionsSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOptionsSerializer();
+ virtual ~PubSubOptionsSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubOptions>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOptions>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h
index ac6379a..ae97086 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerAffiliation.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerAffiliationSerializer : public GenericPayloadSerializer<PubSubOwnerAffiliation> {
public:
PubSubOwnerAffiliationSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerAffiliationSerializer();
+ virtual ~PubSubOwnerAffiliationSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerAffiliation>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerAffiliation>) const override;
private:
static std::string serializeType(PubSubOwnerAffiliation::Type);
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h
index 6c53189..ed244ff 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerAffiliationsSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerAffiliations.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerAffiliationsSerializer : public GenericPayloadSerializer<PubSubOwnerAffiliations> {
public:
PubSubOwnerAffiliationsSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerAffiliationsSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerAffiliations>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubOwnerAffiliationsSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerAffiliations>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h
index 528f29e..4512eda 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerConfigureSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerConfigure.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerConfigureSerializer : public GenericPayloadSerializer<PubSubOwnerConfigure> {
public:
PubSubOwnerConfigureSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerConfigureSerializer();
+ virtual ~PubSubOwnerConfigureSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerConfigure>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerConfigure>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h
index e41900c..c19b250 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDefaultSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerDefault.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerDefaultSerializer : public GenericPayloadSerializer<PubSubOwnerDefault> {
public:
PubSubOwnerDefaultSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerDefaultSerializer();
+ virtual ~PubSubOwnerDefaultSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerDefault>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerDefault>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h
index c06a916..7a0cecc 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerDeleteSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerDelete.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerDeleteSerializer : public GenericPayloadSerializer<PubSubOwnerDelete> {
public:
PubSubOwnerDeleteSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerDeleteSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerDelete>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubOwnerDeleteSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerDelete>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h
index b179c82..13889b6 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -10,7 +10,6 @@
#include <vector>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerPubSub.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -20,9 +19,9 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerPubSubSerializer : public GenericPayloadSerializer<PubSubOwnerPubSub> {
public:
PubSubOwnerPubSubSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerPubSubSerializer();
+ virtual ~PubSubOwnerPubSubSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerPubSub>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerPubSub>) const override;
private:
std::vector< std::shared_ptr<PayloadSerializer> > pubsubSerializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h
index 32f6523..d361928 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerPurgeSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerPurge.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerPurgeSerializer : public GenericPayloadSerializer<PubSubOwnerPurge> {
public:
PubSubOwnerPurgeSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerPurgeSerializer();
+ virtual ~PubSubOwnerPurgeSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerPurge>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerPurge>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h
index cd78fc8..c35b3ea 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerRedirectSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerRedirect.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerRedirectSerializer : public GenericPayloadSerializer<PubSubOwnerRedirect> {
public:
PubSubOwnerRedirectSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerRedirectSerializer();
+ virtual ~PubSubOwnerRedirectSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerRedirect>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerRedirect>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h
index 9f9e80d..52089b7 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerSubscription.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerSubscriptionSerializer : public GenericPayloadSerializer<PubSubOwnerSubscription> {
public:
PubSubOwnerSubscriptionSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerSubscriptionSerializer();
+ virtual ~PubSubOwnerSubscriptionSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerSubscription>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerSubscription>) const override;
private:
static std::string serializeSubscriptionType(PubSubOwnerSubscription::SubscriptionType);
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h
index 0c282b4..42956cf 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubOwnerSubscriptionsSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubOwnerSubscriptions.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerSubscriptionsSerializer : public GenericPayloadSerializer<PubSubOwnerSubscriptions> {
public:
PubSubOwnerSubscriptionsSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubOwnerSubscriptionsSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubOwnerSubscriptions>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubOwnerSubscriptionsSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubOwnerSubscriptions>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h
index fb1af2e..5eeb8bf 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubPublishSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubPublish.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubPublishSerializer : public GenericPayloadSerializer<PubSubPublish> {
public:
PubSubPublishSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubPublishSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubPublish>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubPublishSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubPublish>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h
index 64737df..23b6b59 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubRetractSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubRetract.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubRetractSerializer : public GenericPayloadSerializer<PubSubRetract> {
public:
PubSubRetractSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubRetractSerializer();
+ virtual ~PubSubRetractSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubRetract>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubRetract>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.h
index 829f827..fb14c29 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSub.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubSerializer : public GenericPayloadSerializer<PubSub> {
public:
PubSubSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubSerializer();
+ virtual ~PubSubSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSub>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSub>) const override;
private:
std::vector< std::shared_ptr<PayloadSerializer> > pubsubSerializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h
index fba02fe..028a437 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeOptionsSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubSubscribeOptions.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubSubscribeOptionsSerializer : public GenericPayloadSerializer<PubSubSubscribeOptions> {
public:
PubSubSubscribeOptionsSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubSubscribeOptionsSerializer();
+ virtual ~PubSubSubscribeOptionsSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubSubscribeOptions>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubSubscribeOptions>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h
index b48e849..1c0070b 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscribeSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubSubscribe.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubSubscribeSerializer : public GenericPayloadSerializer<PubSubSubscribe> {
public:
PubSubSubscribeSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubSubscribeSerializer();
+ virtual ~PubSubSubscribeSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubSubscribe>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubSubscribe>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h
index 5a5f847..b849269 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubSubscription.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,9 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubSubscriptionSerializer : public GenericPayloadSerializer<PubSubSubscription> {
public:
PubSubSubscriptionSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubSubscriptionSerializer();
+ virtual ~PubSubSubscriptionSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubSubscription>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubSubscription>) const override;
private:
static std::string serializeSubscriptionType(PubSubSubscription::SubscriptionType);
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h
index caeb3ef..1430cdf 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubSubscriptionsSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubSubscriptions.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,12 +18,9 @@ namespace Swift {
class SWIFTEN_API PubSubSubscriptionsSerializer : public GenericPayloadSerializer<PubSubSubscriptions> {
public:
PubSubSubscriptionsSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubSubscriptionsSerializer();
-
- virtual std::string serializePayload(std::shared_ptr<PubSubSubscriptions>) const SWIFTEN_OVERRIDE;
-
- private:
+ virtual ~PubSubSubscriptionsSerializer() override;
+ virtual std::string serializePayload(std::shared_ptr<PubSubSubscriptions>) const override;
private:
PayloadSerializerCollection* serializers;
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h b/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h
index 959bd9f..002d337 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PubSubUnsubscribeSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubUnsubscribe.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API PubSubUnsubscribeSerializer : public GenericPayloadSerializer<PubSubUnsubscribe> {
public:
PubSubUnsubscribeSerializer(PayloadSerializerCollection* serializers);
- virtual ~PubSubUnsubscribeSerializer();
+ virtual ~PubSubUnsubscribeSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<PubSubUnsubscribe>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<PubSubUnsubscribe>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.cpp
new file mode 100644
index 0000000..6e78a8d
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.cpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.h>
+
+#include <memory>
+
+#include <Swiften/Base/Log.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+
+namespace Swift {
+
+ReferencePayloadSerializer::ReferencePayloadSerializer(PayloadSerializerCollection* payloadSerializers) : GenericPayloadSerializer<ReferencePayload>(), payloadSerializers_(payloadSerializers) {
+}
+
+std::string ReferencePayloadSerializer::serializePayload(ReferencePayload::ref reference) const {
+ XMLElement element("reference", "urn:xmpp:reference:0");
+
+ auto type = reference->getType();
+ if (type != ReferencePayload::Type::Unknown) {
+ element.setAttribute("type", getTypeString(type));
+
+ if (auto uri = reference->getUri()) {
+ element.setAttribute("uri", *uri);
+ }
+ if (auto begin = reference->getBegin()) {
+ element.setAttribute("begin", *begin);
+ }
+ if (auto end = reference->getEnd()) {
+ element.setAttribute("end", *end);
+ }
+ if (auto anchor = reference->getAnchor()) {
+ element.setAttribute("anchor", *anchor);
+ }
+
+ std::string serializedPayloads;
+ for (const auto& payload : reference->getPayloads()) {
+ if (auto serializer = payloadSerializers_->getPayloadSerializer(payload)) {
+ element.addNode(std::make_shared<XMLRawTextNode>(serializer->serialize(payload)));
+ }
+ else {
+ SWIFT_LOG(warning) << "Could not find serializer for " << typeid(*(payload.get())).name() << std::endl;
+ }
+ }
+ }
+ return element.serialize();
+}
+
+const std::string ReferencePayloadSerializer::getTypeString(const ReferencePayload::Type type) const {
+ switch(type) {
+ case ReferencePayload::Type::Data: return "data";
+ case ReferencePayload::Type::Mention: return "mention";
+ case ReferencePayload::Type::PubSub: return "pubsub";
+ case ReferencePayload::Type::Unknown: return "unknown";
+ }
+ return "";
+}
+
+}
diff --git a/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.h
new file mode 100644
index 0000000..2af6045
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/ReferencePayload.h>
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+
+namespace Swift {
+ class PayloadSerializerCollection;
+
+ class SWIFTEN_API ReferencePayloadSerializer : public GenericPayloadSerializer<ReferencePayload> {
+ public:
+ ReferencePayloadSerializer(PayloadSerializerCollection* payloadSerializers);
+ virtual std::string serializePayload(ReferencePayload::ref reference) const;
+
+ private:
+ const std::string getTypeString(const ReferencePayload::Type type) const;
+
+ PayloadSerializerCollection* payloadSerializers_;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp
index 3302863..3d13ce3 100644
--- a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.cpp
@@ -29,21 +29,21 @@ std::string ResultSetSerializer::serializePayload(std::shared_ptr<ResultSet> pay
XMLElement element("set", "http://jabber.org/protocol/rsm");
if (payload->getMaxItems()) {
- element.addNode(std::make_shared<XMLElement>("max", "", boost::lexical_cast<std::string>(*payload->getMaxItems())));
+ element.addNode(std::make_shared<XMLElement>("max", "", std::to_string(*payload->getMaxItems())));
}
if (payload->getCount()) {
- element.addNode(std::make_shared<XMLElement>("count", "", boost::lexical_cast<std::string>(*payload->getCount())));
+ element.addNode(std::make_shared<XMLElement>("count", "", std::to_string(*payload->getCount())));
}
if (payload->getIndex()) {
- element.addNode(std::make_shared<XMLElement>("index", "", boost::lexical_cast<std::string>(*payload->getIndex())));
+ element.addNode(std::make_shared<XMLElement>("index", "", std::to_string(*payload->getIndex())));
}
if (payload->getFirstID()) {
std::shared_ptr<XMLElement> firstElement = std::make_shared<XMLElement>("first", "", *payload->getFirstID());
if (payload->getFirstIDIndex()) {
- firstElement->setAttribute("index", boost::lexical_cast<std::string>(*payload->getFirstIDIndex()));
+ firstElement->setAttribute("index", std::to_string(*payload->getFirstIDIndex()));
}
element.addNode(firstElement);
}
diff --git a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h
index 6a1429a..6f850eb 100644
--- a/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/ResultSet.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -17,8 +16,8 @@ namespace Swift {
class SWIFTEN_API ResultSetSerializer : public GenericPayloadSerializer<ResultSet> {
public:
ResultSetSerializer();
- virtual ~ResultSetSerializer();
+ virtual ~ResultSetSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<ResultSet>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<ResultSet>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h b/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h
index 14cbd14..e992f72 100644
--- a/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h
@@ -29,7 +29,7 @@ namespace Swift {
if (s5bProxyRequest && s5bProxyRequest->getStreamHost()) {
std::shared_ptr<XMLElement> streamHost = std::make_shared<XMLElement>("streamhost");
streamHost->setAttribute("host", s5bProxyRequest->getStreamHost().get().host);
- streamHost->setAttribute("port", boost::lexical_cast<std::string>(s5bProxyRequest->getStreamHost().get().port));
+ streamHost->setAttribute("port", std::to_string(s5bProxyRequest->getStreamHost().get().port));
streamHost->setAttribute("jid", s5bProxyRequest->getStreamHost().get().jid.toString());
queryElement.addNode(streamHost);
} else if (s5bProxyRequest && s5bProxyRequest->getActivate()) {
diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp
index ba296f9..718e550 100644
--- a/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp
@@ -40,7 +40,7 @@ std::string StreamInitiationFileInfoSerializer::serializePayload(std::shared_ptr
fileElement.setAttribute("name", fileInfo->getName());
}
if (fileInfo->getSize() != 0) {
- fileElement.setAttribute("size", boost::lexical_cast<std::string>(fileInfo->getSize()));
+ fileElement.setAttribute("size", std::to_string(fileInfo->getSize()));
}
if (!fileInfo->getDescription().empty()) {
std::shared_ptr<XMLElement> desc = std::make_shared<XMLElement>("desc", "", fileInfo->getDescription());
@@ -49,7 +49,7 @@ std::string StreamInitiationFileInfoSerializer::serializePayload(std::shared_ptr
if (fileInfo->getSupportsRangeRequests()) {
std::shared_ptr<XMLElement> range = std::make_shared<XMLElement>("range");
if (fileInfo->getRangeOffset() != 0) {
- range->setAttribute("offset", boost::lexical_cast<std::string>(fileInfo->getRangeOffset()));
+ range->setAttribute("offset", std::to_string(fileInfo->getRangeOffset()));
}
fileElement.addNode(range);
}
diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
index 3faa5b7..813edb4 100644
--- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
@@ -38,7 +38,7 @@ std::string StreamInitiationSerializer::serializePayload(std::shared_ptr<StreamI
std::shared_ptr<XMLElement> fileElement(new XMLElement("file", "http://jabber.org/protocol/si/profile/file-transfer"));
fileElement->setAttribute("name", file.getName());
if (file.getSize() != 0) {
- fileElement->setAttribute("size", boost::lexical_cast<std::string>(file.getSize()));
+ fileElement->setAttribute("size", std::to_string(file.getSize()));
}
if (!file.getDescription().empty()) {
std::shared_ptr<XMLElement> descElement(new XMLElement("desc"));
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXCreateSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXCreateSerializerTest.cpp
index 78424be..80210a5 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXCreateSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXCreateSerializerTest.cpp
@@ -14,7 +14,7 @@ TEST(MIXCreateSerializerTest, XEP0369_Example31) {
MIXCreateSerializer testling;
auto create = std::make_shared<MIXCreate>();
- std::string expectedResult = "<create xmlns=\"urn:xmpp:mix:1\"/>";
+ std::string expectedResult = "<create xmlns=\"urn:xmpp:mix:0\"/>";
ASSERT_EQ(expectedResult, testling.serialize(create));
}
@@ -24,6 +24,6 @@ TEST(MIXCreateSerializerTest, XEP0369_Example66) {
auto create = std::make_shared<MIXCreate>();
create->setChannel(std::string("coven"));
- std::string expectedResult = "<create channel=\"coven\" xmlns=\"urn:xmpp:mix:1\"/>";
+ std::string expectedResult = "<create channel=\"coven\" xmlns=\"urn:xmpp:mix:0\"/>";
ASSERT_EQ(expectedResult, testling.serialize(create));
}
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXDestroySerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXDestroySerializerTest.cpp
index e9cfa8b..5b21873 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXDestroySerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXDestroySerializerTest.cpp
@@ -16,6 +16,6 @@ TEST(MIXDestroySerializerTest, XEP0369_Example31) {
auto destroy = std::make_shared<MIXDestroy>();
destroy->setChannel(std::string("coven"));
- std::string expectedResult = "<destroy channel=\"coven\" xmlns=\"urn:xmpp:mix:1\"/>";
+ std::string expectedResult = "<destroy channel=\"coven\" xmlns=\"urn:xmpp:mix:0\"/>";
ASSERT_EQ(expectedResult, testling.serialize(destroy));
}
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXJoinSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXJoinSerializerTest.cpp
index 61d8a4a..2987a20 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXJoinSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXJoinSerializerTest.cpp
@@ -16,24 +16,16 @@ TEST(MIXJoinSerializerTest, XEP0369_Example22) {
auto join = std::make_shared<MIXJoin>();
join->setChannel(JID("coven@mix.shakespeare.example"));
- std::shared_ptr<MIXSubscribe> node1(new MIXSubscribe());
- node1->setNode(std::string("urn:xmpp:mix:nodes:messages"));
- join->addSubscription(node1);
- std::shared_ptr<MIXSubscribe> node2(new MIXSubscribe());
- node2->setNode(std::string("urn:xmpp:mix:nodes:presence"));
- join->addSubscription(node2);
- std::shared_ptr<MIXSubscribe> node3(new MIXSubscribe());
- node3->setNode(std::string("urn:xmpp:mix:nodes:participants"));
- join->addSubscription(node3);
- std::shared_ptr<MIXSubscribe> node4(new MIXSubscribe());
- node4->setNode(std::string("urn:xmpp:mix:nodes:config"));
- join->addSubscription(node4);
-
- std::string expectedResult = "<join channel=\"coven@mix.shakespeare.example\" xmlns=\"urn:xmpp:mix:1\">"
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:messages"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:presence"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:participants"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:config"));
+
+ std::string expectedResult = "<join channel=\"coven@mix.shakespeare.example\" xmlns=\"urn:xmpp:mix:0\">"
+ "<subscribe node=\"urn:xmpp:mix:nodes:config\"/>"
"<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
- "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
"<subscribe node=\"urn:xmpp:mix:nodes:participants\"/>"
- "<subscribe node=\"urn:xmpp:mix:nodes:config\"/>"
+ "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
"</join>";
ASSERT_EQ(expectedResult, testling.serialize(join));
}
@@ -43,24 +35,16 @@ TEST(MIXJoinSerializerTest, XEP0369_Example23) {
std::shared_ptr<MIXJoin> join(new MIXJoin());
- std::shared_ptr<MIXSubscribe> node1(new MIXSubscribe());
- node1->setNode(std::string("urn:xmpp:mix:nodes:messages"));
- join->addSubscription(node1);
- std::shared_ptr<MIXSubscribe> node2(new MIXSubscribe());
- node2->setNode(std::string("urn:xmpp:mix:nodes:presence"));
- join->addSubscription(node2);
- std::shared_ptr<MIXSubscribe> node3(new MIXSubscribe());
- node3->setNode(std::string("urn:xmpp:mix:nodes:participants"));
- join->addSubscription(node3);
- std::shared_ptr<MIXSubscribe> node4(new MIXSubscribe());
- node4->setNode(std::string("urn:xmpp:mix:nodes:config"));
- join->addSubscription(node4);
-
- std::string expectedResult = "<join xmlns=\"urn:xmpp:mix:1\">"
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:messages"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:presence"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:participants"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:config"));
+
+ std::string expectedResult = "<join xmlns=\"urn:xmpp:mix:0\">"
+ "<subscribe node=\"urn:xmpp:mix:nodes:config\"/>"
"<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
- "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
"<subscribe node=\"urn:xmpp:mix:nodes:participants\"/>"
- "<subscribe node=\"urn:xmpp:mix:nodes:config\"/>"
+ "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
"</join>";
ASSERT_EQ(expectedResult, testling.serialize(join));
}
@@ -71,24 +55,16 @@ TEST(MIXJoinSerializerTest, XEP0369_Example24) {
std::shared_ptr<MIXJoin> join(new MIXJoin());
join->setJID(JID("123456#coven@mix.shakespeare.example"));
- std::shared_ptr<MIXSubscribe> node1(new MIXSubscribe());
- node1->setNode(std::string("urn:xmpp:mix:nodes:messages"));
- join->addSubscription(node1);
- std::shared_ptr<MIXSubscribe> node2(new MIXSubscribe());
- node2->setNode(std::string("urn:xmpp:mix:nodes:presence"));
- join->addSubscription(node2);
- std::shared_ptr<MIXSubscribe> node3(new MIXSubscribe());
- node3->setNode(std::string("urn:xmpp:mix:nodes:participants"));
- join->addSubscription(node3);
- std::shared_ptr<MIXSubscribe> node4(new MIXSubscribe());
- node4->setNode(std::string("urn:xmpp:mix:nodes:config"));
- join->addSubscription(node4);
-
- std::string expectedResult = "<join jid=\"123456#coven@mix.shakespeare.example\" xmlns=\"urn:xmpp:mix:1\">"
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:messages"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:presence"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:participants"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:config"));
+
+ std::string expectedResult = "<join jid=\"123456#coven@mix.shakespeare.example\" xmlns=\"urn:xmpp:mix:0\">"
+ "<subscribe node=\"urn:xmpp:mix:nodes:config\"/>"
"<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
- "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
"<subscribe node=\"urn:xmpp:mix:nodes:participants\"/>"
- "<subscribe node=\"urn:xmpp:mix:nodes:config\"/>"
+ "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
"</join>";
ASSERT_EQ(expectedResult, testling.serialize(join));
}
@@ -98,19 +74,15 @@ TEST(MIXJoinSerializerTest, XEP0369_Example29) {
std::shared_ptr<MIXJoin> join(new MIXJoin());
- std::shared_ptr<MIXSubscribe> node1(new MIXSubscribe());
- node1->setNode(std::string("urn:xmpp:mix:nodes:messages"));
- join->addSubscription(node1);
- std::shared_ptr<MIXSubscribe> node2(new MIXSubscribe());
- node2->setNode(std::string("urn:xmpp:mix:nodes:presence"));
- join->addSubscription(node2);
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:messages"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:presence"));
std::shared_ptr<Form> parameters(std::make_shared<Form>());
parameters->setType(Form::Type::SubmitType);
std::shared_ptr<FormField> fieldType = std::make_shared<FormField>(FormField::HiddenType);
fieldType->setName("FORM_TYPE");
- fieldType->addValue("urn:xmpp:mix:1");
+ fieldType->addValue("urn:xmpp:mix:0");
parameters->addField(fieldType);
std::shared_ptr<FormField> fieldJIDVisibility = std::make_shared<FormField>();
@@ -120,12 +92,12 @@ TEST(MIXJoinSerializerTest, XEP0369_Example29) {
join->setForm(parameters);
- std::string expectedResult = "<join xmlns=\"urn:xmpp:mix:1\">"
+ std::string expectedResult = "<join xmlns=\"urn:xmpp:mix:0\">"
"<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
"<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
"<x type=\"submit\" xmlns=\"jabber:x:data\">"
"<field type=\"hidden\" var=\"FORM_TYPE\">"
- "<value>urn:xmpp:mix:1</value>"
+ "<value>urn:xmpp:mix:0</value>"
"</field>"
"<field var=\"JID Visibility\">"
"<value>never</value>"
@@ -141,19 +113,15 @@ TEST(MIXJoinSerializerTest, XEP0369_Example30) {
std::shared_ptr<MIXJoin> join(new MIXJoin());
join->setJID(JID("hag66@shakespeare.example"));
- std::shared_ptr<MIXSubscribe> node1(new MIXSubscribe());
- node1->setNode(std::string("urn:xmpp:mix:nodes:messages"));
- join->addSubscription(node1);
- std::shared_ptr<MIXSubscribe> node2(new MIXSubscribe());
- node2->setNode(std::string("urn:xmpp:mix:nodes:presence"));
- join->addSubscription(node2);
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:messages"));
+ join->addSubscription(std::string("urn:xmpp:mix:nodes:presence"));
std::shared_ptr<Form> parameters(std::make_shared<Form>());
parameters->setType(Form::Type::ResultType);
std::shared_ptr<FormField> fieldType = std::make_shared<FormField>(FormField::HiddenType);
fieldType->setName("FORM_TYPE");
- fieldType->addValue("urn:xmpp:mix:1");
+ fieldType->addValue("urn:xmpp:mix:0");
parameters->addField(fieldType);
std::shared_ptr<FormField> fieldJIDVisibility = std::make_shared<FormField>();
@@ -173,12 +141,12 @@ TEST(MIXJoinSerializerTest, XEP0369_Example30) {
join->setForm(parameters);
- std::string expectedResult = "<join jid=\"hag66@shakespeare.example\" xmlns=\"urn:xmpp:mix:1\">"
+ std::string expectedResult = "<join jid=\"hag66@shakespeare.example\" xmlns=\"urn:xmpp:mix:0\">"
"<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
"<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
"<x type=\"result\" xmlns=\"jabber:x:data\">"
"<field type=\"hidden\" var=\"FORM_TYPE\">"
- "<value>urn:xmpp:mix:1</value>"
+ "<value>urn:xmpp:mix:0</value>"
"</field>"
"<field var=\"JID Visibility\">"
"<value>never</value>"
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXLeaveSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXLeaveSerializerTest.cpp
new file mode 100644
index 0000000..d9537a8
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXLeaveSerializerTest.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <gtest/gtest.h>
+
+#include <Swiften/Serializer/PayloadSerializers/MIXLeaveSerializer.h>
+
+using namespace Swift;
+
+TEST(MIXLeaveSerializerTest, XEP0369_Example33) {
+ MIXLeaveSerializer testling;
+
+ auto leave = std::shared_ptr<MIXLeave>(new MIXLeave());
+ leave->setChannel(JID("coven@mix.shakespeare.example"));
+
+ std::string expectedResult = "<leave channel=\"coven@mix.shakespeare.example\" xmlns=\"urn:xmpp:mix:0\"/>";
+ ASSERT_EQ(expectedResult, testling.serialize(leave));
+}
+
+TEST(MIXLeaveSerializerTest, XEP0369_Example34) {
+ MIXLeaveSerializer testling;
+
+ auto leave = std::shared_ptr<MIXLeave>(new MIXLeave());
+
+ std::string expectedResult = "<leave xmlns=\"urn:xmpp:mix:0\"/>";
+ ASSERT_EQ(expectedResult, testling.serialize(leave));
+}
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXPayloadSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXPayloadSerializerTest.cpp
new file mode 100644
index 0000000..266b066
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXPayloadSerializerTest.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <gtest/gtest.h>
+
+#include <Swiften/Serializer/PayloadSerializers/MIXPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
+
+using namespace Swift;
+
+TEST(MIXPayloadSerializerTest, testSerializeEmpty) {
+ MIXPayloadSerializer testling;
+
+ auto mix = std::shared_ptr<MIXPayload>(new MIXPayload());
+
+ std::string expectedResult = "<mix xmlns=\"urn:xmpp:mix:0\"/>";
+ ASSERT_EQ(expectedResult, testling.serialize(mix));
+}
+
+TEST(MIXPayloadSerializerTest, testSerializeNick) {
+ MIXPayloadSerializer testling;
+
+ auto mix = std::shared_ptr<MIXPayload>(new MIXPayload());
+ mix->setNick("thirdwitch");
+
+ std::string expectedResult = "<mix xmlns=\"urn:xmpp:mix:0\">"
+ "<nick>thirdwitch</nick>"
+ "</mix>";
+ ASSERT_EQ(expectedResult, testling.serialize(mix));
+}
+
+TEST(MIXPayloadSerializerTest, testSerializeJID) {
+ MIXPayloadSerializer testling;
+
+ auto mix = std::shared_ptr<MIXPayload>(new MIXPayload());
+ mix->setJID(JID("hecate@mix.shakespeare.example"));
+
+ std::string expectedResult = "<mix xmlns=\"urn:xmpp:mix:0\">"
+ "<jid>hecate@mix.shakespeare.example</jid>"
+ "</mix>";
+ ASSERT_EQ(expectedResult, testling.serialize(mix));
+}
+
+TEST(MIXPayloadSerializerTest, testSerializeAll) {
+ MIXPayloadSerializer testling;
+
+ auto mix = std::shared_ptr<MIXPayload>(new MIXPayload());
+ mix->setNick("thirdwitch");
+ mix->setJID(JID("hecate@mix.shakespeare.example"));
+ mix->setSubmissionID("92vax143g");
+
+ std::string expectedResult = "<mix xmlns=\"urn:xmpp:mix:0\">"
+ "<nick>thirdwitch</nick>"
+ "<jid>hecate@mix.shakespeare.example</jid>"
+ "<submission-id>92vax143g</submission-id>"
+ "</mix>";
+ ASSERT_EQ(expectedResult, testling.serialize(mix));
+}
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXRegisterNickSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXRegisterNickSerializerTest.cpp
new file mode 100644
index 0000000..dc6cf0c
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXRegisterNickSerializerTest.cpp
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <gtest/gtest.h>
+
+#include <Swiften/Serializer/PayloadSerializers/MIXRegisterNickSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
+
+using namespace Swift;
+
+TEST(MIXRegisterNickSerializerTest, testSerializeNick) {
+ MIXRegisterNickSerializer testling;
+
+ auto mix = std::shared_ptr<MIXRegisterNick>(new MIXRegisterNick());
+ mix->setNick(std::string("thirdwitch"));
+
+ std::string expectedResult = "<register xmlns=\"urn:xmpp:mix:0\"><nick>thirdwitch</nick></register>";
+ ASSERT_EQ(expectedResult, testling.serialize(mix));
+}
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXSetNickSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXSetNickSerializerTest.cpp
new file mode 100644
index 0000000..ab29bc5
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXSetNickSerializerTest.cpp
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <gtest/gtest.h>
+
+#include <Swiften/Serializer/PayloadSerializers/MIXSetNickSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
+
+using namespace Swift;
+
+TEST(MIXSetNickSerializerTest, testSerializeNick) {
+ MIXSetNickSerializer testling;
+
+ auto mix = std::shared_ptr<MIXSetNick>(new MIXSetNick());
+ mix->setNick(std::string("thirdwitch"));
+
+ std::string expectedResult = "<setnick xmlns=\"urn:xmpp:mix:0\"><nick>thirdwitch</nick></setnick>";
+ ASSERT_EQ(expectedResult, testling.serialize(mix));
+}
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXUpdateSubscriptionSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXUpdateSubscriptionSerializerTest.cpp
new file mode 100644
index 0000000..3e35a82
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXUpdateSubscriptionSerializerTest.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <gtest/gtest.h>
+
+#include <Swiften/Serializer/PayloadSerializers/MIXUpdateSubscriptionSerializer.h>
+
+using namespace Swift;
+
+TEST(MIXUpdateSubscriptionSerializerTest, XEP0369_Example28) {
+ MIXUpdateSubscriptionSerializer testling;
+
+ auto update = std::make_shared<MIXUpdateSubscription>();
+ update->addSubscription(std::string("urn:xmpp:mix:nodes:messages"));
+
+ std::string expectedResult = "<update-subscription xmlns=\"urn:xmpp:mix:0\">"
+ "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
+ "</update-subscription>";
+ ASSERT_EQ(expectedResult, testling.serialize(update));
+}
+
+TEST(MIXUpdateSubscriptionSerializerTest, XEP0369_Example28WithJID) {
+ MIXUpdateSubscriptionSerializer testling;
+
+ auto update = std::make_shared<MIXUpdateSubscription>();
+ update->setJID(JID("hag66@shakespeare.example"));
+ update->addSubscription(std::string("urn:xmpp:mix:nodes:messages"));
+
+ std::string expectedResult = "<update-subscription jid=\"hag66@shakespeare.example\" xmlns=\"urn:xmpp:mix:0\">"
+ "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
+ "</update-subscription>";
+ ASSERT_EQ(expectedResult, testling.serialize(update));
+}
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXUserPreferenceSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXUserPreferenceSerializerTest.cpp
index 7cbfbfc..0226b0f 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/MIXUserPreferenceSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/MIXUserPreferenceSerializerTest.cpp
@@ -15,7 +15,7 @@ TEST(MIXUserPreferenceSerializerTest, XEP0369_Example31) {
MIXUserPreferenceSerializer testling;
auto userpreference = std::shared_ptr<MIXUserPreference>(new MIXUserPreference());
- std::string expectedResult = "<user-preference xmlns=\"urn:xmpp:mix:1\"/>";
+ std::string expectedResult = "<user-preference xmlns=\"urn:xmpp:mix:0\"/>";
ASSERT_EQ(expectedResult, testling.serialize(userpreference));
}
@@ -28,7 +28,7 @@ TEST(MIXUserPreferenceSerializerTest, XEP0369_Example32) {
std::shared_ptr<FormField> fieldType = std::make_shared<FormField>(FormField::HiddenType);
fieldType->setName("FORM_TYPE");
- fieldType->addValue("urn:xmpp:mix:1");
+ fieldType->addValue("urn:xmpp:mix:0");
parameters->addField(fieldType);
std::shared_ptr<FormField> fieldJIDVisibility = std::make_shared<FormField>();
@@ -48,10 +48,10 @@ TEST(MIXUserPreferenceSerializerTest, XEP0369_Example32) {
userpreference->setData(parameters);
- std::string expectedResult = "<user-preference xmlns=\"urn:xmpp:mix:1\">"
+ std::string expectedResult = "<user-preference xmlns=\"urn:xmpp:mix:0\">"
"<x type=\"result\" xmlns=\"jabber:x:data\">"
"<field type=\"hidden\" var=\"FORM_TYPE\">"
- "<value>urn:xmpp:mix:1</value>"
+ "<value>urn:xmpp:mix:0</value>"
"</field>"
"<field var=\"JID Visibility\">"
"<value>never</value>"
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ReferencePayloadSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ReferencePayloadSerializerTest.cpp
new file mode 100644
index 0000000..82465d7
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ReferencePayloadSerializerTest.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <gtest/gtest.h>
+
+#include <Swiften/Serializer/PayloadSerializers/ReferencePayloadSerializer.h>
+
+#include <Swiften/Elements/Body.h>
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
+
+using namespace Swift;
+
+static FullPayloadSerializerCollection serializers;
+
+TEST(ReferencePayloadSerializerTest, testSerialize) {
+ ReferencePayloadSerializer testling(&serializers);
+ auto reference = std::make_shared<ReferencePayload>();
+ reference->setType(ReferencePayload::Type::Data);
+ reference->setUri(boost::optional<std::string>("https://www.example.com/mindBlowingImage.jpeg"));
+ reference->setBegin(boost::optional<std::string>("11"));
+ reference->setEnd(boost::optional<std::string>("22"));
+ reference->setAnchor(boost::optional<std::string>("xmpp:data@localhost.example.test"));
+
+ std::string expectedResult =
+ "<reference "
+ "anchor=\"xmpp:data@localhost.example.test\" "
+ "begin=\"11\" "
+ "end=\"22\" "
+ "type=\"data\" "
+ "uri=\"https://www.example.com/mindBlowingImage.jpeg\" "
+ "xmlns=\"urn:xmpp:reference:0\"/>";
+
+ ASSERT_EQ(expectedResult, testling.serialize(reference));
+}
+
+TEST(ReferencePayloadSerializerTest, testSerializeNoType) {
+ ReferencePayloadSerializer testling(&serializers);
+ auto reference = std::make_shared<ReferencePayload>();
+ reference->setUri(boost::optional<std::string>("https://www.example.com/mindBlowingImage.jpeg"));
+ reference->setBegin(boost::optional<std::string>("11"));
+ reference->setEnd(boost::optional<std::string>("22"));
+ reference->setAnchor(boost::optional<std::string>("xmpp:data@localhost.example.test"));
+
+ std::string expectedResult =
+ "<reference "
+ "anchor=\"xmpp:data@localhost.example.test\" "
+ "begin=\"11\" "
+ "end=\"22\" "
+ "type=\"data\" "
+ "uri=\"https://www.example.com/mindBlowingImage.jpeg\" "
+ "xmlns=\"urn:xmpp:reference:0\"/>";
+
+ ASSERT_EQ(expectedResult, testling.serialize(reference));
+}
+
+TEST(ReferencePayloadSerializerTest, testSerializeWithEmbeddedPayload) {
+ ReferencePayloadSerializer testling(&serializers);
+ auto reference = std::make_shared<ReferencePayload>();
+ reference->setUri(boost::optional<std::string>("https://www.example.com/mindBlowingImage.jpeg"));
+ reference->setBegin(boost::optional<std::string>("11"));
+ reference->setEnd(boost::optional<std::string>("22"));
+ reference->setAnchor(boost::optional<std::string>("xmpp:data@localhost.example.test"));
+ auto payload = std::make_shared<Body>(std::string("Look, I'm in a reference"));
+ reference->addPayload(payload);
+
+ std::string expectedResult =
+ "<reference "
+ "anchor=\"xmpp:data@localhost.example.test\" "
+ "begin=\"11\" "
+ "end=\"22\" "
+ "type=\"data\" "
+ "uri=\"https://www.example.com/mindBlowingImage.jpeg\" "
+ "xmlns=\"urn:xmpp:reference:0\">"
+ "<body>Look, I'm in a reference</body>"
+ "</reference>";
+
+ ASSERT_EQ(expectedResult, testling.serialize(reference));
+}
diff --git a/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h b/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h
index 5d38997..9c2f2db 100644
--- a/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013-2016 Isode Limited.
+ * Copyright (c) 2013-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/UserLocation.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API UserLocationSerializer : public GenericPayloadSerializer<UserLocation> {
public:
UserLocationSerializer(PayloadSerializerCollection* serializers);
- virtual ~UserLocationSerializer();
+ virtual ~UserLocationSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<UserLocation>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<UserLocation>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp
index 687b566..8bb3a4b 100644
--- a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.cpp
@@ -26,7 +26,7 @@ std::string UserTuneSerializer::serializePayload(std::shared_ptr<UserTune> paylo
}
XMLElement element("tune", "http://jabber.org/protocol/tune");
if (payload->getRating()) {
- element.addNode(std::make_shared<XMLElement>("rating", "", boost::lexical_cast<std::string>(*payload->getRating())));
+ element.addNode(std::make_shared<XMLElement>("rating", "", std::to_string(*payload->getRating())));
}
if (payload->getTitle()) {
element.addNode(std::make_shared<XMLElement>("title", "", *payload->getTitle()));
@@ -44,7 +44,7 @@ std::string UserTuneSerializer::serializePayload(std::shared_ptr<UserTune> paylo
element.addNode(std::make_shared<XMLElement>("source", "", *payload->getSource()));
}
if (payload->getLength()) {
- element.addNode(std::make_shared<XMLElement>("length", "", boost::lexical_cast<std::string>(*payload->getLength())));
+ element.addNode(std::make_shared<XMLElement>("length", "", std::to_string(*payload->getLength())));
}
return element.serialize();
}
diff --git a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h
index 06e9a0e..1d5737a 100644
--- a/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016 Isode Limited.
+ * Copyright (c) 2014-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/UserTune.h>
#include <Swiften/Serializer/GenericPayloadSerializer.h>
@@ -19,8 +18,8 @@ namespace Swift {
class SWIFTEN_API UserTuneSerializer : public GenericPayloadSerializer<UserTune> {
public:
UserTuneSerializer(PayloadSerializerCollection* serializers);
- virtual ~UserTuneSerializer();
+ virtual ~UserTuneSerializer() override;
- virtual std::string serializePayload(std::shared_ptr<UserTune>) const SWIFTEN_OVERRIDE;
+ virtual std::string serializePayload(std::shared_ptr<UserTune>) const override;
};
}
diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
index 34fd149..4743089 100644
--- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
@@ -26,13 +26,13 @@ namespace Swift {
void WhiteboardElementSerializingVisitor::visit(WhiteboardLineElement& line) {
element = std::make_shared<XMLElement>("line");
try {
- element->setAttribute("x1", boost::lexical_cast<std::string>(line.x1()));
- element->setAttribute("y1", boost::lexical_cast<std::string>(line.y1()));
- element->setAttribute("x2", boost::lexical_cast<std::string>(line.x2()));
- element->setAttribute("y2", boost::lexical_cast<std::string>(line.y2()));
+ element->setAttribute("x1", std::to_string(line.x1()));
+ element->setAttribute("y1", std::to_string(line.y1()));
+ element->setAttribute("x2", std::to_string(line.x2()));
+ element->setAttribute("y2", std::to_string(line.y2()));
element->setAttribute("id", line.getID());
element->setAttribute("stroke", line.getColor().toHex());
- element->setAttribute("stroke-width", boost::lexical_cast<std::string>(line.getPenWidth()));
+ element->setAttribute("stroke-width", std::to_string(line.getPenWidth()));
element->setAttribute("opacity", alphaToOpacity(line.getColor().getAlpha()));
} catch (boost::bad_lexical_cast&) {
}
@@ -43,14 +43,14 @@ namespace Swift {
element->setAttribute("id", path.getID());
element->setAttribute("stroke", path.getColor().toHex());
try {
- element->setAttribute("stroke-width", boost::lexical_cast<std::string>(path.getPenWidth()));
+ element->setAttribute("stroke-width", std::to_string(path.getPenWidth()));
element->setAttribute("opacity", alphaToOpacity(path.getColor().getAlpha()));
std::string pathData;
if (path.getPoints().size() != 0) {
std::vector<std::pair<int, int> >::const_iterator it = path.getPoints().begin();
- pathData = "M"+boost::lexical_cast<std::string>(it->first)+" "+boost::lexical_cast<std::string>(it->second)+"L";
+ pathData = "M"+std::to_string(it->first)+" "+std::to_string(it->second)+"L";
for (; it != path.getPoints().end(); ++it) {
- pathData += boost::lexical_cast<std::string>(it->first)+" "+boost::lexical_cast<std::string>(it->second)+" ";
+ pathData += std::to_string(it->first)+" "+std::to_string(it->second)+" ";
}
}
element->setAttribute("d", pathData);
@@ -61,14 +61,14 @@ namespace Swift {
void WhiteboardElementSerializingVisitor::visit(WhiteboardRectElement& rect) {
element = std::make_shared<XMLElement>("rect");
try {
- element->setAttribute("x", boost::lexical_cast<std::string>(rect.getX()));
- element->setAttribute("y", boost::lexical_cast<std::string>(rect.getY()));
- element->setAttribute("width", boost::lexical_cast<std::string>(rect.getWidth()));
- element->setAttribute("height", boost::lexical_cast<std::string>(rect.getHeight()));
+ element->setAttribute("x", std::to_string(rect.getX()));
+ element->setAttribute("y", std::to_string(rect.getY()));
+ element->setAttribute("width", std::to_string(rect.getWidth()));
+ element->setAttribute("height", std::to_string(rect.getHeight()));
element->setAttribute("id", rect.getID());
element->setAttribute("stroke", rect.getPenColor().toHex());
element->setAttribute("fill", rect.getBrushColor().toHex());;
- element->setAttribute("stroke-width", boost::lexical_cast<std::string>(rect.getPenWidth()));
+ element->setAttribute("stroke-width", std::to_string(rect.getPenWidth()));
element->setAttribute("opacity", alphaToOpacity(rect.getPenColor().getAlpha()));
element->setAttribute("fill-opacity", alphaToOpacity(rect.getBrushColor().getAlpha()));
} catch (boost::bad_lexical_cast&) {
@@ -81,13 +81,13 @@ namespace Swift {
element->setAttribute("id", polygon.getID());
element->setAttribute("stroke", polygon.getPenColor().toHex());
element->setAttribute("fill", polygon.getBrushColor().toHex());;
- element->setAttribute("stroke-width", boost::lexical_cast<std::string>(polygon.getPenWidth()));
+ element->setAttribute("stroke-width", std::to_string(polygon.getPenWidth()));
element->setAttribute("opacity", alphaToOpacity(polygon.getPenColor().getAlpha()));
element->setAttribute("fill-opacity", alphaToOpacity(polygon.getBrushColor().getAlpha()));
std::string points;
std::vector<std::pair<int, int> >::const_iterator it = polygon.getPoints().begin();
for (; it != polygon.getPoints().end(); ++it) {
- points += boost::lexical_cast<std::string>(it->first)+","+boost::lexical_cast<std::string>(it->second)+" ";
+ points += std::to_string(it->first)+","+std::to_string(it->second)+" ";
}
element->setAttribute("points", points);
} catch (boost::bad_lexical_cast&) {
@@ -97,9 +97,9 @@ namespace Swift {
void WhiteboardElementSerializingVisitor::visit(WhiteboardTextElement& text) {
element = std::make_shared<XMLElement>("text");
try {
- element->setAttribute("x", boost::lexical_cast<std::string>(text.getX()));
- element->setAttribute("y", boost::lexical_cast<std::string>(text.getY()));
- element->setAttribute("font-size", boost::lexical_cast<std::string>(text.getSize()));
+ element->setAttribute("x", std::to_string(text.getX()));
+ element->setAttribute("y", std::to_string(text.getY()));
+ element->setAttribute("font-size", std::to_string(text.getSize()));
element->setAttribute("id", text.getID());
element->setAttribute("fill", text.getColor().toHex());
element->setAttribute("opacity", alphaToOpacity(text.getColor().getAlpha()));
@@ -111,14 +111,14 @@ namespace Swift {
void WhiteboardElementSerializingVisitor::visit(WhiteboardEllipseElement& ellipse) {
element = std::make_shared<XMLElement>("ellipse");
try {
- element->setAttribute("cx", boost::lexical_cast<std::string>(ellipse.getCX()));
- element->setAttribute("cy", boost::lexical_cast<std::string>(ellipse.getCY()));
- element->setAttribute("rx", boost::lexical_cast<std::string>(ellipse.getRX()));
- element->setAttribute("ry", boost::lexical_cast<std::string>(ellipse.getRY()));
+ element->setAttribute("cx", std::to_string(ellipse.getCX()));
+ element->setAttribute("cy", std::to_string(ellipse.getCY()));
+ element->setAttribute("rx", std::to_string(ellipse.getRX()));
+ element->setAttribute("ry", std::to_string(ellipse.getRY()));
element->setAttribute("id", ellipse.getID());
element->setAttribute("stroke", ellipse.getPenColor().toHex());
element->setAttribute("fill", ellipse.getBrushColor().toHex());;
- element->setAttribute("stroke-width", boost::lexical_cast<std::string>(ellipse.getPenWidth()));
+ element->setAttribute("stroke-width", std::to_string(ellipse.getPenWidth()));
element->setAttribute("opacity", alphaToOpacity(ellipse.getPenColor().getAlpha()));
element->setAttribute("fill-opacity", alphaToOpacity(ellipse.getBrushColor().getAlpha()));
} catch (boost::bad_lexical_cast&) {
@@ -134,7 +134,7 @@ namespace Swift {
if (opacity == 100) {
return "1";
} else {
- return "."+boost::lexical_cast<std::string>(opacity);
+ return "."+std::to_string(opacity);
}
}
@@ -148,7 +148,7 @@ namespace Swift {
if (insertOp) {
try {
operationNode->setAttribute("type", "insert");
- operationNode->setAttribute("pos", boost::lexical_cast<std::string>(insertOp->getPos()));
+ operationNode->setAttribute("pos", std::to_string(insertOp->getPos()));
operationNode->setAttribute("id", insertOp->getID());
operationNode->setAttribute("parentid", insertOp->getParentID());
} catch (boost::bad_lexical_cast&) {
@@ -160,10 +160,10 @@ namespace Swift {
if (updateOp) {
try {
operationNode->setAttribute("type", "update");
- operationNode->setAttribute("pos", boost::lexical_cast<std::string>(updateOp->getPos()));
+ operationNode->setAttribute("pos", std::to_string(updateOp->getPos()));
operationNode->setAttribute("id", updateOp->getID());
operationNode->setAttribute("parentid", updateOp->getParentID());
- operationNode->setAttribute("newpos", boost::lexical_cast<std::string>(updateOp->getNewPos()));
+ operationNode->setAttribute("newpos", std::to_string(updateOp->getNewPos()));
} catch (boost::bad_lexical_cast&) {
}
updateOp->getElement()->accept(visitor);
@@ -175,7 +175,7 @@ namespace Swift {
if (deleteOp) {
try {
operationNode->setAttribute("type", "delete");
- operationNode->setAttribute("pos", boost::lexical_cast<std::string>(deleteOp->getPos()));
+ operationNode->setAttribute("pos", std::to_string(deleteOp->getPos()));
operationNode->setAttribute("id", deleteOp->getID());
operationNode->setAttribute("parentid", deleteOp->getParentID());
operationNode->setAttribute("elementid", deleteOp->getElementID());