diff options
author | Kevin Smith <git@kismith.co.uk> | 2014-08-29 12:36:17 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2014-09-17 09:52:35 (GMT) |
commit | 5bb5e4eb3024dfba3ae2b5041b90472ee478aebe (patch) | |
tree | 6e3c47ba3236a65fa0a49eb6595f3e09db31bb3e /Swiften | |
parent | fc2714bf30ddd447405082ba4f8fa93bda369a6f (diff) | |
download | swift-5bb5e4eb3024dfba3ae2b5041b90472ee478aebe.zip swift-5bb5e4eb3024dfba3ae2b5041b90472ee478aebe.tar.bz2 |
Handle Isode's IQ Forwarding
Change-Id: I3b358e6a60f1ff546f2e578b6e0a54072b4c6da5
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Elements/IsodeIQDelegation.cpp | 15 | ||||
-rw-r--r-- | Swiften/Elements/IsodeIQDelegation.h | 36 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp | 113 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp | 59 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h | 34 | ||||
-rw-r--r-- | Swiften/Parser/SConscript | 1 | ||||
-rw-r--r-- | Swiften/SConscript | 2 | ||||
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp | 105 | ||||
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp | 33 | ||||
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h | 31 |
10 files changed, 323 insertions, 106 deletions
diff --git a/Swiften/Elements/IsodeIQDelegation.cpp b/Swiften/Elements/IsodeIQDelegation.cpp new file mode 100644 index 0000000..ce13e2a --- /dev/null +++ b/Swiften/Elements/IsodeIQDelegation.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2014 Remko Tronçon and Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/IsodeIQDelegation.h> + +using namespace Swift; + +IsodeIQDelegation::IsodeIQDelegation() { +} + +IsodeIQDelegation::~IsodeIQDelegation() { +} diff --git a/Swiften/Elements/IsodeIQDelegation.h b/Swiften/Elements/IsodeIQDelegation.h new file mode 100644 index 0000000..7935a4f --- /dev/null +++ b/Swiften/Elements/IsodeIQDelegation.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014 Remko Tronçon and Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> + +#include <Swiften/Elements/Forwarded.h> + +namespace Swift { + class SWIFTEN_API IsodeIQDelegation : public Payload { + public: + + IsodeIQDelegation(); + + virtual ~IsodeIQDelegation(); + + boost::shared_ptr<Forwarded> getForward() const { + return forward; + } + + void setForward(boost::shared_ptr<Forwarded> value) { + this->forward = value ; + } + + + private: + boost::shared_ptr<Forwarded> forward; + }; +} diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp index 4541b3b..49dd1e3 100644 --- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp +++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp @@ -5,82 +5,86 @@ */ #include <Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h> + #include <Swiften/Base/foreach.h> + +#include <Swiften/Elements/BlockListPayload.h> #include <Swiften/Elements/BlockPayload.h> #include <Swiften/Elements/UnblockPayload.h> -#include <Swiften/Elements/BlockListPayload.h> + #include <Swiften/Parser/GenericPayloadParser.h> #include <Swiften/Parser/GenericPayloadParserFactory.h> #include <Swiften/Parser/GenericPayloadParserFactory2.h> #include <Swiften/Parser/PayloadParserFactory.h> -#include <Swiften/Parser/PayloadParsers/ErrorParser.h> -#include <Swiften/Parser/PayloadParsers/ErrorParserFactory.h> -#include <Swiften/Parser/PayloadParsers/BodyParser.h> #include <Swiften/Parser/PayloadParsers/BlockParser.h> -#include <Swiften/Parser/PayloadParsers/SubjectParser.h> +#include <Swiften/Parser/PayloadParsers/BodyParser.h> +#include <Swiften/Parser/PayloadParsers/BytestreamsParser.h> +#include <Swiften/Parser/PayloadParsers/CapsInfoParser.h> #include <Swiften/Parser/PayloadParsers/ChatStateParserFactory.h> -#include <Swiften/Parser/PayloadParsers/PriorityParser.h> -#include <Swiften/Parser/PayloadParsers/ResourceBindParser.h> -#include <Swiften/Parser/PayloadParsers/StartSessionParser.h> -#include <Swiften/Parser/PayloadParsers/StatusParser.h> -#include <Swiften/Parser/PayloadParsers/StatusShowParser.h> -#include <Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h> -#include <Swiften/Parser/PayloadParsers/RosterParser.h> -#include <Swiften/Parser/PayloadParsers/SoftwareVersionParser.h> -#include <Swiften/Parser/PayloadParsers/StorageParser.h> +#include <Swiften/Parser/PayloadParsers/CommandParser.h> +#include <Swiften/Parser/PayloadParsers/DelayParser.h> +#include <Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h> +#include <Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h> #include <Swiften/Parser/PayloadParsers/DiscoInfoParser.h> #include <Swiften/Parser/PayloadParsers/DiscoItemsParser.h> -#include <Swiften/Parser/PayloadParsers/CapsInfoParser.h> -#include <Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h> -#include <Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h> +#include <Swiften/Parser/PayloadParsers/ErrorParser.h> +#include <Swiften/Parser/PayloadParsers/ErrorParserFactory.h> #include <Swiften/Parser/PayloadParsers/FormParserFactory.h> -#include <Swiften/Parser/PayloadParsers/CommandParser.h> -#include <Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h> -#include <Swiften/Parser/PayloadParsers/SearchPayloadParser.h> -#include <Swiften/Parser/PayloadParsers/StreamInitiationParser.h> -#include <Swiften/Parser/PayloadParsers/BytestreamsParser.h> +#include <Swiften/Parser/PayloadParsers/ForwardedParser.h> #include <Swiften/Parser/PayloadParsers/IBBParser.h> -#include <Swiften/Parser/PayloadParsers/VCardUpdateParser.h> -#include <Swiften/Parser/PayloadParsers/VCardParser.h> -#include <Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h> -#include <Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h> -#include <Swiften/Parser/PayloadParsers/DelayParser.h> -#include <Swiften/Parser/PayloadParsers/MUCUserPayloadParserFactory.h> +#include <Swiften/Parser/PayloadParsers/IdleParser.h> +#include <Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h> +#include <Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h> +#include <Swiften/Parser/PayloadParsers/JingleContentPayloadParserFactory.h> +#include <Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h> +#include <Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParserFactory.h> +#include <Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h> +#include <Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.h> +#include <Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.h> +#include <Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.h> +#include <Swiften/Parser/PayloadParsers/JingleParserFactory.h> +#include <Swiften/Parser/PayloadParsers/JingleReasonParser.h> +#include <Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.h> +#include <Swiften/Parser/PayloadParsers/LastParser.h> +#include <Swiften/Parser/PayloadParsers/MAMArchivedParser.h> +#include <Swiften/Parser/PayloadParsers/MAMQueryParser.h> +#include <Swiften/Parser/PayloadParsers/MAMResultParser.h> #include <Swiften/Parser/PayloadParsers/MUCAdminPayloadParser.h> -#include <Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h> #include <Swiften/Parser/PayloadParsers/MUCDestroyPayloadParser.h> #include <Swiften/Parser/PayloadParsers/MUCInvitationPayloadParser.h> +#include <Swiften/Parser/PayloadParsers/MUCOwnerPayloadParser.h> #include <Swiften/Parser/PayloadParsers/MUCOwnerPayloadParserFactory.h> +#include <Swiften/Parser/PayloadParsers/MUCUserPayloadParserFactory.h> #include <Swiften/Parser/PayloadParsers/NicknameParser.h> +#include <Swiften/Parser/PayloadParsers/PriorityParser.h> +#include <Swiften/Parser/PayloadParsers/PrivateStorageParserFactory.h> +#include <Swiften/Parser/PayloadParsers/PubSubErrorParserFactory.h> +#include <Swiften/Parser/PayloadParsers/PubSubEventParser.h> +#include <Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h> +#include <Swiften/Parser/PayloadParsers/PubSubParser.h> +#include <Swiften/Parser/PayloadParsers/RawXMLPayloadParserFactory.h> #include <Swiften/Parser/PayloadParsers/ReplaceParser.h> -#include <Swiften/Parser/PayloadParsers/LastParser.h> -#include <Swiften/Parser/PayloadParsers/JingleParserFactory.h> -#include <Swiften/Parser/PayloadParsers/JingleReasonParser.h> -#include <Swiften/Parser/PayloadParsers/JingleContentPayloadParserFactory.h> -#include <Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.h> -#include <Swiften/Parser/PayloadParsers/JingleS5BTransportMethodPayloadParser.h> -#include <Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParserFactory.h> -#include <Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.h> -#include <Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.h> -#include <Swiften/Parser/PayloadParsers/JingleFileTransferHashParser.h> +#include <Swiften/Parser/PayloadParsers/ResourceBindParser.h> +#include <Swiften/Parser/PayloadParsers/ResultSetParser.h> +#include <Swiften/Parser/PayloadParsers/RosterItemExchangeParser.h> +#include <Swiften/Parser/PayloadParsers/RosterParser.h> #include <Swiften/Parser/PayloadParsers/S5BProxyRequestParser.h> -#include <Swiften/Parser/PayloadParsers/JingleIBBTransportMethodPayloadParser.h> -#include <Swiften/Parser/PayloadParsers/JingleFileTransferDescriptionParser.h> -#include <Swiften/Parser/PayloadParsers/DeliveryReceiptParserFactory.h> -#include <Swiften/Parser/PayloadParsers/DeliveryReceiptRequestParserFactory.h> -#include <Swiften/Parser/PayloadParsers/WhiteboardParser.h> -#include <Swiften/Parser/PayloadParsers/IdleParser.h> -#include <Swiften/Parser/PayloadParsers/PubSubParser.h> -#include <Swiften/Parser/PayloadParsers/PubSubOwnerPubSubParser.h> -#include <Swiften/Parser/PayloadParsers/PubSubEventParser.h> -#include <Swiften/Parser/PayloadParsers/PubSubErrorParserFactory.h> +#include <Swiften/Parser/PayloadParsers/SearchPayloadParser.h> +#include <Swiften/Parser/PayloadParsers/SecurityLabelParserFactory.h> +#include <Swiften/Parser/PayloadParsers/SecurityLabelsCatalogParser.h> +#include <Swiften/Parser/PayloadParsers/SoftwareVersionParser.h> +#include <Swiften/Parser/PayloadParsers/StartSessionParser.h> +#include <Swiften/Parser/PayloadParsers/StatusParser.h> +#include <Swiften/Parser/PayloadParsers/StatusShowParser.h> +#include <Swiften/Parser/PayloadParsers/StorageParser.h> +#include <Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.h> +#include <Swiften/Parser/PayloadParsers/StreamInitiationParser.h> +#include <Swiften/Parser/PayloadParsers/SubjectParser.h> #include <Swiften/Parser/PayloadParsers/UserLocationParser.h> #include <Swiften/Parser/PayloadParsers/UserTuneParser.h> -#include <Swiften/Parser/PayloadParsers/ResultSetParser.h> -#include <Swiften/Parser/PayloadParsers/ForwardedParser.h> -#include <Swiften/Parser/PayloadParsers/MAMResultParser.h> -#include <Swiften/Parser/PayloadParsers/MAMQueryParser.h> -#include <Swiften/Parser/PayloadParsers/MAMArchivedParser.h> +#include <Swiften/Parser/PayloadParsers/VCardParser.h> +#include <Swiften/Parser/PayloadParsers/VCardUpdateParser.h> +#include <Swiften/Parser/PayloadParsers/WhiteboardParser.h> using namespace boost; @@ -154,6 +158,7 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() { factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<MAMResultParser> >("result", "urn:xmpp:mam:0", this)); factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MAMQueryParser> >("query", "urn:xmpp:mam:0")); factories_.push_back(boost::make_shared<GenericPayloadParserFactory<MAMArchivedParser> >("archived", "urn:xmpp:mam:0")); + factories_.push_back(boost::make_shared<GenericPayloadParserFactory2<IsodeIQDelegationParser> >("delegate", "http://isode.com/iq_delegation", this)); foreach(shared_ptr<PayloadParserFactory> factory, factories_) { addFactory(factory.get()); diff --git a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp new file mode 100644 index 0000000..d085d09 --- /dev/null +++ b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2014 Remko Tronçon and Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma clang diagnostic ignored "-Wunused-private-field" + +#include <Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h> + +#include <boost/optional.hpp> + + +#include <Swiften/Parser/PayloadParserFactoryCollection.h> +#include <Swiften/Parser/PayloadParserFactory.h> + + +using namespace Swift; + +IsodeIQDelegationParser::IsodeIQDelegationParser(PayloadParserFactoryCollection* parsers) : parsers(parsers), level(0) { +} + +IsodeIQDelegationParser::~IsodeIQDelegationParser() { +} + +void IsodeIQDelegationParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { + + + if (level == 1) { + if (PayloadParserFactory* factory = parsers->getPayloadParserFactory(element, ns, attributes)) { + currentPayloadParser.reset(factory->createPayloadParser()); + } + } + + if (level >= 1 && currentPayloadParser) { + currentPayloadParser->handleStartElement(element, ns, attributes); + } + ++level; +} + +void IsodeIQDelegationParser::handleEndElement(const std::string& element, const std::string& ns) { + --level; + if (currentPayloadParser) { + if (level >= 1) { + currentPayloadParser->handleEndElement(element, ns); + } + + if (level == 1) { + getPayloadInternal()->setForward(boost::dynamic_pointer_cast<Forwarded>(currentPayloadParser->getPayload())); + currentPayloadParser.reset(); + } + } +} + +void IsodeIQDelegationParser::handleCharacterData(const std::string& data) { + if (level > 1 && currentPayloadParser) { + currentPayloadParser->handleCharacterData(data); + } +} diff --git a/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h new file mode 100644 index 0000000..83bf95e --- /dev/null +++ b/Swiften/Parser/PayloadParsers/IsodeIQDelegationParser.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2014 Remko Tronçon and Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/shared_ptr.hpp> + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/IsodeIQDelegation.h> +#include <Swiften/Parser/GenericPayloadParser.h> + +namespace Swift { + class PayloadParserFactoryCollection; + class PayloadParser; + + class SWIFTEN_API IsodeIQDelegationParser : public GenericPayloadParser<IsodeIQDelegation> { + public: + IsodeIQDelegationParser(PayloadParserFactoryCollection* parsers); + virtual ~IsodeIQDelegationParser(); + + 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; + + private: + PayloadParserFactoryCollection* parsers; + int level; + boost::shared_ptr<PayloadParser> currentPayloadParser; + }; +} diff --git a/Swiften/Parser/SConscript b/Swiften/Parser/SConscript index 056862f..e748320 100644 --- a/Swiften/Parser/SConscript +++ b/Swiften/Parser/SConscript @@ -82,6 +82,7 @@ sources = [ "PayloadParsers/MAMResultParser.cpp", "PayloadParsers/MAMQueryParser.cpp", "PayloadParsers/MAMArchivedParser.cpp", + "PayloadParsers/IsodeIQDelegationParser.cpp", "PlatformXMLParserFactory.cpp", "PresenceParser.cpp", "SerializingParser.cpp", diff --git a/Swiften/SConscript b/Swiften/SConscript index 0314118..a37767c 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -147,6 +147,7 @@ if env["SCONS_STAGE"] == "build" : "Elements/MAMResult.cpp", "Elements/MAMQuery.cpp", "Elements/MAMArchived.cpp", + "Elements/IsodeIQDelegation.cpp", "Entity/Entity.cpp", "Entity/PayloadPersister.cpp", "MUC/MUC.cpp", @@ -230,6 +231,7 @@ if env["SCONS_STAGE"] == "build" : "Serializer/PayloadSerializers/MAMResultSerializer.cpp", "Serializer/PayloadSerializers/MAMQuerySerializer.cpp", "Serializer/PayloadSerializers/MAMArchivedSerializer.cpp", + "Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp", "Serializer/PresenceSerializer.cpp", "Serializer/StanzaSerializer.cpp", "Serializer/StreamErrorSerializer.cpp", diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp index b5269d1..dcfb4ed 100644 --- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp +++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp @@ -10,71 +10,71 @@ #include <Swiften/Elements/UnblockPayload.h> #include <Swiften/Elements/BlockListPayload.h> #include <Swiften/Serializer/PayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/IBBSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/BodySerializer.h> #include <Swiften/Serializer/PayloadSerializers/BlockSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/SubjectSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/BodySerializer.h> +#include <Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h> #include <Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/PrioritySerializer.h> -#include <Swiften/Serializer/PayloadSerializers/ErrorSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/StatusSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/CommandSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/DelaySerializer.h> +#include <Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.h> #include <Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h> #include <Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/StorageSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/DelaySerializer.h> +#include <Swiften/Serializer/PayloadSerializers/ErrorSerializer.h> #include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/CommandSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/NicknameSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/LastSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/IdleSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/PubSubSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h> #include <Swiften/Serializer/PayloadSerializers/ForwardedSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h> -#include <Swiften/Serializer/PayloadSerializers/MAMArchivedSerializer.h> - -#include <Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/IBBSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/IdleSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h> #include <Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h> #include <Swiften/Serializer/PayloadSerializers/JingleFileTransferDescriptionSerializer.h> #include <Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h> #include <Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.h> #include <Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h> #include <Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/LastSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/MAMArchivedSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/MAMQuerySerializer.h> +#include <Swiften/Serializer/PayloadSerializers/MAMResultSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/MUCAdminPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/MUCDestroyPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/MUCInvitationPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/NicknameSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/PrioritySerializer.h> +#include <Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/PubSubErrorSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/PubSubEventSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/PubSubOwnerPubSubSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/PubSubSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/ResultSetSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h> #include <Swiften/Serializer/PayloadSerializers/S5BProxyRequestSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/DeliveryReceiptSerializer.h> -#include <Swiften/Serializer/PayloadSerializers/DeliveryReceiptRequestSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/StatusSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/StorageSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/SubjectSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/UserLocationSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/UserTuneSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h> +#include <Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.h> namespace Swift { @@ -148,6 +148,7 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() { serializers_.push_back(new MAMResultSerializer(this)); serializers_.push_back(new MAMQuerySerializer()); serializers_.push_back(new MAMArchivedSerializer()); + serializers_.push_back(new IsodeIQDelegationSerializer(this)); foreach(PayloadSerializer* serializer, serializers_) { addSerializer(serializer); diff --git a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp new file mode 100644 index 0000000..8e782b4 --- /dev/null +++ b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2014 Remko Tronçon and Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma clang diagnostic ignored "-Wunused-private-field" + +#include <Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h> +#include <Swiften/Serializer/XML/XMLElement.h> +#include <boost/smart_ptr/make_shared.hpp> + +#include <Swiften/Serializer/PayloadSerializerCollection.h> +#include <Swiften/Serializer/XML/XMLRawTextNode.h> + +using namespace Swift; + +IsodeIQDelegationSerializer::IsodeIQDelegationSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) { +} + +IsodeIQDelegationSerializer::~IsodeIQDelegationSerializer() { +} + +std::string IsodeIQDelegationSerializer::serializePayload(boost::shared_ptr<IsodeIQDelegation> payload) const { + if (!payload) { + return ""; + } + XMLElement element("delegate", "http://isode.com/iq_delegation"); + element.addNode(boost::make_shared<XMLRawTextNode>(serializers->getPayloadSerializer(payload->getForward())->serialize(payload->getForward()))); + return element.serialize(); +} + + diff --git a/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h new file mode 100644 index 0000000..1bcd993 --- /dev/null +++ b/Swiften/Serializer/PayloadSerializers/IsodeIQDelegationSerializer.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2014 Remko Tronçon and Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Serializer/GenericPayloadSerializer.h> +#include <Swiften/Elements/IsodeIQDelegation.h> +#include <boost/shared_ptr.hpp> + +namespace Swift { + class PayloadSerializerCollection; + + class SWIFTEN_API IsodeIQDelegationSerializer : public GenericPayloadSerializer<IsodeIQDelegation> { + public: + IsodeIQDelegationSerializer(PayloadSerializerCollection* serializers); + virtual ~IsodeIQDelegationSerializer(); + + virtual std::string serializePayload(boost::shared_ptr<IsodeIQDelegation>) const SWIFTEN_OVERRIDE; + + private: + + + private: + PayloadSerializerCollection* serializers; + }; +} |