summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-02-04 13:56:42 (GMT)
committerSwift Review <review@swift.im>2015-02-09 14:09:18 (GMT)
commitef319397be8439482fdf95f46a29643d15980b37 (patch)
tree01b1b70cedccbbc7f5dde7d72939c3cfeeee1784
parent7d3df55bf5fd93b3eaca36cc43cb22ea7879bf7e (diff)
downloadswift-ef319397be8439482fdf95f46a29643d15980b37.zip
swift-ef319397be8439482fdf95f46a29643d15980b37.tar.bz2
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
-rw-r--r--Swiften/Elements/DiscoInfo.cpp4
-rw-r--r--Swiften/Elements/JingleFileTransferReceived.h33
-rw-r--r--Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.cpp49
-rw-r--r--Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.h28
-rw-r--r--Swiften/Parser/PayloadParsers/JingleParser.cpp12
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/JingleParserTest.cpp1
-rw-r--r--Swiften/Parser/SConscript1
-rw-r--r--Swiften/SConscript1
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.cpp35
-rw-r--r--Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.h23
-rw-r--r--Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.cpp8
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/JingleSerializersTest.cpp33
14 files changed, 16 insertions, 220 deletions
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 <boost/shared_ptr.hpp>
-#include <vector>
-
-#include <Swiften/Elements/StreamInitiationFileInfo.h>
-#include <Swiften/Elements/Payload.h>
-
-namespace Swift {
-
-class JingleFileTransferReceived : public Payload {
- public:
- typedef boost::shared_ptr<JingleFileTransferReceived> 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 <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>
@@ -142,7 +141,6 @@ FullPayloadParserFactoryCollection::FullPayloadParserFactoryCollection() {
factories_.push_back(boost::make_shared<JingleFileTransferDescriptionParserFactory>(this));
factories_.push_back(boost::make_shared<GenericPayloadParserFactory<StreamInitiationFileInfoParser> >("file", "http://jabber.org/protocol/si/profile/file-transfer"));
factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleFileTransferFileInfoParser> >("file", "urn:xmpp:jingle:apps:file-transfer:4"));
- factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleFileTransferReceivedParser> >("received", "urn:xmpp:jingle:apps:file-transfer:3"));
factories_.push_back(boost::make_shared<GenericPayloadParserFactory<JingleFileTransferHashParser> >("checksum"));
factories_.push_back(boost::make_shared<GenericPayloadParserFactory<S5BProxyRequestParser> >("query", "http://jabber.org/protocol/bytestreams"));
factories_.push_back(boost::make_shared<GenericPayloadParserFactory<WhiteboardParser> >("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 <Swiften/Parser/PayloadParsers/JingleFileTransferReceivedParser.h>
-
-#include <boost/shared_ptr.hpp>
-#include <Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.h>
-#include <Swiften/Parser/PayloadParsers/StreamInitiationFileInfoParser.h>
-#include <Swiften/Parser/GenericPayloadParserFactory.h>
-#include <Swiften/Parser/PayloadParserFactory.h>
-
-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<StreamInitiationFileInfoParser>("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<StreamInitiationFileInfo> fileInfo = boost::dynamic_pointer_cast<StreamInitiationFileInfo>(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 <Swiften/Elements/JingleFileTransferReceived.h>
-#include <Swiften/Parser/GenericPayloadParser.h>
-
-namespace Swift {
-
-class JingleFileTransferReceivedParser : public GenericPayloadParser<JingleFileTransferReceived> {
-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<PayloadParser> 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 <Swiften/Parser/PayloadParsers/JingleParser.h>
#include <Swiften/Parser/PayloadParserFactory.h>
#include <Swiften/Elements/JingleContentPayload.h>
-#include <Swiften/Elements/JingleFileTransferReceived.h>
#include <Swiften/Elements/JingleFileTransferHash.h>
#include <Swiften/Base/Log.h>
@@ -60,11 +65,6 @@ namespace Swift {
if (payload) {
getPayloadInternal()->addContent(payload);
}
-
- boost::shared_ptr<JingleFileTransferReceived> received = boost::dynamic_pointer_cast<JingleFileTransferReceived>(currentPayloadParser->getPayload());
- if (received) {
- getPayloadInternal()->addPayload(received);
- }
boost::shared_ptr<JingleFileTransferHash> hash = boost::dynamic_pointer_cast<JingleFileTransferHash>(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 <Swiften/Elements/JingleS5BTransportPayload.h>
#include <Swiften/Elements/JingleFileTransferDescription.h>
#include <Swiften/Elements/StreamInitiationFileInfo.h>
-#include <Swiften/Elements/JingleFileTransferReceived.h>
#include <Swiften/Elements/JingleFileTransferHash.h>
#include <Swiften/Base/DateTime.h>
#include <Swiften/StringCodecs/Base64.h>
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 <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/JingleFileTransferFileInfoSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleIBBTransportPayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h>
@@ -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 <Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.h>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
-
-#include <Swiften/Base/foreach.h>
-#include <Swiften/Serializer/XML/XMLNode.h>
-#include <Swiften/Serializer/XML/XMLElement.h>
-#include <Swiften/Serializer/XML/XMLRawTextNode.h>
-
-#include <Swiften/Serializer/XML/XMLRawTextNode.h>
-
-namespace Swift {
-
-JingleFileTransferReceivedSerializer::JingleFileTransferReceivedSerializer() {
-}
-
-std::string JingleFileTransferReceivedSerializer::serializePayload(boost::shared_ptr<JingleFileTransferReceived> payload) const {
- XMLElement receivedElement("received", "urn:xmpp:jingle:apps:file-transfer:3");
- XMLElement::ref fileElement = boost::make_shared<XMLElement>("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 <Swiften/Serializer/GenericPayloadSerializer.h>
-#include <Swiften/Elements/JingleFileTransferReceived.h>
-
-namespace Swift {
- class PayloadSerializerCollection;
- class XMLElement;
-
- class JingleFileTransferReceivedSerializer : public GenericPayloadSerializer<JingleFileTransferReceived> {
- public:
- JingleFileTransferReceivedSerializer();
-
- virtual std::string serializePayload(boost::shared_ptr<JingleFileTransferReceived>) 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 <Swiften/Serializer/PayloadSerializers/JinglePayloadSerializer.h>
#include <boost/shared_ptr.hpp>
@@ -17,7 +23,6 @@
#include <Swiften/Serializer/XML/XMLRawTextNode.h>
#include <Swiften/Serializer/PayloadSerializers/JingleContentPayloadSerializer.h>
#include <Swiften/Serializer/PayloadSerializers/JingleFileTransferHashSerializer.h>
-#include <Swiften/Serializer/PayloadSerializers/JingleFileTransferReceivedSerializer.h>
#include <Swiften/Serializer/PayloadSerializerCollection.h>
@@ -26,7 +31,6 @@
#include <Swiften/Elements/JingleIBBTransportPayload.h>
#include <Swiften/Elements/JingleFileTransferDescription.h>
#include <Swiften/Elements/JingleFileTransferHash.h>
-#include <Swiften/Elements/JingleFileTransferReceived.h>
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 <Swiften/Elements/JingleS5BTransportPayload.h>
#include <Swiften/Elements/JingleFileTransferHash.h>
#include <Swiften/Elements/JinglePayload.h>
-#include <Swiften/Elements/JingleFileTransferReceived.h>
#include <Swiften/Base/DateTime.h>
#include <Swiften/StringCodecs/Base64.h>
@@ -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 =
- "<jingle"
- " action=\"session-info\""
- " initiator=\"romeo@montague.lit/orchard\""
- " sid=\"a73sjjvkla37jfea\""
- " xmlns=\"urn:xmpp:jingle:1\">"
- "<received xmlns=\"urn:xmpp:jingle:apps:file-transfer:3\">"
- "<file"
- " hash=\"a749930852c69ae5d2141d3766b1552d\""
- " xmlns=\"http://jabber.org/protocol/si/profile/file-transfer\"/>"
- "</received>"
- "</jingle>";
-
- JinglePayload::ref payload = boost::make_shared<JinglePayload>();
- payload->setAction(JinglePayload::SessionInfo);
- payload->setInitiator(JID("romeo@montague.lit/orchard"));
- payload->setSessionID("a73sjjvkla37jfea");
-
- JingleFileTransferReceived::ref received = boost::make_shared<JingleFileTransferReceived>();
-
- 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 =