From ef319397be8439482fdf95f46a29643d15980b37 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Wed, 4 Feb 2015 14:56:42 +0100 Subject: Update DiscoInfo string for Jingle file-transfer to :4 and remove obsolete files Test-Information: Unit tests run successful on OS X 10.9.5 Change-Id: I9df0c798723f79df85cfc7301aed0a7ad6309904 diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp index ddd8260..84f5ed3 100644 --- a/Swiften/Elements/DiscoInfo.cpp +++ b/Swiften/Elements/DiscoInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -17,7 +17,7 @@ const std::string DiscoInfo::JabberSearchFeature = std::string("jabber:iq:search const std::string DiscoInfo::CommandsFeature = std::string("http://jabber.org/protocol/commands"); const std::string DiscoInfo::MessageCorrectionFeature = std::string("urn:xmpp:message-correct:0"); const std::string DiscoInfo::JingleFeature = std::string("urn:xmpp:jingle:1"); -const std::string DiscoInfo::JingleFTFeature = std::string("urn:xmpp:jingle:apps:file-transfer:3"); +const std::string DiscoInfo::JingleFTFeature = std::string("urn:xmpp:jingle:apps:file-transfer:4"); const std::string DiscoInfo::JingleTransportsIBBFeature = std::string("urn:xmpp:jingle:transports:ibb:1"); const std::string DiscoInfo::JingleTransportsS5BFeature = std::string("urn:xmpp:jingle:transports:s5b:1"); const std::string DiscoInfo::Bytestream = std::string("http://jabber.org/protocol/bytestreams"); diff --git a/Swiften/Elements/JingleFileTransferReceived.h b/Swiften/Elements/JingleFileTransferReceived.h deleted file mode 100644 index 75c95d9..0000000 --- a/Swiften/Elements/JingleFileTransferReceived.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2011 Tobias Markmann - * Licensed under the simplified BSD license. - * See Documentation/Licenses/BSD-simplified.txt for more information. - */ - -#pragma once - -#include -#include - -#include -#include - -namespace Swift { - -class JingleFileTransferReceived : public Payload { - public: - typedef boost::shared_ptr ref; - - void setFileInfo(const StreamInitiationFileInfo& fileInfo) { - this->fileInfo = fileInfo; - } - - const StreamInitiationFileInfo& getFileInfo() const { - return this->fileInfo; - } - private: - StreamInitiationFileInfo fileInfo; - -}; - -} diff --git a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp index 812e968..da2f596 100644 --- a/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp +++ b/Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -142,7 +141,6 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() { factories_.push_back(boost::make_shared(this)); factories_.push_back(boost::make_shared >("file", "http://jabber.org/protocol/si/profile/file-transfer")); factories_.push_back(boost::make_shared >("file", "urn:xmpp:jingle:apps:file-transfer:4")); - factories_.push_back(boost::make_shared >("received", "urn:xmpp:jingle:apps:file-transfer:3")); factories_.push_back(boost::make_shared >("checksum")); factories_.push_back(boost::make_shared >("query", "http://jabber.org/protocol/bytestreams")); factories_.push_back(boost::make_shared >("wb", "http://swift.im/whiteboard")); diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.cpp b/Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.cpp deleted file mode 100644 index ae56981..0000000 --- a/Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2011 Tobias Markmann - * Licensed under the simplified BSD license. - * See Documentation/Licenses/BSD-simplified.txt for more information. - */ - -#include - -#include -#include -#include -#include -#include - -namespace Swift { - -JingleFileTransferReceivedParser::JingleFileTransferReceivedParser() : level(0) { -} - -void JingleFileTransferReceivedParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { - if (level == 1 && element == "file") { - PayloadParserFactory* payloadParserFactory = new GenericPayloadParserFactory("file", "http://jabber.org/protocol/si/profile/file-transfer"); - if (payloadParserFactory) { - currentPayloadParser.reset(payloadParserFactory->createPayloadParser()); - } - } - - if (currentPayloadParser && level >= 1) { - currentPayloadParser->handleStartElement(element, ns, attributes); - } - - ++level; -} - -void JingleFileTransferReceivedParser::handleEndElement(const std::string& element, const std::string& ) { - --level; - if (element == "file") { - boost::shared_ptr fileInfo = boost::dynamic_pointer_cast(currentPayloadParser->getPayload()); - if (fileInfo) { - getPayloadInternal()->setFileInfo(*fileInfo); - } - } -} - -void JingleFileTransferReceivedParser::handleCharacterData(const std::string& ) { - -} - -} diff --git a/Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.h b/Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.h deleted file mode 100644 index d5333ad..0000000 --- a/Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2011 Tobias Markmann - * Licensed under the simplified BSD license. - * See Documentation/Licenses/BSD-simplified.txt for more information. - */ - -#pragma once - -#include -#include - -namespace Swift { - -class JingleFileTransferReceivedParser : public GenericPayloadParser { -public: - JingleFileTransferReceivedParser(); - - virtual void handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes); - virtual void handleEndElement(const std::string& element, const std::string&); - virtual void handleCharacterData(const std::string& data); - -private: - boost::shared_ptr currentPayloadParser; - int level; -}; - -} - diff --git a/Swiften/Parser/PayloadParsers/JingleParser.cpp b/Swiften/Parser/PayloadParsers/JingleParser.cpp index dd34458..7041a92 100644 --- a/Swiften/Parser/PayloadParsers/JingleParser.cpp +++ b/Swiften/Parser/PayloadParsers/JingleParser.cpp @@ -4,10 +4,15 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2015 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include #include #include -#include #include #include @@ -60,11 +65,6 @@ namespace Swift { if (payload) { getPayloadInternal()->addContent(payload); } - - boost::shared_ptr received = boost::dynamic_pointer_cast(currentPayloadParser->getPayload()); - if (received) { - getPayloadInternal()->addPayload(received); - } boost::shared_ptr hash = boost::dynamic_pointer_cast(currentPayloadParser->getPayload()); if (hash) { diff --git a/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp index 9c166b2..05aaedf 100644 --- a/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp +++ b/Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/Swiften/Parser/SConscript b/Swiften/Parser/SConscript index 4bdf66f..050d293 100644 --- a/Swiften/Parser/SConscript +++ b/Swiften/Parser/SConscript @@ -36,7 +36,6 @@ sources = [ "PayloadParsers/JingleIBBTransportMethodPayloadParser.cpp", "PayloadParsers/JingleS5BTransportMethodPayloadParser.cpp", "PayloadParsers/JingleFileTransferDescriptionParser.cpp", - "PayloadParsers/JingleFileTransferReceivedParser.cpp", "PayloadParsers/JingleFileTransferHashParser.cpp", "PayloadParsers/JingleFileTransferFileInfoParser.cpp", "PayloadParsers/StreamInitiationFileInfoParser.cpp", diff --git a/Swiften/SConscript b/Swiften/SConscript index 147f7a6..685b3d5 100644 --- a/Swiften/SConscript +++ b/Swiften/SConscript @@ -220,7 +220,6 @@ if env["SCONS_STAGE"] == "build" : "Serializer/PayloadSerializers/JinglePayloadSerializer.cpp", "Serializer/PayloadSerializers/JingleContentPayloadSerializer.cpp", "Serializer/PayloadSerializers/JingleFileTransferHashSerializer.cpp", - "Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.cpp", "Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.cpp", "Serializer/PayloadSerializers/JingleS5BTransportPayloadSerializer.cpp", "Serializer/PayloadSerializers/StreamInitiationFileInfoSerializer.cpp", diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp index a9a1ae3..5da0829 100644 --- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp +++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -132,7 +131,6 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() { serializers_.push_back(new JingleContentPayloadSerializer()); serializers_.push_back(new JingleFileTransferDescriptionSerializer()); serializers_.push_back(new JingleFileTransferHashSerializer()); - serializers_.push_back(new JingleFileTransferReceivedSerializer()); serializers_.push_back(new JingleIBBTransportPayloadSerializer()); serializers_.push_back(new JingleS5BTransportPayloadSerializer()); serializers_.push_back(new JinglePayloadSerializer(this)); diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.cpp deleted file mode 100644 index 40be70e..0000000 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2011 Tobias Markmann - * Licensed under the simplified BSD license. - * See Documentation/Licenses/BSD-simplified.txt for more information. - */ - -#include - -#include -#include - -#include -#include -#include -#include - -#include - -namespace Swift { - -JingleFileTransferReceivedSerializer::JingleFileTransferReceivedSerializer() { -} - -std::string JingleFileTransferReceivedSerializer::serializePayload(boost::shared_ptr payload) const { - XMLElement receivedElement("received", "urn:xmpp:jingle:apps:file-transfer:3"); - XMLElement::ref fileElement = boost::make_shared("file", "http://jabber.org/protocol/si/profile/file-transfer"); - fileElement->setAttribute("hash", payload->getFileInfo().getHash()); - if (payload->getFileInfo().getAlgo() != "md5") { - fileElement->setAttribute("algo", payload->getFileInfo().getAlgo()); - } - receivedElement.addNode(fileElement); - return receivedElement.serialize(); -} - -} diff --git a/Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.h b/Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.h deleted file mode 100644 index 4151dd0..0000000 --- a/Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2011 Tobias Markmann - * Licensed under the simplified BSD license. - * See Documentation/Licenses/BSD-simplified.txt for more information. - */ - - -#pragma once - -#include -#include - -namespace Swift { - class PayloadSerializerCollection; - class XMLElement; - - class JingleFileTransferReceivedSerializer : public GenericPayloadSerializer { - public: - JingleFileTransferReceivedSerializer(); - - virtual std::string serializePayload(boost::shared_ptr) const; - }; -} diff --git a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp index 2e8ae4a..c6d6c12 100644 --- a/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2015 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include #include @@ -17,7 +23,6 @@ #include #include #include -#include #include @@ -26,7 +31,6 @@ #include #include #include -#include namespace Swift { diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp index 8d5bcb7..9d9996d 100644 --- a/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp +++ b/Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -45,7 +44,6 @@ class JingleSerializersTest : public CppUnit::TestFixture { CPPUNIT_TEST(testSerialize_Xep0234_Example3); CPPUNIT_TEST(testSerialize_Xep0234_Example5); CPPUNIT_TEST(testSerialize_Xep0234_Example8); - CPPUNIT_TEST(testSerialize_Xep0234_Example13); CPPUNIT_TEST(testSerialize_Xep0260_Example1); @@ -336,37 +334,6 @@ class JingleSerializersTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(expected, createTestling()->serialize(payload)); } - // http://xmpp.org/extensions/xep-0234.html#example-10 - void testSerialize_Xep0234_Example13() { - std::string expected = - "" - "" - "" - "" - ""; - - JinglePayload::ref payload = boost::make_shared(); - payload->setAction(JinglePayload::SessionInfo); - payload->setInitiator(JID("romeo@montague.lit/orchard")); - payload->setSessionID("a73sjjvkla37jfea"); - - JingleFileTransferReceived::ref received = boost::make_shared(); - - StreamInitiationFileInfo fileInfo; - fileInfo.setHash("a749930852c69ae5d2141d3766b1552d"); - - received->setFileInfo(fileInfo); - payload->addPayload(received); - - CPPUNIT_ASSERT_EQUAL(expected, createTestling()->serialize(payload)); - } - // http://xmpp.org/extensions/xep-0260.html#example-1 void testSerialize_Xep0260_Example1() { std::string expected = -- cgit v0.10.2-6-g49f6