summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
-rw-r--r--Swiften/Parser/PayloadParsers/BytestreamsParser.cpp7
-rw-r--r--Swiften/Parser/PayloadParsers/ChatStateParserFactory.h4
-rw-r--r--Swiften/Parser/PayloadParsers/ClientStateParserFactory.h8
-rw-r--r--Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h4
-rw-r--r--Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h4
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoInfoParser.h4
-rw-r--r--Swiften/Parser/PayloadParsers/FormParserFactory.h4
-rw-r--r--Swiften/Parser/PayloadParsers/ForwardedParser.h9
-rw-r--r--Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp22
-rw-r--r--Swiften/Parser/PayloadParsers/IBBParser.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp9
-rw-r--r--Swiften/Parser/PayloadParsers/MAMFinParser.h9
-rw-r--r--Swiften/Parser/PayloadParsers/MAMQueryParser.h9
-rw-r--r--Swiften/Parser/PayloadParsers/MAMResultParser.h9
-rw-r--r--Swiften/Parser/PayloadParsers/MIXCreateParser.cpp61
-rw-r--r--Swiften/Parser/PayloadParsers/MIXCreateParser.h37
-rw-r--r--Swiften/Parser/PayloadParsers/MIXDestroyParser.cpp36
-rw-r--r--Swiften/Parser/PayloadParsers/MIXDestroyParser.h36
-rw-r--r--Swiften/Parser/PayloadParsers/MIXJoinParser.cpp73
-rw-r--r--Swiften/Parser/PayloadParsers/MIXJoinParser.h37
-rw-r--r--Swiften/Parser/PayloadParsers/MIXJoinParserFactory.h27
-rw-r--r--Swiften/Parser/PayloadParsers/MIXLeaveParser.cpp37
-rw-r--r--Swiften/Parser/PayloadParsers/MIXLeaveParser.h35
-rw-r--r--Swiften/Parser/PayloadParsers/MIXParticipantParser.cpp24
-rw-r--r--Swiften/Parser/PayloadParsers/MIXParticipantParser.h19
-rw-r--r--Swiften/Parser/PayloadParsers/MIXParticipantParserFactory.h27
-rw-r--r--Swiften/Parser/PayloadParsers/MIXPayloadParser.cpp25
-rw-r--r--Swiften/Parser/PayloadParsers/MIXPayloadParser.h25
-rw-r--r--Swiften/Parser/PayloadParsers/MIXPayloadParserFactory.h33
-rw-r--r--Swiften/Parser/PayloadParsers/MIXRegisterNickParser.cpp19
-rw-r--r--Swiften/Parser/PayloadParsers/MIXRegisterNickParser.h19
-rw-r--r--Swiften/Parser/PayloadParsers/MIXRegisterNickParserFactory.h27
-rw-r--r--Swiften/Parser/PayloadParsers/MIXSetNickParser.cpp19
-rw-r--r--Swiften/Parser/PayloadParsers/MIXSetNickParser.h25
-rw-r--r--Swiften/Parser/PayloadParsers/MIXSetNickParserFactory.h33
-rw-r--r--Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.cpp49
-rw-r--r--Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.h36
-rw-r--r--Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.cpp58
-rw-r--r--Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.h37
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubConfigureParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubCreateParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubDefaultParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubErrorParser.h14
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventItemParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubItemParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubItemsParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOptionsParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubPublishParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubRetractParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/ReferencePayloadParser.cpp79
-rw-r--r--Swiften/Parser/PayloadParsers/ReferencePayloadParser.h35
-rw-r--r--Swiften/Parser/PayloadParsers/ResultSetParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h4
-rw-r--r--Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp12
-rw-r--r--Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp2
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXCreateParserTest.cpp89
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXDestroyParser.cpp25
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXDestroyParserTest.cpp24
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXJoinParserTest.cpp176
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXLeaveParserTest.cpp32
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXParticipantParserTest.cpp56
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXPayloadParserTest.cpp85
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXRegisterNickParserTest.cpp23
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXSetNickParserTest.cpp23
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXUpdateSubscriptionParserTest.cpp49
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/MIXUserPreferenceParserTest.cpp66
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h2
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ReferencePayloadParserTest.cpp134
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp57
-rw-r--r--Swiften/Parser/PayloadParsers/UserLocationParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/UserTuneParser.h11
-rw-r--r--Swiften/Parser/PayloadParsers/VCardUpdateParser.h4
102 files changed, 2094 insertions, 319 deletions
diff --git a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
index 405c593..71bce54 100644
--- a/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
+++ b/Swiften/Parser/PayloadParsers/BytestreamsParser.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -7,6 +7,7 @@
#include <Swiften/Parser/PayloadParsers/BytestreamsParser.h>
#include <boost/lexical_cast.hpp>
+#include <boost/numeric/conversion/cast.hpp>
namespace Swift {
@@ -23,7 +24,9 @@ void BytestreamsParser::handleStartElement(const std::string& element, const std
else if (level == PayloadLevel) {
if (element == "streamhost") {
try {
- getPayloadInternal()->addStreamHost(Bytestreams::StreamHost(attributes.getAttribute("host"), JID(attributes.getAttribute("jid")), boost::lexical_cast<int>(attributes.getAttribute("port"))));
+ getPayloadInternal()->addStreamHost(Bytestreams::StreamHost(attributes.getAttribute("host"), JID(attributes.getAttribute("jid")), boost::numeric_cast<unsigned short>(boost::lexical_cast<int>(attributes.getAttribute("port")))));
+ }
+ catch (boost::numeric::bad_numeric_cast&) {
}
catch (boost::bad_lexical_cast&) {
}
diff --git a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h b/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h
index cf226cc..3f9b3d3 100644
--- a/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/ChatStateParserFactory.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -11,8 +11,6 @@
#include <Swiften/Parser/PayloadParsers/ChatStateParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
-
class SWIFTEN_API ChatStateParserFactory : public PayloadParserFactory {
public:
ChatStateParserFactory() {
diff --git a/Swiften/Parser/PayloadParsers/ClientStateParserFactory.h b/Swiften/Parser/PayloadParsers/ClientStateParserFactory.h
index 95617a1..61f7012 100644
--- a/Swiften/Parser/PayloadParsers/ClientStateParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/ClientStateParserFactory.h
@@ -4,6 +4,12 @@
* 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>
@@ -11,8 +17,6 @@
#include <Swiften/Parser/PayloadParsers/ClientStateParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
-
class SWIFTEN_API ClientStateParserFactory : public PayloadParserFactory {
public:
ClientStateParserFactory() {
diff --git a/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h b/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h
index dc0c311..322ef94 100644
--- a/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2015 Isode Limited.
+ * Copyright (c) 2015-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -17,8 +17,6 @@
#include <Swiften/Parser/PayloadParsers/DeliveryReceiptParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
-
class SWIFTEN_API DeliveryReceiptParserFactory : public PayloadParserFactory {
public:
DeliveryReceiptParserFactory() {
diff --git a/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h b/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h
index a858285..cef5d8f 100644
--- a/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2015 Isode Limited.
+ * Copyright (c) 2015-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -17,8 +17,6 @@
#include <Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
-
class SWIFTEN_API DeliveryReceiptRequestParserFactory : public PayloadParserFactory {
public:
DeliveryReceiptRequestParserFactory() {
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
index 28bfff1..9c26310 100644
--- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
+++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -11,6 +11,8 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
+ class FormParser;
+
class SWIFTEN_API DiscoInfoParser : public GenericPayloadParser<DiscoInfo> {
public:
DiscoInfoParser();
diff --git a/Swiften/Parser/PayloadParsers/FormParserFactory.h b/Swiften/Parser/PayloadParsers/FormParserFactory.h
index 851b302..296fcd1 100644
--- a/Swiften/Parser/PayloadParsers/FormParserFactory.h
+++ b/Swiften/Parser/PayloadParsers/FormParserFactory.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -11,8 +11,6 @@
#include <Swiften/Parser/PayloadParsers/FormParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
-
class SWIFTEN_API FormParserFactory : public PayloadParserFactory {
public:
FormParserFactory() {
diff --git a/Swiften/Parser/PayloadParsers/ForwardedParser.h b/Swiften/Parser/PayloadParsers/ForwardedParser.h
index f91fda5..c9f13df 100644
--- a/Swiften/Parser/PayloadParsers/ForwardedParser.h
+++ b/Swiften/Parser/PayloadParsers/ForwardedParser.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/Parser/GenericPayloadParser.h>
@@ -22,9 +21,9 @@ namespace Swift {
public:
ForwardedParser(PayloadParserFactoryCollection* factories);
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
enum Level {
TopLevel = 0,
diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
index 4ad943a..9e56b63 100644
--- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
+++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp
@@ -51,6 +51,16 @@
#include <Swiften/Parser/PayloadParsers/MAMFinParser.h>
#include <Swiften/Parser/PayloadParsers/MAMQueryParser.h>
#include <Swiften/Parser/PayloadParsers/MAMResultParser.h>
+#include <Swiften/Parser/PayloadParsers/MIXParticipantParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXCreateParser.h>
+#include <Swiften/Parser/PayloadParsers/MIXRegisterNickParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXSetNickParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXDestroyParser.h>
+#include <Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.h>
+#include <Swiften/Parser/PayloadParsers/MIXJoinParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXPayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.h>
+#include <Swiften/Parser/PayloadParsers/MIXLeaveParser.h>
#include <Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.h>
#include <Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.h>
#include <Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h>
@@ -65,6 +75,7 @@
#include <Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h>
#include <Swiften/Parser/PayloadParsers/PubSubParser.h>
#include <Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/ReferencePayloadParser.h>
#include <Swiften/Parser/PayloadParsers/ReplaceParser.h>
#include <Swiften/Parser/PayloadParsers/ResourceBindParser.h>
#include <Swiften/Parser/PayloadParsers/ResultSetParser.h>
@@ -129,6 +140,15 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() {
factories_.push_back(std::make_shared<PrivateStorageParserFactory>(this));
factories_.push_back(std::make_shared<ChatStateParserFactory>());
factories_.push_back(std::make_shared<ClientStateParserFactory>());
+ factories_.push_back(std::make_shared<MIXParticipantParserFactory>());
+ factories_.push_back(std::make_shared<GenericPayloadParserFactory<MIXDestroyParser> >("destroy", "urn:xmpp:mix:0"));
+ factories_.push_back(std::make_shared<MIXRegisterNickParserFactory>());
+ factories_.push_back(std::make_shared<MIXSetNickParserFactory>());
+ factories_.push_back(std::make_shared<GenericPayloadParserFactory<MIXCreateParser> >("create", "urn:xmpp:mix:0"));
+ factories_.push_back(std::make_shared<GenericPayloadParserFactory<MIXUpdateSubscriptionParser> >("update-subscription", "urn:xmpp:mix:0"));
+ factories_.push_back(std::make_shared<GenericPayloadParserFactory<MIXUserPreferenceParser> >("user-preference", "urn:xmpp:mix:0"));
+ factories_.push_back(std::make_shared<MIXPayloadParserFactory>());
+ factories_.push_back(std::make_shared<GenericPayloadParserFactory<MIXLeaveParser> >("leave", "urn:xmpp:mix:0"));
factories_.push_back(std::make_shared<MUCUserPayloadParserFactory>(this));
factories_.push_back(std::make_shared<MUCOwnerPayloadParserFactory>(this));
factories_.push_back(std::make_shared<GenericPayloadParserFactory<MUCInvitationPayloadParser> >("x", "jabber:x:conference"));
@@ -167,6 +187,8 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() {
factories_.push_back(std::make_shared<GenericPayloadParserFactory2<CarbonsReceivedParser> >("received", "urn:xmpp:carbons:2", this));
factories_.push_back(std::make_shared<GenericPayloadParserFactory2<CarbonsSentParser> >("sent", "urn:xmpp:carbons:2", this));
factories_.push_back(std::make_shared<GenericPayloadParserFactory<CarbonsPrivateParser> >("private", "urn:xmpp:carbons:2"));
+ factories_.push_back(std::make_shared<MIXJoinParserFactory>());
+ factories_.push_back(std::make_shared<GenericPayloadParserFactory2<ReferencePayloadParser> >("reference", "urn:xmpp:reference:0", this));
for (auto& factory : factories_) {
addFactory(factory.get());
diff --git a/Swiften/Parser/PayloadParsers/IBBParser.cpp b/Swiften/Parser/PayloadParsers/IBBParser.cpp
index 9b6babc..1ba44e1 100644
--- a/Swiften/Parser/PayloadParsers/IBBParser.cpp
+++ b/Swiften/Parser/PayloadParsers/IBBParser.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -39,7 +39,7 @@ void IBBParser::handleStartElement(const std::string& element, const std::string
getPayloadInternal()->setStanzaType(IBB::IQStanza);
}
try {
- getPayloadInternal()->setBlockSize(boost::lexical_cast<int>(attributes.getAttribute("block-size")));
+ getPayloadInternal()->setBlockSize(boost::lexical_cast<unsigned int>(attributes.getAttribute("block-size")));
}
catch (boost::bad_lexical_cast&) {
}
diff --git a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h
index eaedd27..af2f061 100644
--- a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h
+++ b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API IsodeIQDelegationParser : public GenericPayloadParser<IsodeIQDelegation> {
public:
IsodeIQDelegationParser(PayloadParserFactoryCollection* parsers);
- virtual ~IsodeIQDelegationParser();
+ virtual ~IsodeIQDelegationParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp
index e639e20..a405e0e 100644
--- a/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp
+++ b/Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2014-2016 Isode Limited.
+ * Copyright (c) 2014-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -13,6 +13,7 @@
#include <Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.h>
#include <boost/lexical_cast.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <boost/optional.hpp>
#include <Swiften/Base/Log.h>
@@ -40,10 +41,10 @@ namespace Swift {
JingleS5BTransportPayload::Candidate candidate;
candidate.cid = attributes.getAttributeValue("cid").get_value_or("");
- int port = -1;
+ unsigned short port = 0;
try {
- port = boost::lexical_cast<int>(attributes.getAttributeValue("port").get_value_or("-1"));
- } catch(boost::bad_lexical_cast &) { }
+ port = boost::numeric_cast<unsigned short>(boost::lexical_cast<int>(attributes.getAttributeValue("port").get_value_or("0")));
+ } catch(...) { }
candidate.hostPort = HostAddressPort(HostAddress::fromString(attributes.getAttributeValue("host").get_value_or("")).get_value_or(HostAddress()), port);
candidate.jid = JID(attributes.getAttributeValue("jid").get_value_or(""));
int priority = -1;
diff --git a/Swiften/Parser/PayloadParsers/MAMFinParser.h b/Swiften/Parser/PayloadParsers/MAMFinParser.h
index f08231e..419d542 100644
--- a/Swiften/Parser/PayloadParsers/MAMFinParser.h
+++ b/Swiften/Parser/PayloadParsers/MAMFinParser.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/MAMFin.h>
#include <Swiften/Parser/GenericPayloadParser.h>
@@ -20,9 +19,9 @@ namespace Swift {
public:
MAMFinParser();
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
enum Level {
TopLevel = 0,
diff --git a/Swiften/Parser/PayloadParsers/MAMQueryParser.h b/Swiften/Parser/PayloadParsers/MAMQueryParser.h
index 7e4b58a..ab062c5 100644
--- a/Swiften/Parser/PayloadParsers/MAMQueryParser.h
+++ b/Swiften/Parser/PayloadParsers/MAMQueryParser.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.
*/
@@ -10,7 +10,6 @@
#include <string>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/MAMQuery.h>
#include <Swiften/Parser/GenericPayloadParser.h>
@@ -22,9 +21,9 @@ namespace Swift {
public:
MAMQueryParser();
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
enum Level {
TopLevel = 0,
diff --git a/Swiften/Parser/PayloadParsers/MAMResultParser.h b/Swiften/Parser/PayloadParsers/MAMResultParser.h
index e68e365..f058e15 100644
--- a/Swiften/Parser/PayloadParsers/MAMResultParser.h
+++ b/Swiften/Parser/PayloadParsers/MAMResultParser.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.
*/
@@ -10,7 +10,6 @@
#include <string>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/MAMResult.h>
#include <Swiften/Parser/GenericPayloadParser.h>
@@ -22,9 +21,9 @@ namespace Swift {
public:
MAMResultParser(PayloadParserFactoryCollection* factories);
- virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
enum Level {
TopLevel = 0,
diff --git a/Swiften/Parser/PayloadParsers/MIXCreateParser.cpp b/Swiften/Parser/PayloadParsers/MIXCreateParser.cpp
new file mode 100644
index 0000000..8c4ec8a
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXCreateParser.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 <Swiften/Parser/PayloadParsers/MIXCreateParser.h>
+
+#include <boost/optional.hpp>
+
+#include <Swiften/Parser/PayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/FormParser.h>
+
+using namespace Swift;
+
+MIXCreateParser::MIXCreateParser() : level_(0) {
+}
+
+MIXCreateParser::~MIXCreateParser() {
+}
+
+void MIXCreateParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
+ if (level_ == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("channel")) {
+ getPayloadInternal()->setChannel(*attributeValue);
+ }
+ }
+
+ if (level_ == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ currentPayloadParser_ = std::make_shared<FormParser>();
+ }
+ }
+
+ if (level_ >= 1 && currentPayloadParser_) {
+ currentPayloadParser_->handleStartElement(element, ns, attributes);
+ }
+ ++level_;
+}
+
+void MIXCreateParser::handleEndElement(const std::string& element, const std::string& ns) {
+ --level_;
+ if (currentPayloadParser_) {
+ if (level_ >= 1) {
+ currentPayloadParser_->handleEndElement(element, ns);
+ }
+
+ if (level_ == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ getPayloadInternal()->setData(std::dynamic_pointer_cast<Form>(currentPayloadParser_->getPayload()));
+ }
+ currentPayloadParser_.reset();
+ }
+ }
+}
+
+void MIXCreateParser::handleCharacterData(const std::string& data) {
+ if (level_ > 1 && currentPayloadParser_) {
+ currentPayloadParser_->handleCharacterData(data);
+ }
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXCreateParser.h b/Swiften/Parser/PayloadParsers/MIXCreateParser.h
new file mode 100644
index 0000000..ef123e1
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXCreateParser.h
@@ -0,0 +1,37 @@
+/*
+ * 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/MIXCreate.h>
+#include <Swiften/Parser/GenericPayloadParser.h>
+
+namespace Swift {
+ class PayloadParser;
+
+ class SWIFTEN_API MIXCreateParser : public GenericPayloadParser<MIXCreate> {
+ public:
+ MIXCreateParser();
+ virtual ~MIXCreateParser() override;
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
+
+ private:
+ int level_;
+ std::shared_ptr<PayloadParser> currentPayloadParser_;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXDestroyParser.cpp b/Swiften/Parser/PayloadParsers/MIXDestroyParser.cpp
new file mode 100644
index 0000000..0437b48
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXDestroyParser.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 <Swiften/Parser/PayloadParsers/MIXDestroyParser.h>
+
+#include <boost/optional.hpp>
+
+#include <Swiften/Parser/PayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/FormParser.h>
+
+using namespace Swift;
+
+MIXDestroyParser::MIXDestroyParser() : level_(0) {
+}
+
+MIXDestroyParser::~MIXDestroyParser() {
+}
+
+void MIXDestroyParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
+ if (level_ == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("channel")) {
+ getPayloadInternal()->setChannel(*attributeValue);
+ }
+ }
+ ++level_;
+}
+
+void MIXDestroyParser::handleEndElement(const std::string&, const std::string&) {
+ --level_;
+}
+
+void MIXDestroyParser::handleCharacterData(const std::string&) {
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXDestroyParser.h b/Swiften/Parser/PayloadParsers/MIXDestroyParser.h
new file mode 100644
index 0000000..8cfd91e
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXDestroyParser.h
@@ -0,0 +1,36 @@
+/*
+ * 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/MIXDestroy.h>
+#include <Swiften/Parser/GenericPayloadParser.h>
+
+namespace Swift {
+ class PayloadParser;
+
+ class SWIFTEN_API MIXDestroyParser : public GenericPayloadParser<MIXDestroy> {
+ public:
+ MIXDestroyParser();
+ virtual ~MIXDestroyParser() override;
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
+
+ private:
+ int level_;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXJoinParser.cpp b/Swiften/Parser/PayloadParsers/MIXJoinParser.cpp
new file mode 100644
index 0000000..6e72f90
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXJoinParser.cpp
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/MIXJoinParser.h>
+
+#include <boost/optional.hpp>
+
+#include <Swiften/Parser/PayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/FormParser.h>
+
+using namespace Swift;
+
+MIXJoinParser::MIXJoinParser() : level_(0) {
+}
+
+MIXJoinParser::~MIXJoinParser() {
+}
+
+void MIXJoinParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
+ if (level_ == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("channel")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setChannel(*jid);
+ }
+ }
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ }
+
+ if (level_ == 1) {
+ if (element == "subscribe" && ns == "urn:xmpp:mix:0") {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->addSubscription(*attributeValue);
+ }
+ }
+ if (element == "x" && ns == "jabber:x:data") {
+ currentPayloadParser_ = std::make_shared<FormParser>();
+ }
+ }
+
+ if (level_ >= 1 && currentPayloadParser_) {
+ currentPayloadParser_->handleStartElement(element, ns, attributes);
+ }
+ ++level_;
+}
+
+void MIXJoinParser::handleEndElement(const std::string& element, const std::string& ns) {
+ --level_;
+ if (currentPayloadParser_) {
+ if (level_ >= 1) {
+ currentPayloadParser_->handleEndElement(element, ns);
+ }
+
+ if (level_ == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ getPayloadInternal()->setForm(std::dynamic_pointer_cast<Form>(currentPayloadParser_->getPayload()));
+ }
+ currentPayloadParser_.reset();
+ }
+ }
+}
+
+void MIXJoinParser::handleCharacterData(const std::string& data) {
+ if (level_ > 1 && currentPayloadParser_) {
+ currentPayloadParser_->handleCharacterData(data);
+ }
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXJoinParser.h b/Swiften/Parser/PayloadParsers/MIXJoinParser.h
new file mode 100644
index 0000000..f371d6f
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXJoinParser.h
@@ -0,0 +1,37 @@
+/*
+ * 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/MIXJoin.h>
+#include <Swiften/Parser/GenericPayloadParser.h>
+
+namespace Swift {
+ class PayloadParser;
+
+ class SWIFTEN_API MIXJoinParser : public GenericPayloadParser<MIXJoin> {
+ public:
+ MIXJoinParser();
+ virtual ~MIXJoinParser() override;
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
+
+ private:
+ int level_;
+ std::shared_ptr<PayloadParser> currentPayloadParser_;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXJoinParserFactory.h b/Swiften/Parser/PayloadParsers/MIXJoinParserFactory.h
new file mode 100644
index 0000000..8432c61
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXJoinParserFactory.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Parser/GenericPayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXJoinParser.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXJoinParserFactory : public PayloadParserFactory {
+ public:
+ MIXJoinParserFactory() {
+ }
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return element == "join" && ns == "urn:xmpp:mix:0";
+ }
+
+ virtual PayloadParser* createPayloadParser() {
+ return new MIXJoinParser();
+ }
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXLeaveParser.cpp b/Swiften/Parser/PayloadParsers/MIXLeaveParser.cpp
new file mode 100644
index 0000000..6330925
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXLeaveParser.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/MIXLeaveParser.h>
+
+#include <boost/optional.hpp>
+
+namespace Swift {
+
+MIXLeaveParser::MIXLeaveParser() : level_(0) {
+}
+
+MIXLeaveParser::~MIXLeaveParser() {
+}
+
+void MIXLeaveParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
+ if (level_ == 0) {
+ if (auto attributeValue = attributes.getAttributeValue("channel")) {
+ if (auto jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setChannel(*jid);
+ }
+ }
+ }
+ ++level_;
+}
+
+void MIXLeaveParser::handleEndElement(const std::string&, const std::string&) {
+ --level_;
+}
+
+void MIXLeaveParser::handleCharacterData(const std::string&) {
+
+}
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXLeaveParser.h b/Swiften/Parser/PayloadParsers/MIXLeaveParser.h
new file mode 100644
index 0000000..b0798b4
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXLeaveParser.h
@@ -0,0 +1,35 @@
+/*
+ * 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/Parser/GenericPayloadParser.h>
+
+namespace Swift {
+
+ class SWIFTEN_API MIXLeaveParser : public GenericPayloadParser<MIXLeave> {
+ public:
+ MIXLeaveParser();
+ virtual ~MIXLeaveParser() override;
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
+
+ private:
+ int level_;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXParticipantParser.cpp b/Swiften/Parser/PayloadParsers/MIXParticipantParser.cpp
new file mode 100644
index 0000000..0ab2b87
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXParticipantParser.cpp
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/MIXParticipantParser.h>
+
+namespace Swift {
+
+void MIXParticipantParser::handleTree(ParserElement::ref root) {
+ for (const auto& child : root->getAllChildren()) {
+ if (child->getName() == "nick" && child->getNamespace() == root->getNamespace()) {
+ getPayloadInternal()->setNick(child->getText());
+ }
+ else if (child->getName() == "jid" && child->getNamespace() == root->getNamespace()) {
+ if (boost::optional<JID> jid = JID::parse(child->getText())) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ }
+}
+
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXParticipantParser.h b/Swiften/Parser/PayloadParsers/MIXParticipantParser.h
new file mode 100644
index 0000000..0a3ea57
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXParticipantParser.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/MIXParticipant.h>
+#include <Swiften/Parser/GenericPayloadTreeParser.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXParticipantParser : public GenericPayloadTreeParser<MIXParticipant> {
+ public:
+ MIXParticipantParser() {}
+ virtual void handleTree(ParserElement::ref root);
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXParticipantParserFactory.h b/Swiften/Parser/PayloadParsers/MIXParticipantParserFactory.h
new file mode 100644
index 0000000..cd7c17e
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXParticipantParserFactory.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Parser/GenericPayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXParticipantParser.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXParticipantParserFactory : public PayloadParserFactory {
+ public:
+ MIXParticipantParserFactory() {
+ }
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const {
+ return element == "participant" && ns == "urn:xmpp:mix:0";
+ }
+
+ virtual PayloadParser* createPayloadParser() {
+ return new MIXParticipantParser();
+ }
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXPayloadParser.cpp b/Swiften/Parser/PayloadParsers/MIXPayloadParser.cpp
new file mode 100644
index 0000000..51ef584
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXPayloadParser.cpp
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/MIXPayloadParser.h>
+
+namespace Swift {
+
+void MIXPayloadParser::handleTree(ParserElement::ref root) {
+ for (const auto& child : root->getAllChildren()) {
+ if (child->getName() == "nick" && child->getNamespace() == root->getNamespace()) {
+ getPayloadInternal()->setNick(child->getText());
+ } else if (child->getName() == "jid" && child->getNamespace() == root->getNamespace()) {
+ if (boost::optional<JID> jid = JID::parse(child->getText())) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ } else if (child->getName() == "submission-id" && child->getNamespace() == root->getNamespace()) {
+ getPayloadInternal()->setSubmissionID(child->getText());
+ }
+ }
+}
+
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXPayloadParser.h b/Swiften/Parser/PayloadParsers/MIXPayloadParser.h
new file mode 100644
index 0000000..9133e8b
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXPayloadParser.h
@@ -0,0 +1,25 @@
+/*
+ * 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/Parser/GenericPayloadTreeParser.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXPayloadParser : public GenericPayloadTreeParser<MIXPayload> {
+ public:
+ MIXPayloadParser() {}
+ virtual void handleTree(ParserElement::ref root) override;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXPayloadParserFactory.h b/Swiften/Parser/PayloadParsers/MIXPayloadParserFactory.h
new file mode 100644
index 0000000..8397b78
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXPayloadParserFactory.h
@@ -0,0 +1,33 @@
+/*
+ * 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/Parser/GenericPayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXPayloadParser.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXPayloadParserFactory : public PayloadParserFactory {
+ public:
+ MIXPayloadParserFactory() {
+ }
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const override {
+ return element == "mix" && ns == "urn:xmpp:mix:0";
+ }
+
+ virtual PayloadParser* createPayloadParser() override {
+ return new MIXPayloadParser();
+ }
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXRegisterNickParser.cpp b/Swiften/Parser/PayloadParsers/MIXRegisterNickParser.cpp
new file mode 100644
index 0000000..945e9b2
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXRegisterNickParser.cpp
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/MIXRegisterNickParser.h>
+
+namespace Swift {
+
+void MIXRegisterNickParser::handleTree(ParserElement::ref root) {
+ for (const auto& child : root->getAllChildren()) {
+ if (child->getName() == "nick" && child->getNamespace() == root->getNamespace()) {
+ getPayloadInternal()->setNick(child->getText());
+ }
+ }
+}
+
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXRegisterNickParser.h b/Swiften/Parser/PayloadParsers/MIXRegisterNickParser.h
new file mode 100644
index 0000000..cfb618e
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXRegisterNickParser.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/MIXRegisterNick.h>
+#include <Swiften/Parser/GenericPayloadTreeParser.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXRegisterNickParser : public GenericPayloadTreeParser<MIXRegisterNick> {
+ public:
+ MIXRegisterNickParser() {}
+ virtual void handleTree(ParserElement::ref root) override;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXRegisterNickParserFactory.h b/Swiften/Parser/PayloadParsers/MIXRegisterNickParserFactory.h
new file mode 100644
index 0000000..e03392c
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXRegisterNickParserFactory.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Parser/GenericPayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXRegisterNickParser.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXRegisterNickParserFactory : public PayloadParserFactory {
+ public:
+ MIXRegisterNickParserFactory() {
+ }
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const override {
+ return element == "register" && ns == "urn:xmpp:mix:0";
+ }
+
+ virtual PayloadParser* createPayloadParser() override {
+ return new MIXRegisterNickParser();
+ }
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXSetNickParser.cpp b/Swiften/Parser/PayloadParsers/MIXSetNickParser.cpp
new file mode 100644
index 0000000..34fec70
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXSetNickParser.cpp
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/MIXSetNickParser.h>
+
+namespace Swift {
+
+void MIXSetNickParser::handleTree(ParserElement::ref root) {
+ for (const auto& child : root->getAllChildren()) {
+ if (child->getName() == "nick" && child->getNamespace() == root->getNamespace()) {
+ getPayloadInternal()->setNick(child->getText());
+ }
+ }
+}
+
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXSetNickParser.h b/Swiften/Parser/PayloadParsers/MIXSetNickParser.h
new file mode 100644
index 0000000..6d552c8
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXSetNickParser.h
@@ -0,0 +1,25 @@
+/*
+ * 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/Parser/GenericPayloadTreeParser.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXSetNickParser : public GenericPayloadTreeParser<MIXSetNick> {
+ public:
+ MIXSetNickParser() {}
+ virtual void handleTree(ParserElement::ref root) override;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXSetNickParserFactory.h b/Swiften/Parser/PayloadParsers/MIXSetNickParserFactory.h
new file mode 100644
index 0000000..e028873
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXSetNickParserFactory.h
@@ -0,0 +1,33 @@
+/*
+ * 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/Parser/GenericPayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/MIXSetNickParser.h>
+
+namespace Swift {
+ class SWIFTEN_API MIXSetNickParserFactory : public PayloadParserFactory {
+ public:
+ MIXSetNickParserFactory() {
+ }
+
+ virtual bool canParse(const std::string& element, const std::string& ns, const AttributeMap&) const override {
+ return element == "setnick" && ns == "urn:xmpp:mix:0";
+ }
+
+ virtual PayloadParser* createPayloadParser() override {
+ return new MIXSetNickParser();
+ }
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.cpp b/Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.cpp
new file mode 100644
index 0000000..d530e49
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.h>
+
+#include <boost/optional.hpp>
+
+#include <Swiften/Parser/PayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/FormParser.h>
+
+namespace Swift {
+
+MIXUpdateSubscriptionParser::MIXUpdateSubscriptionParser() : level_(0) {
+}
+
+MIXUpdateSubscriptionParser::~MIXUpdateSubscriptionParser() {
+}
+
+void MIXUpdateSubscriptionParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
+ if (level_ == 0) {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("jid")) {
+ if (boost::optional<JID> jid = JID::parse(*attributeValue)) {
+ getPayloadInternal()->setJID(*jid);
+ }
+ }
+ }
+
+ if (level_ == 1) {
+ if (element == "subscribe" && ns == "urn:xmpp:mix:0") {
+ if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
+ getPayloadInternal()->addSubscription(*attributeValue);
+ }
+ }
+ }
+
+ ++level_;
+}
+
+void MIXUpdateSubscriptionParser::handleEndElement(const std::string&, const std::string&) {
+ --level_;
+}
+
+void MIXUpdateSubscriptionParser::handleCharacterData(const std::string&) {
+}
+
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.h b/Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.h
new file mode 100644
index 0000000..47966ff
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXUpdateSubscriptionParser.h
@@ -0,0 +1,36 @@
+/*
+ * 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/Parser/GenericPayloadParser.h>
+
+namespace Swift {
+ class PayloadParser;
+
+ class SWIFTEN_API MIXUpdateSubscriptionParser : public GenericPayloadParser<MIXUpdateSubscription> {
+ public:
+ MIXUpdateSubscriptionParser();
+ virtual ~MIXUpdateSubscriptionParser() override;
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
+
+ private:
+ int level_;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.cpp b/Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.cpp
new file mode 100644
index 0000000..f40547d
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2017 Tarun Gupta
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.h>
+
+#include <boost/optional.hpp>
+
+#include <Swiften/Parser/PayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParsers/FormParser.h>
+
+namespace Swift {
+
+MIXUserPreferenceParser::MIXUserPreferenceParser() : level_(0) {
+}
+
+MIXUserPreferenceParser::~MIXUserPreferenceParser() {
+}
+
+void MIXUserPreferenceParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
+
+
+ if (level_ == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ currentPayloadParser_ = std::make_shared<FormParser>();
+ }
+ }
+
+ if (level_ >= 1 && currentPayloadParser_) {
+ currentPayloadParser_->handleStartElement(element, ns, attributes);
+ }
+ ++level_;
+}
+
+void MIXUserPreferenceParser::handleEndElement(const std::string& element, const std::string& ns) {
+ --level_;
+ if (currentPayloadParser_) {
+ if (level_ >= 1) {
+ currentPayloadParser_->handleEndElement(element, ns);
+ }
+
+ if (level_ == 1) {
+ if (element == "x" && ns == "jabber:x:data") {
+ getPayloadInternal()->setData(std::dynamic_pointer_cast<Form>(currentPayloadParser_->getPayload()));
+ }
+ currentPayloadParser_.reset();
+ }
+ }
+}
+
+void MIXUserPreferenceParser::handleCharacterData(const std::string& data) {
+ if (level_ > 1 && currentPayloadParser_) {
+ currentPayloadParser_->handleCharacterData(data);
+ }
+}
+}
diff --git a/Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.h b/Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.h
new file mode 100644
index 0000000..b2a2c10
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/MIXUserPreferenceParser.h
@@ -0,0 +1,37 @@
+/*
+ * 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/MIXUserPreference.h>
+#include <Swiften/Parser/GenericPayloadParser.h>
+
+namespace Swift {
+ class PayloadParser;
+
+ class SWIFTEN_API MIXUserPreferenceParser : public GenericPayloadParser<MIXUserPreference> {
+ public:
+ MIXUserPreferenceParser();
+ virtual ~MIXUserPreferenceParser() override;
+
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
+
+ private:
+ int level_;
+ std::shared_ptr<PayloadParser> currentPayloadParser_;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h b/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h
index eabe3db..383ceae 100644
--- a/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubAffiliationParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubAffiliationParser : public GenericPayloadParser<PubSubAffiliation> {
public:
PubSubAffiliationParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubAffiliationParser();
+ virtual ~PubSubAffiliationParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h
index 2f80dbd..48e3825 100644
--- a/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubAffiliationsParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubAffiliationsParser : public GenericPayloadParser<PubSubAffiliations> {
public:
PubSubAffiliationsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubAffiliationsParser();
+ virtual ~PubSubAffiliationsParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h
index 90c2f3e..e53d477 100644
--- a/Swiften/Parser/PayloadParsers/PubSubConfigureParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubConfigureParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubConfigureParser : public GenericPayloadParser<PubSubConfigure> {
public:
PubSubConfigureParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubConfigureParser();
+ virtual ~PubSubConfigureParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubCreateParser.h b/Swiften/Parser/PayloadParsers/PubSubCreateParser.h
index a1ada74..626419c 100644
--- a/Swiften/Parser/PayloadParsers/PubSubCreateParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubCreateParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubCreateParser : public GenericPayloadParser<PubSubCreate> {
public:
PubSubCreateParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubCreateParser();
+ virtual ~PubSubCreateParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h b/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h
index 01bea7b..08f6b43 100644
--- a/Swiften/Parser/PayloadParsers/PubSubDefaultParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubDefaultParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubDefaultParser : public GenericPayloadParser<PubSubDefault> {
public:
PubSubDefaultParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubDefaultParser();
+ virtual ~PubSubDefaultParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubErrorParser.h b/Swiften/Parser/PayloadParsers/PubSubErrorParser.h
index adc36e9..273da82 100644
--- a/Swiften/Parser/PayloadParsers/PubSubErrorParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubErrorParser.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,23 +9,19 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/PubSubError.h>
#include <Swiften/Parser/EnumParser.h>
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
- class PayloadParser;
-
class SWIFTEN_API PubSubErrorParser : public GenericPayloadParser<PubSubError> {
public:
PubSubErrorParser();
- virtual ~PubSubErrorParser();
+ virtual ~PubSubErrorParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h b/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h
index 4bb9bd9..f4d6327 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventAssociateParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventAssociateParser : public GenericPayloadParser<PubSubEventAssociate> {
public:
PubSubEventAssociateParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventAssociateParser();
+ virtual ~PubSubEventAssociateParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h
index ffdafcf..ffa1deb 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventCollectionParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventCollectionParser : public GenericPayloadParser<PubSubEventCollection> {
public:
PubSubEventCollectionParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventCollectionParser();
+ virtual ~PubSubEventCollectionParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h
index dddb7a4..6b68d86 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventConfigurationParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventConfigurationParser : public GenericPayloadParser<PubSubEventConfiguration> {
public:
PubSubEventConfigurationParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventConfigurationParser();
+ virtual ~PubSubEventConfigurationParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h
index 270430e..54a1913 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventDeleteParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventDeleteParser : public GenericPayloadParser<PubSubEventDelete> {
public:
PubSubEventDeleteParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventDeleteParser();
+ virtual ~PubSubEventDeleteParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h b/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h
index 5f7f1af..6a0a7ce 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventDisassociateParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventDisassociateParser : public GenericPayloadParser<PubSubEventDisassociate> {
public:
PubSubEventDisassociateParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventDisassociateParser();
+ virtual ~PubSubEventDisassociateParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h b/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h
index bd2e72e..e9a986d 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventItemParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventItemParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventItemParser : public GenericPayloadParser<PubSubEventItem> {
public:
PubSubEventItemParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventItemParser();
+ virtual ~PubSubEventItemParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h
index 34b3669..067a9f7 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventItemsParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventItemsParser : public GenericPayloadParser<PubSubEventItems> {
public:
PubSubEventItemsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventItemsParser();
+ virtual ~PubSubEventItemsParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventParser.h b/Swiften/Parser/PayloadParsers/PubSubEventParser.h
index 3b231b0..02cf01f 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventParser.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/PubSubEvent.h>
#include <Swiften/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventParser : public GenericPayloadParser<PubSubEvent> {
public:
PubSubEventParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventParser();
+ virtual ~PubSubEventParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h b/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h
index 563283c..1c9e623 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventPurgeParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventPurgeParser : public GenericPayloadParser<PubSubEventPurge> {
public:
PubSubEventPurgeParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventPurgeParser();
+ virtual ~PubSubEventPurgeParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h b/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h
index 603fbec..be7593e 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventRedirectParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventRedirectParser : public GenericPayloadParser<PubSubEventRedirect> {
public:
PubSubEventRedirectParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventRedirectParser();
+ virtual ~PubSubEventRedirectParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h b/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h
index 141790b..83a8e66 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventRetractParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventRetractParser : public GenericPayloadParser<PubSubEventRetract> {
public:
PubSubEventRetractParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventRetractParser();
+ virtual ~PubSubEventRetractParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h b/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h
index 0d56a20..6f2eeeb 100644
--- a/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubEventSubscriptionParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubEventSubscriptionParser : public GenericPayloadParser<PubSubEventSubscription> {
public:
PubSubEventSubscriptionParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubEventSubscriptionParser();
+ virtual ~PubSubEventSubscriptionParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubItemParser.h b/Swiften/Parser/PayloadParsers/PubSubItemParser.h
index c6e4ccf..cbbd3a5 100644
--- a/Swiften/Parser/PayloadParsers/PubSubItemParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubItemParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubItemParser : public GenericPayloadParser<PubSubItem> {
public:
PubSubItemParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubItemParser();
+ virtual ~PubSubItemParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubItemsParser.h b/Swiften/Parser/PayloadParsers/PubSubItemsParser.h
index ad6e746..d792e1b 100644
--- a/Swiften/Parser/PayloadParsers/PubSubItemsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubItemsParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubItemsParser : public GenericPayloadParser<PubSubItems> {
public:
PubSubItemsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubItemsParser();
+ virtual ~PubSubItemsParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h
index ac14caf..ee11f70 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOptionsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOptionsParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOptionsParser : public GenericPayloadParser<PubSubOptions> {
public:
PubSubOptionsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOptionsParser();
+ virtual ~PubSubOptionsParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h
index 0a6503f..7bb93f1 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerAffiliationParser : public GenericPayloadParser<PubSubOwnerAffiliation> {
public:
PubSubOwnerAffiliationParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerAffiliationParser();
+ virtual ~PubSubOwnerAffiliationParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h
index 52c7fa9..20df72f 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerAffiliationsParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerAffiliationsParser : public GenericPayloadParser<PubSubOwnerAffiliations> {
public:
PubSubOwnerAffiliationsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerAffiliationsParser();
+ virtual ~PubSubOwnerAffiliationsParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h
index 34000fa..f11f357 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerConfigureParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerConfigureParser : public GenericPayloadParser<PubSubOwnerConfigure> {
public:
PubSubOwnerConfigureParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerConfigureParser();
+ virtual ~PubSubOwnerConfigureParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h
index 528c297..2f80b85 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDefaultParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerDefaultParser : public GenericPayloadParser<PubSubOwnerDefault> {
public:
PubSubOwnerDefaultParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerDefaultParser();
+ virtual ~PubSubOwnerDefaultParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h
index 99a8c0e..4484329 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerDeleteParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerDeleteParser : public GenericPayloadParser<PubSubOwnerDelete> {
public:
PubSubOwnerDeleteParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerDeleteParser();
+ virtual ~PubSubOwnerDeleteParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h
index 35420f7..cfacc97 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.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/PubSubOwnerPubSub.h>
#include <Swiften/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerPubSubParser : public GenericPayloadParser<PubSubOwnerPubSub> {
public:
PubSubOwnerPubSubParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerPubSubParser();
+ virtual ~PubSubOwnerPubSubParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h
index f85b2bb..8d233b6 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerPurgeParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerPurgeParser : public GenericPayloadParser<PubSubOwnerPurge> {
public:
PubSubOwnerPurgeParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerPurgeParser();
+ virtual ~PubSubOwnerPurgeParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h
index 1197952..ebb6436 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerRedirectParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerRedirectParser : public GenericPayloadParser<PubSubOwnerRedirect> {
public:
PubSubOwnerRedirectParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerRedirectParser();
+ virtual ~PubSubOwnerRedirectParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h
index 74a61a2..d68d910 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerSubscriptionParser : public GenericPayloadParser<PubSubOwnerSubscription> {
public:
PubSubOwnerSubscriptionParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerSubscriptionParser();
+ virtual ~PubSubOwnerSubscriptionParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h
index 541d225..ca868e6 100644
--- a/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubOwnerSubscriptionsParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubOwnerSubscriptionsParser : public GenericPayloadParser<PubSubOwnerSubscriptions> {
public:
PubSubOwnerSubscriptionsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubOwnerSubscriptionsParser();
+ virtual ~PubSubOwnerSubscriptionsParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubParser.h b/Swiften/Parser/PayloadParsers/PubSubParser.h
index 1f40ca9..5cc50e1 100644
--- a/Swiften/Parser/PayloadParsers/PubSubParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubParser.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/Parser/GenericPayloadParser.h>
@@ -22,11 +21,11 @@ namespace Swift {
class SWIFTEN_API PubSubParser : public GenericPayloadParser<PubSub> {
public:
PubSubParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubParser();
+ virtual ~PubSubParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubPublishParser.h b/Swiften/Parser/PayloadParsers/PubSubPublishParser.h
index ad7dd11..e3b05ff 100644
--- a/Swiften/Parser/PayloadParsers/PubSubPublishParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubPublishParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubPublishParser : public GenericPayloadParser<PubSubPublish> {
public:
PubSubPublishParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubPublishParser();
+ virtual ~PubSubPublishParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubRetractParser.h b/Swiften/Parser/PayloadParsers/PubSubRetractParser.h
index 6bea498..aa9bbcc 100644
--- a/Swiften/Parser/PayloadParsers/PubSubRetractParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubRetractParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubRetractParser : public GenericPayloadParser<PubSubRetract> {
public:
PubSubRetractParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubRetractParser();
+ virtual ~PubSubRetractParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h
index 328818b..9deae2d 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscribeOptionsParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubSubscribeOptionsParser : public GenericPayloadParser<PubSubSubscribeOptions> {
public:
PubSubSubscribeOptionsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubSubscribeOptionsParser();
+ virtual ~PubSubSubscribeOptionsParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h
index 31221cb..ccd8ac8 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscribeParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubSubscribeParser : public GenericPayloadParser<PubSubSubscribe> {
public:
PubSubSubscribeParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubSubscribeParser();
+ virtual ~PubSubSubscribeParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h
index 7075a99..3d9be23 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubSubscriptionParser : public GenericPayloadParser<PubSubSubscription> {
public:
PubSubSubscriptionParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubSubscriptionParser();
+ virtual ~PubSubSubscriptionParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h
index 2371a56..c7169ae 100644
--- a/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubSubscriptionsParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubSubscriptionsParser : public GenericPayloadParser<PubSubSubscriptions> {
public:
PubSubSubscriptionsParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubSubscriptionsParser();
+ virtual ~PubSubSubscriptionsParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
PayloadParserFactoryCollection* parsers;
diff --git a/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h b/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h
index e471130..21d5599 100644
--- a/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.h
+++ b/Swiften/Parser/PayloadParsers/PubSubUnsubscribeParser.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/Parser/GenericPayloadParser.h>
@@ -20,11 +19,11 @@ namespace Swift {
class SWIFTEN_API PubSubUnsubscribeParser : public GenericPayloadParser<PubSubUnsubscribe> {
public:
PubSubUnsubscribeParser(PayloadParserFactoryCollection* parsers);
- virtual ~PubSubUnsubscribeParser();
+ virtual ~PubSubUnsubscribeParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/ReferencePayloadParser.cpp b/Swiften/Parser/PayloadParsers/ReferencePayloadParser.cpp
new file mode 100644
index 0000000..a337a29
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/ReferencePayloadParser.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Parser/PayloadParsers/ReferencePayloadParser.h>
+
+#include <cassert>
+#include <iostream>
+
+#include <Swiften/Parser/PayloadParserFactory.h>
+#include <Swiften/Parser/PayloadParserFactoryCollection.h>
+
+namespace Swift {
+
+ReferencePayloadParser::ReferencePayloadParser(PayloadParserFactoryCollection* factories) : factories_(factories) {
+}
+
+ReferencePayload::Type ReferencePayloadParser::getTypeFromString(const std::string& typeString) const {
+ if (typeString == "data") {
+ return ReferencePayload::Type::Data;
+ }
+ else if (typeString == "mention") {
+ return ReferencePayload::Type::Mention;
+ }
+ else if (typeString == "pubsub") {
+ return ReferencePayload::Type::PubSub;
+ }
+ else {
+ return ReferencePayload::Type::Unknown;
+ }
+}
+
+void ReferencePayloadParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
+ if (level_ == topLevel_) {
+ if (element == "reference") {
+ getPayloadInternal()->setType(getTypeFromString(attributes.getAttribute("type")));
+ getPayloadInternal()->setUri(attributes.getAttributeValue("uri"));
+ getPayloadInternal()->setBegin(attributes.getAttributeValue("begin"));
+ getPayloadInternal()->setEnd(attributes.getAttributeValue("end"));
+ getPayloadInternal()->setAnchor(attributes.getAttributeValue("anchor"));
+ }
+ }
+ else if (level_ == payloadLevel_) {
+ PayloadParserFactory* payloadParserFactory = factories_->getPayloadParserFactory(element, ns, attributes);
+ if (payloadParserFactory) {
+ currentPayloadParser_.reset(payloadParserFactory->createPayloadParser());
+ }
+ }
+
+ if (level_ >= payloadLevel_ && currentPayloadParser_) {
+ currentPayloadParser_->handleStartElement(element, ns, attributes);
+ }
+
+ ++level_;
+}
+
+void ReferencePayloadParser::handleEndElement(const std::string& element, const std::string& ns) {
+ --level_;
+ if (currentPayloadParser_) {
+ if (level_ >= payloadLevel_) {
+ currentPayloadParser_->handleEndElement(element, ns);
+ }
+
+ if (level_ == payloadLevel_) {
+ getPayloadInternal()->addPayload(currentPayloadParser_->getPayload());
+ currentPayloadParser_.reset();
+ }
+ }
+}
+
+void ReferencePayloadParser::handleCharacterData(const std::string& data) {
+ if (level_ > payloadLevel_ && currentPayloadParser_) {
+ currentPayloadParser_->handleCharacterData(data);
+ }
+}
+
+}
diff --git a/Swiften/Parser/PayloadParsers/ReferencePayloadParser.h b/Swiften/Parser/PayloadParsers/ReferencePayloadParser.h
new file mode 100644
index 0000000..3afd181
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/ReferencePayloadParser.h
@@ -0,0 +1,35 @@
+/*
+ * 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/Parser/GenericPayloadParser.h>
+
+namespace Swift {
+
+ class PayloadParserFactoryCollection;
+
+ class SWIFTEN_API ReferencePayloadParser : public GenericPayloadParser<ReferencePayload> {
+ public:
+
+ ReferencePayloadParser(PayloadParserFactoryCollection* factories);
+
+ virtual void handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes);
+ virtual void handleEndElement(const std::string& element, const std::string& ns);
+ virtual void handleCharacterData(const std::string& data);
+
+ private:
+
+ ReferencePayload::Type getTypeFromString(const std::string& typeString) const;
+ int level_ = 0;
+ const int topLevel_ = 0;
+ const int payloadLevel_ = 1;
+ PayloadParserFactoryCollection* factories_;
+ std::shared_ptr<PayloadParser> currentPayloadParser_;
+ };
+}
diff --git a/Swiften/Parser/PayloadParsers/ResultSetParser.h b/Swiften/Parser/PayloadParsers/ResultSetParser.h
index aa18ae6..edf6f2f 100644
--- a/Swiften/Parser/PayloadParsers/ResultSetParser.h
+++ b/Swiften/Parser/PayloadParsers/ResultSetParser.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,20 +9,17 @@
#include <memory>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/ResultSet.h>
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class PayloadParserFactoryCollection;
-
class SWIFTEN_API ResultSetParser : public GenericPayloadParser<ResultSet> {
public:
ResultSetParser();
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
enum Level {
TopLevel = 0,
diff --git a/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h b/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h
index 40e010a..1fd1113 100644
--- a/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h
+++ b/Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2015 Isode Limited.
+ * Copyright (c) 2015-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -17,8 +17,6 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SerializingParser;
-
class SWIFTEN_API RosterItemExchangeParser : public GenericPayloadParser<RosterItemExchangePayload> {
public:
RosterItemExchangeParser();
diff --git a/Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp b/Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp
index 502f400..7a5a1fd 100644
--- a/Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp
+++ b/Swiften/Parser/PayloadParsers/S5BProxyRequestParser.cpp
@@ -5,7 +5,7 @@
*/
/*
- * Copyright (c) 2015-2016 Isode Limited.
+ * Copyright (c) 2015-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -13,6 +13,7 @@
#include <Swiften/Parser/PayloadParsers/S5BProxyRequestParser.h>
#include <boost/lexical_cast.hpp>
+#include <boost/numeric/conversion/cast.hpp>
#include <boost/optional.hpp>
namespace Swift {
@@ -27,15 +28,14 @@ void S5BProxyRequestParser::handleStartElement(const std::string& element, const
if (element == "streamhost") {
if (attributes.getAttributeValue("host") && attributes.getAttributeValue("jid") && attributes.getAttributeValue("port")) {
std::string host = attributes.getAttributeValue("host").get_value_or("");
- int port = -1;
+ unsigned short port = 0;
JID jid = attributes.getAttributeValue("jid").get_value_or("");
try {
- port = boost::lexical_cast<int>(attributes.getAttributeValue("port").get());
- } catch (boost::bad_lexical_cast &) {
- port = -1;
+ port = boost::numeric_cast<unsigned short>(boost::lexical_cast<int>(attributes.getAttributeValue("port").get()));
+ } catch (...) {
}
- if (!host.empty() && port != -1 && jid.isValid()) {
+ if (!host.empty() && port != 0 && jid.isValid()) {
S5BProxyRequest::StreamHost streamHost;
streamHost.host = host;
streamHost.port = port;
diff --git a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp
index 1897080..58b0af0 100644
--- a/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp
+++ b/Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.cpp
@@ -34,7 +34,7 @@ void SecurityLabelsCatalogParser::handleStartElement(const std::string& element,
currentItem_->setSelector(attributes.getAttribute("selector"));
currentItem_->setIsDefault(attributes.getBoolAttribute("default", false));
}
- else if (level_ == LabelLevel) {
+ else if (level_ == LabelLevel && currentItem_) {
assert(!labelParser_);
if (labelParserFactory_->canParse(element, ns, attributes)) {
labelParser_ = dynamic_cast<SecurityLabelParser*>(labelParserFactory_->createPayloadParser());
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXCreateParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXCreateParserTest.cpp
new file mode 100644
index 0000000..f48bbc7
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXCreateParserTest.cpp
@@ -0,0 +1,89 @@
+/*
+ * 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/Elements/MIXCreate.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXCreateParserTest, XEP0369_Example68) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<create xmlns=\"urn:xmpp:mix:0\"/>"
+ ));
+
+ auto payload = parser.getPayload<MIXCreate>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_FALSE(payload->getData());
+ ASSERT_FALSE(payload->getChannel());
+}
+
+TEST(MIXCreateParserTest, XEP0369_Example66) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<create channel=\"coven\" xmlns=\"urn:xmpp:mix:0\"/>"
+ ));
+
+ auto payload = parser.getPayload<MIXCreate>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_FALSE(payload->getData());
+
+ ASSERT_TRUE(payload->getChannel());
+ ASSERT_EQ(std::string("coven"), *payload->getChannel());
+}
+
+TEST(MIXCreateParserTest, XEP0369_Example67) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<create channel=\"coven\" xmlns=\"urn:xmpp:mix:0\">"
+ "<x xmlns=\"jabber:x:data\" type=\"result\">"
+ "<field var=\"FORM_TYPE\" type=\"hidden\">"
+ "<value>urn:xmpp:mix:0</value>"
+ "</field>"
+ "<field var=\"Owner\">"
+ "<value>hecate@shakespeare.lit</value>"
+ "<value>greymalkin@shakespeare.lit</value>"
+ "</field>"
+ "<field var=\"Messages Node Subscription\">"
+ "<value>allowed</value>"
+ "</field>"
+ "<field var=\"JID Visibility\">"
+ "<value>jid-mandatory-visible</value>"
+ "</field>"
+ "<field var=\"No Private Messages\">"
+ "<value>true</value>"
+ "</field>"
+ "</x>"
+ "</create>"
+ ));
+
+ auto payload = parser.getPayload<MIXCreate>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getData());
+ ASSERT_EQ(Form::Type::ResultType, payload->getData()->getType());
+ std::shared_ptr<FormField> fieldType = payload->getData()->getField("FORM_TYPE");
+ ASSERT_TRUE(fieldType);
+
+ std::shared_ptr<FormField> fieldJIDVisibility = payload->getData()->getField("JID Visibility");
+ ASSERT_TRUE(fieldJIDVisibility);
+ ASSERT_EQ(std::string("jid-mandatory-visible"), fieldJIDVisibility->getTextSingleValue());
+
+ std::shared_ptr<FormField> fieldprivateMessages = payload->getData()->getField("No Private Messages");
+ ASSERT_TRUE(fieldprivateMessages);
+ ASSERT_EQ(std::string("true"), fieldprivateMessages->getTextSingleValue());
+
+ std::shared_ptr<FormField> nodeSubs = payload->getData()->getField("Messages Node Subscription");
+ ASSERT_TRUE(nodeSubs);
+ ASSERT_EQ(std::string("allowed"), nodeSubs->getTextSingleValue());
+
+ ASSERT_TRUE(payload->getChannel());
+ ASSERT_EQ(std::string("coven"), *payload->getChannel());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXDestroyParser.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXDestroyParser.cpp
new file mode 100644
index 0000000..80eb144
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXDestroyParser.cpp
@@ -0,0 +1,25 @@
+/*
+ * 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/Elements/MIXDestroy.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXDestroyParserTest, XEP0369_Example70) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<destroy channel=\"coven\" xmlns=\"urn:xmpp:mix:0\"/>"
+ ));
+
+ auto payload = parser.getPayload<MIXDestroy>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getChannel());
+ ASSERT_EQ(std::string("coven"), *payload->getChannel());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXDestroyParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXDestroyParserTest.cpp
new file mode 100644
index 0000000..5fa321e
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXDestroyParserTest.cpp
@@ -0,0 +1,24 @@
+/*
+ * 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/Elements/MIXDestroy.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXDestroyParserTest, XEP0369_Example70) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<destroy channel=\"coven\" xmlns=\"urn:xmpp:mix:0\"/>"
+ ));
+
+ auto payload = parser.getPayload<MIXDestroy>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_EQ(std::string("coven"), payload->getChannel());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXJoinParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXJoinParserTest.cpp
new file mode 100644
index 0000000..0ad4589
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXJoinParserTest.cpp
@@ -0,0 +1,176 @@
+/*
+ * 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/Elements/MIXJoin.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXJoinParserTest, XEP0369_Example22) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<join xmlns=\"urn:xmpp:mix:0\" channel=\"coven@mix.shakespeare.example\">"
+ "<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\"/>"
+ "</join>"
+ ));
+
+ MIXJoin::ref payload = parser.getPayload<MIXJoin>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getChannel());
+ ASSERT_EQ(JID("coven@mix.shakespeare.example"), *payload->getChannel());
+ ASSERT_FALSE(payload->getJID());
+ ASSERT_FALSE(payload->getForm());
+
+ ASSERT_EQ(static_cast<size_t>(4), payload->getSubscriptions().size());
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:messages")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:presence")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:participants")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:config")));
+}
+
+TEST(MIXJoinParserTest, XEP0369_Example23) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<join xmlns=\"urn:xmpp:mix:0\">"
+ "<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\"/>"
+ "</join>"
+ ));
+
+ MIXJoin::ref payload = parser.getPayload<MIXJoin>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_FALSE(payload->getChannel());
+ ASSERT_FALSE(payload->getJID());
+ ASSERT_FALSE(payload->getForm());
+
+ ASSERT_EQ(static_cast<size_t>(4), payload->getSubscriptions().size());
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:messages")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:presence")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:participants")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:config")));
+}
+
+TEST(MIXJoinParserTest, XEP0369_Example24) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<join xmlns=\"urn:xmpp:mix:0\" jid=\"123456#coven@mix.shakespeare.example\">"
+ "<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\"/>"
+ "</join>"
+ ));
+
+ MIXJoin::ref payload = parser.getPayload<MIXJoin>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_FALSE(payload->getChannel());
+ ASSERT_TRUE(payload->getJID());
+ ASSERT_EQ(JID("123456#coven@mix.shakespeare.example"), *payload->getJID());
+ ASSERT_FALSE(payload->getForm());
+
+ ASSERT_EQ(static_cast<size_t>(4), payload->getSubscriptions().size());
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:messages")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:presence")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:participants")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:config")));
+}
+
+TEST(MIXJoinParserTest, XEP0369_Example29) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<join xmlns=\"urn:xmpp:mix:0\">"
+ "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
+ "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
+ "<x xmlns=\"jabber:x:data\" type=\"submit\">"
+ "<field var=\"FORM_TYPE\" type=\"hidden\">"
+ "<value>urn:xmpp:mix:0</value>"
+ "</field>"
+ "<field var=\"JID Visibility\">"
+ "<value>never</value>"
+ "</field>"
+ "</x>"
+ "</join>"));
+
+ MIXJoin::ref payload = parser.getPayload<MIXJoin>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_FALSE(payload->getChannel());
+ ASSERT_FALSE(payload->getJID());
+
+ ASSERT_EQ(static_cast<size_t>(2), payload->getSubscriptions().size());
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:messages")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:presence")));
+
+ ASSERT_TRUE(payload->getForm());
+ ASSERT_EQ(Form::Type::SubmitType, payload->getForm()->getType());
+ std::shared_ptr<FormField> fieldType = payload->getForm()->getField("FORM_TYPE");
+ ASSERT_TRUE(fieldType);
+
+ std::shared_ptr<FormField> fieldJIDVisibility = payload->getForm()->getField("JID Visibility");
+ ASSERT_TRUE(fieldJIDVisibility);
+ ASSERT_EQ(std::string("never"), fieldJIDVisibility->getTextSingleValue());
+}
+
+TEST(MIXJoinParserTest, XEP0369_Example30) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<join xmlns=\"urn:xmpp:mix:0\" jid=\"hag66@shakespeare.example\">"
+ "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
+ "<subscribe node=\"urn:xmpp:mix:nodes:presence\"/>"
+ "<x xmlns=\"jabber:x:data\" type=\"result\">"
+ "<field var=\"FORM_TYPE\" type=\"hidden\">"
+ "<value>urn:xmpp:mix:0</value>"
+ "</field>"
+ "<field var=\"JID Visibility\">"
+ "<value>never</value>"
+ "</field>"
+ "<field var=\"Private Messages\">"
+ "<value>allow</value>"
+ "</field>"
+ "<field var=\"vCard\">"
+ "<value>block</value>"
+ "</field>"
+ "</x>"
+ "</join>"));
+
+ MIXJoin::ref payload = parser.getPayload<MIXJoin>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_FALSE(payload->getChannel());
+ ASSERT_TRUE(payload->getJID());
+ ASSERT_EQ(JID("hag66@shakespeare.example"), *payload->getJID());
+
+ ASSERT_EQ(static_cast<size_t>(2), payload->getSubscriptions().size());
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:messages")));
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:presence")));
+
+ ASSERT_TRUE(payload->getForm());
+ ASSERT_EQ(Form::Type::ResultType, payload->getForm()->getType());
+ std::shared_ptr<FormField> fieldType = payload->getForm()->getField("FORM_TYPE");
+ ASSERT_TRUE(fieldType);
+
+ std::shared_ptr<FormField> fieldJIDVisibility = payload->getForm()->getField("JID Visibility");
+ ASSERT_TRUE(fieldJIDVisibility);
+ ASSERT_EQ(std::string("never"), fieldJIDVisibility->getTextSingleValue());
+
+ std::shared_ptr<FormField> fieldprivateMessages = payload->getForm()->getField("Private Messages");
+ ASSERT_TRUE(fieldprivateMessages);
+ ASSERT_EQ(std::string("allow"), fieldprivateMessages->getTextSingleValue());
+
+ std::shared_ptr<FormField> vCard = payload->getForm()->getField("vCard");
+ ASSERT_TRUE(vCard);
+ ASSERT_EQ(std::string("block"), vCard->getTextSingleValue());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXLeaveParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXLeaveParserTest.cpp
new file mode 100644
index 0000000..0a2839e
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXLeaveParserTest.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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/Elements/MIXLeave.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXLeaveParserTest, XEP0369_Example33) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse("<leave xmlns=\"urn:xmpp:mix:0\" channel=\"coven@mix.shakespeare.example\"/>"));
+
+ auto payload = parser.getPayload<MIXLeave>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getChannel());
+ ASSERT_EQ(JID("coven@mix.shakespeare.example"), *payload->getChannel());
+}
+
+TEST(MIXLeaveParserTest, XEP0369_Example34) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse("<leave xmlns=\"urn:xmpp:mix:0\"/>"));
+
+ auto payload = parser.getPayload<MIXLeave>();
+ ASSERT_TRUE(payload);
+ ASSERT_FALSE(payload->getChannel());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXParticipantParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXParticipantParserTest.cpp
new file mode 100644
index 0000000..57d4b35
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXParticipantParserTest.cpp
@@ -0,0 +1,56 @@
+/*
+ * 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/Elements/MIXParticipant.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXParticipantParserTest, XEP0369_Example1_ParticipantWithNick) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<participant xmlns='urn:xmpp:mix:0'> <nick>thirdwitch</nick> </participant>"
+ ));
+
+ MIXParticipant::ref payload = parser.getPayload<MIXParticipant>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getNick());
+ std::string nick = *payload->getNick();
+ ASSERT_EQ("thirdwitch", nick);
+
+ ASSERT_FALSE(payload->getJID());
+}
+
+TEST(MIXParticipantParserTest, XEP0369_Example2_ParticipantWithJID) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<participant xmlns='urn:xmpp:mix:0'> <jid>hecate@mix.shakespeare.example</jid> </participant>"
+ ));
+
+ MIXParticipant::ref payload = parser.getPayload<MIXParticipant>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getJID());
+ JID jid = *payload->getJID();
+ ASSERT_EQ("hecate@mix.shakespeare.example", jid.toString());
+
+ ASSERT_FALSE(payload->getNick());
+}
+
+TEST(MIXParticipantParserTest, XEP0369_Example27_ParticipantEmpty) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<participant xmlns='urn:xmpp:mix:0'/>"
+ ));
+
+ MIXParticipant::ref payload = parser.getPayload<MIXParticipant>();
+ ASSERT_TRUE(payload);
+ ASSERT_FALSE(payload->getNick());
+ ASSERT_FALSE(payload->getJID());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXPayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXPayloadParserTest.cpp
new file mode 100644
index 0000000..920aca7
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXPayloadParserTest.cpp
@@ -0,0 +1,85 @@
+/*
+ * 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/Elements/MIXPayload.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXPayloadParserTest, WithNick) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<mix xmlns=\"urn:xmpp:mix:0\"> <nick>thirdwitch</nick> </mix>"
+ ));
+
+ auto payload = parser.getPayload<MIXPayload>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getNick());
+ std::string nick = *payload->getNick();
+ ASSERT_EQ("thirdwitch", nick);
+
+ ASSERT_FALSE(payload->getJID());
+ ASSERT_FALSE(payload->getSubmissionID());
+}
+
+TEST(MIXPayloadParserTest, WithJID) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<mix xmlns=\"urn:xmpp:mix:0\"> <jid>hecate@mix.shakespeare.example</jid> </mix>"
+ ));
+
+ auto payload = parser.getPayload<MIXPayload>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getJID());
+ JID jid = *payload->getJID();
+ ASSERT_EQ("hecate@mix.shakespeare.example", jid.toString());
+
+ ASSERT_FALSE(payload->getNick());
+ ASSERT_FALSE(payload->getSubmissionID());
+}
+
+TEST(MIXPayloadParserTest, WithAll) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<mix xmlns=\"urn:xmpp:mix:0\">"
+ "<nick>thirdwitch</nick>"
+ "<jid>hecate@mix.shakespeare.example</jid>"
+ "<submission-id>92vax143g</submission-id>"
+ "</mix>"
+ ));
+
+ auto payload = parser.getPayload<MIXPayload>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getNick());
+ std::string nick = *payload->getNick();
+ ASSERT_EQ("thirdwitch", nick);
+
+ ASSERT_TRUE(payload->getJID());
+ JID jid = *payload->getJID();
+ ASSERT_EQ("hecate@mix.shakespeare.example", jid.toString());
+
+ ASSERT_TRUE(payload->getSubmissionID());
+ std::string subID = *payload->getSubmissionID();
+ ASSERT_EQ("92vax143g", subID);
+}
+
+TEST(MIXPayloadParserTest, Empty) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<mix xmlns=\"urn:xmpp:mix:0\"/>"
+ ));
+
+ auto payload = parser.getPayload<MIXPayload>();
+ ASSERT_TRUE(payload);
+ ASSERT_FALSE(payload->getNick());
+ ASSERT_FALSE(payload->getJID());
+ ASSERT_FALSE(payload->getSubmissionID());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXRegisterNickParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXRegisterNickParserTest.cpp
new file mode 100644
index 0000000..d0539fd
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXRegisterNickParserTest.cpp
@@ -0,0 +1,23 @@
+/*
+ * 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/Elements/MIXRegisterNick.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXRegisterNickParserTest, WithNick) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<register xmlns=\"urn:xmpp:mix:0\"> <nick>thirdwitch</nick> </register>"
+ ));
+
+ auto payload = parser.getPayload<MIXRegisterNick>();
+ ASSERT_TRUE(payload);
+ ASSERT_EQ("thirdwitch", payload->getNick());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXSetNickParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXSetNickParserTest.cpp
new file mode 100644
index 0000000..84f8a5e
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXSetNickParserTest.cpp
@@ -0,0 +1,23 @@
+/*
+ * 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/Elements/MIXSetNick.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXSetNickParserTest, WithNick) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<setnick xmlns=\"urn:xmpp:mix:0\"> <nick>thirdwitch</nick> </setnick>"
+ ));
+
+ auto payload = parser.getPayload<MIXSetNick>();
+ ASSERT_TRUE(payload);
+ ASSERT_EQ("thirdwitch", payload->getNick());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXUpdateSubscriptionParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXUpdateSubscriptionParserTest.cpp
new file mode 100644
index 0000000..985a34b
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXUpdateSubscriptionParserTest.cpp
@@ -0,0 +1,49 @@
+/*
+ * 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/Elements/MIXUpdateSubscription.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXUpdateSubscriptionParserTest, XEP0369_Example28) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<update-subscription xmlns=\"urn:xmpp:mix:0\">"
+ "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
+ "</update-subscription>"
+ ));
+
+ auto payload = parser.getPayload<MIXUpdateSubscription>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_FALSE(payload->getJID());
+
+ auto items = payload->getSubscriptions();
+ ASSERT_EQ(static_cast<size_t>(1), items.size());
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:messages")));
+}
+
+TEST(MIXUpdateSubscriptionParserTest, XEP0369_Example28_WithJID) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<update-subscription xmlns=\"urn:xmpp:mix:0\" jid=\"hag66@shakespeare.example\">"
+ "<subscribe node=\"urn:xmpp:mix:nodes:messages\"/>"
+ "</update-subscription>"
+ ));
+
+ auto payload = parser.getPayload<MIXUpdateSubscription>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getJID());
+ ASSERT_EQ(JID("hag66@shakespeare.example"), *payload->getJID());
+
+ auto items = payload->getSubscriptions();
+ ASSERT_EQ(static_cast<size_t>(1), items.size());
+ ASSERT_TRUE(payload->hasSubscription(std::string("urn:xmpp:mix:nodes:messages")));
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MIXUserPreferenceParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MIXUserPreferenceParserTest.cpp
new file mode 100644
index 0000000..7115f2a
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/MIXUserPreferenceParserTest.cpp
@@ -0,0 +1,66 @@
+/*
+ * 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/Elements/MIXUserPreference.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(MIXUserPreferenceParserTest, XEP0369_Example31) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<user-preference xmlns='urn:xmpp:mix:0'/>"
+ ));
+
+ auto payload = parser.getPayload<MIXUserPreference>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_FALSE(payload->getData());
+}
+
+TEST(MIXUserPreferenceParserTest, XEP0369_Example32) {
+ PayloadsParserTester parser;
+ ASSERT_TRUE(parser.parse(
+ "<user-preference xmlns='urn:xmpp:mix:0'>"
+ "<x xmlns='jabber:x:data' type='result'>"
+ "<field var='FORM_TYPE' type='hidden'>"
+ "<value>urn:xmpp:mix:0</value>"
+ "</field>"
+ "<field var='JID Visibility'>"
+ "<value>never</value>"
+ "</field>"
+ "<field var='Private Messages'>"
+ "<value>allow</value>"
+ "</field>"
+ "<field var='vCard'>"
+ "<value>block</value>"
+ "</field>"
+ "</x>"
+ "</user-preference>"
+ ));
+
+ auto payload = parser.getPayload<MIXUserPreference>();
+ ASSERT_TRUE(payload);
+
+ ASSERT_TRUE(payload->getData());
+ ASSERT_EQ(Form::Type::ResultType, payload->getData()->getType());
+ std::shared_ptr<FormField> fieldType = payload->getData()->getField("FORM_TYPE");
+ ASSERT_TRUE(fieldType);
+
+ std::shared_ptr<FormField> fieldJIDVisibility = payload->getData()->getField("JID Visibility");
+ ASSERT_TRUE(fieldJIDVisibility);
+ ASSERT_EQ(std::string("never"), fieldJIDVisibility->getTextSingleValue());
+
+ std::shared_ptr<FormField> fieldprivateMessages = payload->getData()->getField("Private Messages");
+ ASSERT_TRUE(fieldprivateMessages);
+ ASSERT_EQ(std::string("allow"), fieldprivateMessages->getTextSingleValue());
+
+ std::shared_ptr<FormField> vCard = payload->getData()->getField("vCard");
+ ASSERT_TRUE(vCard);
+ ASSERT_EQ(std::string("block"), vCard->getTextSingleValue());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
index dcdbffa..8f9e0e1 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
+++ b/Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h
@@ -19,7 +19,7 @@ namespace Swift {
class PayloadsParserTester : public XMLParserClient {
public:
PayloadsParserTester() : level(0) {
- xmlParser = PlatformXMLParserFactory().createXMLParser(this);
+ xmlParser = PlatformXMLParserFactory().createXMLParser(this, false);
}
bool parse(const std::string& data) {
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ReferencePayloadParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ReferencePayloadParserTest.cpp
new file mode 100644
index 0000000..ca7b280
--- /dev/null
+++ b/Swiften/Parser/PayloadParsers/UnitTest/ReferencePayloadParserTest.cpp
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <gtest/gtest.h>
+
+#include <Swiften/Elements/Body.h>
+#include <Swiften/Elements/Delay.h>
+#include <Swiften/Elements/ErrorPayload.h>
+#include <Swiften/Parser/PayloadParsers/ReferencePayloadParser.h>
+#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h>
+
+using namespace Swift;
+
+TEST(ReferencePayloadParserTest, testParse) {
+ PayloadsParserTester parser;
+
+ ASSERT_TRUE(parser.parse(
+ "<reference xmlns='urn:xmpp:reference:0' "
+ "type='data' "
+ "uri='https://www.example.com/mindBlowingImage.jpeg' "
+ "begin='11' "
+ "end='22' "
+ "anchor='xmpp:data@localhost.example.test'>"
+ "</reference>"));
+
+ auto payload = std::dynamic_pointer_cast<ReferencePayload>(parser.getPayload());
+ ASSERT_EQ(static_cast<int>(ReferencePayload::Type::Data), static_cast<int>(payload->getType()));
+ ASSERT_EQ(std::string("https://www.example.com/mindBlowingImage.jpeg"), *payload->getUri());
+ ASSERT_EQ(std::string("11"), *payload->getBegin());
+ ASSERT_EQ(std::string("22"), *payload->getEnd());
+ ASSERT_EQ(std::string("xmpp:data@localhost.example.test"), *payload->getAnchor());
+}
+
+TEST(ReferencePayloadParserTest, testParseNoType) {
+ PayloadsParserTester parser;
+
+ ASSERT_TRUE(parser.parse(
+ "<reference xmlns='urn:xmpp:reference:0' "
+ "uri='https://www.example.com/mindBlowingImage.jpeg' "
+ "begin='11' "
+ "end='22' "
+ "anchor='xmpp:data@localhost.example.test'>"
+ "</reference>"));
+
+ auto payload = std::dynamic_pointer_cast<ReferencePayload>(parser.getPayload());
+ ASSERT_EQ(static_cast<int>(ReferencePayload::Type::Unknown), static_cast<int>(payload->getType()));
+ ASSERT_EQ(std::string("https://www.example.com/mindBlowingImage.jpeg"), *payload->getUri());
+ ASSERT_EQ(std::string("11"), *payload->getBegin());
+ ASSERT_EQ(std::string("22"), *payload->getEnd());
+ ASSERT_EQ(std::string("xmpp:data@localhost.example.test"), *payload->getAnchor());
+}
+
+TEST(ReferencePayloadParserTest, testParseEmbeddedPayloads) {
+ PayloadsParserTester parser;
+
+ ASSERT_TRUE(parser.parse(
+ "<reference xmlns='urn:xmpp:reference:0' type='data'> "
+ "<error type=\"modify\">"
+ "<bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/>"
+ "<delay xmlns='urn:xmpp:delay' from='juliet@capulet.com/balcony' stamp='2002-09-10T23:41:07Z'/>"
+ "<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">boo</text>"
+ "</error>"
+ "</reference>"));
+
+ auto payload = std::dynamic_pointer_cast<ReferencePayload>(parser.getPayload());
+ ASSERT_EQ(static_cast<int>(ReferencePayload::Type::Data), static_cast<int>(payload->getType()));
+ ASSERT_FALSE(payload->getUri());
+ ASSERT_FALSE(payload->getBegin());
+ ASSERT_FALSE(payload->getEnd());
+ ASSERT_FALSE(payload->getAnchor());
+ auto childPayloadList = payload->getPayloads();
+ auto errorPayload = std::dynamic_pointer_cast<ErrorPayload>(childPayloadList[0]);
+ ASSERT_TRUE(errorPayload);
+ ASSERT_EQ("boo", errorPayload->getText());
+ auto delayPayload = std::dynamic_pointer_cast<Delay>(errorPayload->getPayload());
+ ASSERT_TRUE(delayPayload);
+}
+
+TEST(ReferencePayloadParserTest, testParseEmbeddedPayloadWithText) {
+ PayloadsParserTester parser;
+
+ ASSERT_TRUE(parser.parse(
+ "<reference xmlns='urn:xmpp:reference:0' type='data'> "
+ "<body>Example Text</body>"
+ "</reference>"));
+
+ auto payload = std::dynamic_pointer_cast<ReferencePayload>(parser.getPayload());
+ auto childPayloadList = payload->getPayloads();
+ auto bodyPayload = std::dynamic_pointer_cast<Body>(childPayloadList[0]);
+ ASSERT_EQ("Example Text", bodyPayload->getText());
+}
+
+TEST(ReferencePayloadParserTest, testParseRecursive) {
+ PayloadsParserTester parser;
+
+ ASSERT_TRUE(parser.parse(
+ "<reference xmlns='urn:xmpp:reference:0' type='data'> "
+ "<reference xmlns='urn:xmpp:reference:0' type='data' uri='https://download.montague.lit/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/summit.jpg' /> "
+ "<reference xmlns='urn:xmpp:reference:0' type='data' uri='xmpp:romeo@montague.lit/resource?jingle;id=9559976B-3FBF-4E7E-B457-2DAA225972BB' /> "
+ "<reference xmlns='urn:xmpp:reference:0' type='data'> "
+ "<reference xmlns='urn:xmpp:reference:0' type='data' uri='https://www.example.com/mindBlowingImage.jpeg' /> "
+ "</reference>"
+ "</reference>"));
+
+ auto payload = std::dynamic_pointer_cast<ReferencePayload>(parser.getPayload());
+ ASSERT_EQ(static_cast<int>(ReferencePayload::Type::Data), static_cast<int>(payload->getType()));
+ auto childPayloadList = payload->getPayloads();
+ auto childPayloadA = std::dynamic_pointer_cast<ReferencePayload>(childPayloadList[0]);
+ auto childPayloadB = std::dynamic_pointer_cast<ReferencePayload>(childPayloadList[1]);
+ auto childPayloadC = std::dynamic_pointer_cast<ReferencePayload>(childPayloadList[2]);
+ ASSERT_TRUE(childPayloadA);
+ ASSERT_TRUE(childPayloadB);
+ ASSERT_TRUE(childPayloadC);
+ ASSERT_EQ(static_cast<int>(ReferencePayload::Type::Data), static_cast<int>(childPayloadA->getType()));
+ ASSERT_EQ(static_cast<int>(ReferencePayload::Type::Data), static_cast<int>(childPayloadB->getType()));
+ ASSERT_EQ(static_cast<int>(ReferencePayload::Type::Data), static_cast<int>(childPayloadC->getType()));
+ ASSERT_EQ(std::string("https://download.montague.lit/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/summit.jpg"), *childPayloadA->getUri());
+ ASSERT_EQ(std::string("xmpp:romeo@montague.lit/resource?jingle;id=9559976B-3FBF-4E7E-B457-2DAA225972BB"), *childPayloadB->getUri());
+ ASSERT_FALSE(childPayloadC->getUri());
+ ASSERT_FALSE(childPayloadC->getBegin());
+ ASSERT_FALSE(childPayloadC->getEnd());
+ ASSERT_FALSE(childPayloadC->getAnchor());
+ auto grandChildPayloadList = childPayloadC->getPayloads();
+ auto grandChildPayload = std::dynamic_pointer_cast<ReferencePayload>(grandChildPayloadList[0]);
+ ASSERT_TRUE(grandChildPayload);
+ ASSERT_EQ(static_cast<int>(ReferencePayload::Type::Data), static_cast<int>(grandChildPayload->getType()));
+ ASSERT_EQ(std::string("https://www.example.com/mindBlowingImage.jpeg"), *grandChildPayload->getUri());
+ ASSERT_FALSE(grandChildPayload->getBegin());
+ ASSERT_FALSE(grandChildPayload->getEnd());
+ ASSERT_FALSE(grandChildPayload->getAnchor());
+}
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp
index 2b992b1..ee7668c 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/SecurityLabelsCatalogParserTest.cpp
@@ -16,6 +16,7 @@ class SecurityLabelsCatalogParserTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(SecurityLabelsCatalogParserTest);
CPPUNIT_TEST(testParse);
+ CPPUNIT_TEST(testParseInvalidInput);
CPPUNIT_TEST_SUITE_END();
public:
@@ -46,6 +47,7 @@ class SecurityLabelsCatalogParserTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(std::string("an example set of labels"), payload->getDescription());
CPPUNIT_ASSERT_EQUAL(JID("example.com"), payload->getTo());
CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(payload->getItems().size()));
+
CPPUNIT_ASSERT_EQUAL(std::string("SECRET"), payload->getItems()[0].getLabel()->getDisplayMarking());
CPPUNIT_ASSERT_EQUAL(std::string("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel>"), payload->getItems()[0].getLabel()->getLabel());
CPPUNIT_ASSERT_EQUAL(false, payload->getItems()[0].getIsDefault());
@@ -58,6 +60,61 @@ class SecurityLabelsCatalogParserTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(std::string("Unclassified|UNCLASSIFIED"), payload->getItems()[2].getSelector());
CPPUNIT_ASSERT(!payload->getItems()[2].getLabel());
}
+
+ void testParseInvalidInput() {
+ PayloadsParserTester parser;
+
+ CPPUNIT_ASSERT(parser.parse(
+ "<catalog desc=\"an example set of labels\" name=\"Default\" to=\"example.com\" xmlns=\"urn:xmpp:sec-label:catalog:2\">"
+ "<item selector='Classified|INVALID-SECRET' xmlns=\"\">"
+ "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">"
+ "<displaymarking bgcolor=\"red\" fgcolor=\"black\">INVALID-SECRET</displaymarking>"
+ "<label><esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel></label>"
+ "</securitylabel>"
+ "</item>"
+ "<item selector='Classified|INVALID-TOPSECRET' xmlns=\"urn:xmpp:sec-label:catalog:invalid:2\">"
+ "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">"
+ "<displaymarking bgcolor=\"red\" fgcolor=\"black\">INVALID-TOPSECRET</displaymarking>"
+ "<label><esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel></label>"
+ "</securitylabel>"
+ "</item>"
+ "<item selector='Classified|CONFIDENTIAL' default='true' xmlns=\"urn:xmpp:sec-label:catalog:2\">"
+ "<securitylabel xmlns=\"urn:xmpp:sec-label:0\">"
+ "<displaymarking bgcolor=\"navy\" fgcolor=\"black\">CONFIDENTIAL</displaymarking>"
+ "<label><esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel></label>"
+ "</securitylabel>"
+ "</item>"
+ "<item selector='Classified|INVALID-LABEL'>"
+ "<securitylabel xmlns=\"\">"
+ "<displaymarking bgcolor=\"yellow\" fgcolor=\"black\">INVALID</displaymarking>"
+ "<label><esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQYCAQQGASk=</esssecuritylabel></label>"
+ "</securitylabel>"
+ "</item>"
+ "<item selector='Unclassified|UNCLASSIFIED'/>"
+ "</catalog>"));
+
+ SecurityLabelsCatalog* payload = dynamic_cast<SecurityLabelsCatalog*>(parser.getPayload().get());
+ CPPUNIT_ASSERT_EQUAL(std::string("Default"), payload->getName());
+ CPPUNIT_ASSERT_EQUAL(std::string("an example set of labels"), payload->getDescription());
+ CPPUNIT_ASSERT_EQUAL(JID("example.com"), payload->getTo());
+ CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(payload->getItems().size()));
+
+ CPPUNIT_ASSERT(payload->getItems()[0].getLabel());
+ if (payload->getItems()[0].getLabel()) {
+ CPPUNIT_ASSERT_EQUAL(std::string("CONFIDENTIAL"), payload->getItems()[0].getLabel()->getDisplayMarking());
+ CPPUNIT_ASSERT_EQUAL(std::string("<esssecuritylabel xmlns=\"urn:xmpp:sec-label:ess:0\">MQMGASk=</esssecuritylabel>"), payload->getItems()[0].getLabel()->getLabel());
+ CPPUNIT_ASSERT_EQUAL(true, payload->getItems()[0].getIsDefault());
+ CPPUNIT_ASSERT_EQUAL(std::string("Classified|CONFIDENTIAL"), payload->getItems()[0].getSelector());
+ }
+ //The label is invalid, but the rest of the item entry should be there.
+ CPPUNIT_ASSERT(!payload->getItems()[1].getLabel());
+ CPPUNIT_ASSERT_EQUAL(false, payload->getItems()[1].getIsDefault());
+ CPPUNIT_ASSERT_EQUAL(std::string("Classified|INVALID-LABEL"), payload->getItems()[1].getSelector());
+ CPPUNIT_ASSERT_EQUAL(false, payload->getItems()[2].getIsDefault());
+ CPPUNIT_ASSERT_EQUAL(std::string("Unclassified|UNCLASSIFIED"), payload->getItems()[2].getSelector());
+ CPPUNIT_ASSERT(!payload->getItems()[2].getLabel());
+ }
+
};
CPPUNIT_TEST_SUITE_REGISTRATION(SecurityLabelsCatalogParserTest);
diff --git a/Swiften/Parser/PayloadParsers/UserLocationParser.h b/Swiften/Parser/PayloadParsers/UserLocationParser.h
index 1445d3e..39df9de 100644
--- a/Swiften/Parser/PayloadParsers/UserLocationParser.h
+++ b/Swiften/Parser/PayloadParsers/UserLocationParser.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 <string>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/UserLocation.h>
#include <Swiften/Parser/GenericPayloadParser.h>
@@ -18,11 +17,11 @@ namespace Swift {
class SWIFTEN_API UserLocationParser : public GenericPayloadParser<UserLocation> {
public:
UserLocationParser();
- virtual ~UserLocationParser();
+ virtual ~UserLocationParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/UserTuneParser.h b/Swiften/Parser/PayloadParsers/UserTuneParser.h
index 5a27273..8c7e8c5 100644
--- a/Swiften/Parser/PayloadParsers/UserTuneParser.h
+++ b/Swiften/Parser/PayloadParsers/UserTuneParser.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.
*/
@@ -10,7 +10,6 @@
#include <string>
#include <Swiften/Base/API.h>
-#include <Swiften/Base/Override.h>
#include <Swiften/Elements/UserTune.h>
#include <Swiften/Parser/GenericPayloadParser.h>
@@ -18,11 +17,11 @@ namespace Swift {
class SWIFTEN_API UserTuneParser : public GenericPayloadParser<UserTune> {
public:
UserTuneParser();
- virtual ~UserTuneParser();
+ virtual ~UserTuneParser() override;
- virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) SWIFTEN_OVERRIDE;
- virtual void handleEndElement(const std::string& element, const std::string&) SWIFTEN_OVERRIDE;
- virtual void handleCharacterData(const std::string& data) SWIFTEN_OVERRIDE;
+ virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) override;
+ virtual void handleEndElement(const std::string& element, const std::string&) override;
+ virtual void handleCharacterData(const std::string& data) override;
private:
int level;
diff --git a/Swiften/Parser/PayloadParsers/VCardUpdateParser.h b/Swiften/Parser/PayloadParsers/VCardUpdateParser.h
index 914f138..91837fb 100644
--- a/Swiften/Parser/PayloadParsers/VCardUpdateParser.h
+++ b/Swiften/Parser/PayloadParsers/VCardUpdateParser.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -11,8 +11,6 @@
#include <Swiften/Parser/GenericPayloadParser.h>
namespace Swift {
- class SerializingParser;
-
class SWIFTEN_API VCardUpdateParser : public GenericPayloadParser<VCardUpdate> {
public:
VCardUpdateParser();