diff options
Diffstat (limited to 'Swiften/Disco')
30 files changed, 143 insertions, 207 deletions
diff --git a/Swiften/Disco/CapsFileStorage.cpp b/Swiften/Disco/CapsFileStorage.cpp deleted file mode 100644 index 1e53854..0000000 --- a/Swiften/Disco/CapsFileStorage.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include "Swiften/Disco/CapsFileStorage.h" - -#include <iostream> -#include <boost/filesystem/fstream.hpp> - -#include "Swiften/Base/ByteArray.h" -#include "Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h" -#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadParserTester.h" -#include "Swiften/Parser/PayloadParsers/DiscoInfoParser.h" -#include "Swiften/StringCodecs/Hexify.h" -#include "Swiften/StringCodecs/Base64.h" - -namespace Swift { - -CapsFileStorage::CapsFileStorage(const boost::filesystem::path& path) : path(path) { -} - -DiscoInfo::ref CapsFileStorage::getDiscoInfo(const std::string& hash) const { - boost::filesystem::path capsPath(getCapsPath(hash)); - if (boost::filesystem::exists(capsPath)) { - ByteArray data; - data.readFromFile(capsPath.string()); - - DiscoInfoParser parser; - PayloadParserTester tester(&parser); - tester.parse(data.toString()); - return boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload()); - } - else { - return DiscoInfo::ref(); - } -} - -void CapsFileStorage::setDiscoInfo(const std::string& hash, DiscoInfo::ref discoInfo) { - boost::filesystem::path capsPath(getCapsPath(hash)); - if (!boost::filesystem::exists(capsPath.parent_path())) { - try { - boost::filesystem::create_directories(capsPath.parent_path()); - } - catch (const boost::filesystem::filesystem_error& e) { - std::cerr << "ERROR: " << e.what() << std::endl; - } - } - DiscoInfo::ref bareDiscoInfo(new DiscoInfo(*discoInfo.get())); - bareDiscoInfo->setNode(""); - boost::filesystem::ofstream file(capsPath); - file << DiscoInfoSerializer().serializePayload(bareDiscoInfo); - file.close(); -} - -boost::filesystem::path CapsFileStorage::getCapsPath(const std::string& hash) const { - return path / (Hexify::hexify(Base64::decode(hash)) + ".xml"); -} - -} diff --git a/Swiften/Disco/CapsFileStorage.h b/Swiften/Disco/CapsFileStorage.h deleted file mode 100644 index 5faf08b..0000000 --- a/Swiften/Disco/CapsFileStorage.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2010 Remko Tronçon - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include <boost/filesystem.hpp> - -#include "Swiften/Disco/CapsStorage.h" -#include <string> - -namespace Swift { - class CapsFileStorage : public CapsStorage { - public: - CapsFileStorage(const boost::filesystem::path& path); - - virtual DiscoInfo::ref getDiscoInfo(const std::string& hash) const; - virtual void setDiscoInfo(const std::string& hash, DiscoInfo::ref discoInfo); - - private: - boost::filesystem::path getCapsPath(const std::string& hash) const; - - private: - boost::filesystem::path path; - }; -} diff --git a/Swiften/Disco/CapsInfoGenerator.cpp b/Swiften/Disco/CapsInfoGenerator.cpp index 5c0e9a7..6d84984 100644 --- a/Swiften/Disco/CapsInfoGenerator.cpp +++ b/Swiften/Disco/CapsInfoGenerator.cpp @@ -4,15 +4,15 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Disco/CapsInfoGenerator.h" +#include <Swiften/Disco/CapsInfoGenerator.h> #include <algorithm> -#include "Swiften/Base/foreach.h" -#include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/Elements/FormField.h" -#include "Swiften/StringCodecs/SHA1.h" -#include "Swiften/StringCodecs/Base64.h" +#include <Swiften/Base/foreach.h> +#include <Swiften/Elements/DiscoInfo.h> +#include <Swiften/Elements/FormField.h> +#include <Swiften/StringCodecs/SHA1.h> +#include <Swiften/StringCodecs/Base64.h> namespace { bool compareFields(Swift::FormField::ref f1, Swift::FormField::ref f2) { @@ -57,7 +57,7 @@ CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const { } } - std::string version(Base64::encode(SHA1::getHash(serializedCaps))); + std::string version(Base64::encode(SHA1::getHash(createByteArray(serializedCaps)))); return CapsInfo(node_, version, "sha-1"); } diff --git a/Swiften/Disco/CapsInfoGenerator.h b/Swiften/Disco/CapsInfoGenerator.h index 41a1d94..d1b2663 100644 --- a/Swiften/Disco/CapsInfoGenerator.h +++ b/Swiften/Disco/CapsInfoGenerator.h @@ -7,7 +7,7 @@ #pragma once #include <string> -#include "Swiften/Elements/CapsInfo.h" +#include <Swiften/Elements/CapsInfo.h> namespace Swift { class DiscoInfo; diff --git a/Swiften/Disco/CapsManager.cpp b/Swiften/Disco/CapsManager.cpp index b08a895..66eb47e 100644 --- a/Swiften/Disco/CapsManager.cpp +++ b/Swiften/Disco/CapsManager.cpp @@ -4,15 +4,16 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Disco/CapsManager.h" +#include <Swiften/Disco/CapsManager.h> #include <boost/bind.hpp> +#include <iostream> -#include "Swiften/Client/StanzaChannel.h" -#include "Swiften/Disco/CapsStorage.h" -#include "Swiften/Disco/CapsInfoGenerator.h" -#include "Swiften/Elements/CapsInfo.h" -#include "Swiften/Disco/GetDiscoInfoRequest.h" +#include <Swiften/Client/StanzaChannel.h> +#include <Swiften/Disco/CapsStorage.h> +#include <Swiften/Disco/CapsInfoGenerator.h> +#include <Swiften/Elements/CapsInfo.h> +#include <Swiften/Disco/GetDiscoInfoRequest.h> namespace Swift { diff --git a/Swiften/Disco/CapsManager.h b/Swiften/Disco/CapsManager.h index 961dae8..ddc7997 100644 --- a/Swiften/Disco/CapsManager.h +++ b/Swiften/Disco/CapsManager.h @@ -9,12 +9,12 @@ #include <set> #include <map> -#include "Swiften/Base/boost_bsignals.h" -#include "Swiften/Elements/Presence.h" -#include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/Elements/CapsInfo.h" -#include "Swiften/Elements/ErrorPayload.h" -#include "Swiften/Disco/CapsProvider.h" +#include <Swiften/Base/boost_bsignals.h> +#include <Swiften/Elements/Presence.h> +#include <Swiften/Elements/DiscoInfo.h> +#include <Swiften/Elements/CapsInfo.h> +#include <Swiften/Elements/ErrorPayload.h> +#include <Swiften/Disco/CapsProvider.h> namespace Swift { class StanzaChannel; diff --git a/Swiften/Disco/CapsMemoryStorage.h b/Swiften/Disco/CapsMemoryStorage.h index 1e2d7be..2503d7d 100644 --- a/Swiften/Disco/CapsMemoryStorage.h +++ b/Swiften/Disco/CapsMemoryStorage.h @@ -10,7 +10,7 @@ #include <map> #include <string> -#include "Swiften/Disco/CapsStorage.h" +#include <Swiften/Disco/CapsStorage.h> namespace Swift { class CapsMemoryStorage : public CapsStorage { diff --git a/Swiften/Disco/CapsProvider.h b/Swiften/Disco/CapsProvider.h index 71e2741..8bb3767 100644 --- a/Swiften/Disco/CapsProvider.h +++ b/Swiften/Disco/CapsProvider.h @@ -6,9 +6,9 @@ #pragma once -#include "Swiften/Base/boost_bsignals.h" -#include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/Elements/CapsInfo.h" +#include <Swiften/Base/boost_bsignals.h> +#include <Swiften/Elements/DiscoInfo.h> +#include <Swiften/Elements/CapsInfo.h> namespace Swift { diff --git a/Swiften/Disco/CapsStorage.cpp b/Swiften/Disco/CapsStorage.cpp index acb58fe..fe4a6ac 100644 --- a/Swiften/Disco/CapsStorage.cpp +++ b/Swiften/Disco/CapsStorage.cpp @@ -4,7 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Disco/CapsStorage.h" +#include <Swiften/Disco/CapsStorage.h> namespace Swift { diff --git a/Swiften/Disco/CapsStorage.h b/Swiften/Disco/CapsStorage.h index f0a71a3..fb6e442 100644 --- a/Swiften/Disco/CapsStorage.h +++ b/Swiften/Disco/CapsStorage.h @@ -8,7 +8,7 @@ #include <boost/shared_ptr.hpp> -#include "Swiften/Elements/DiscoInfo.h" +#include <Swiften/Elements/DiscoInfo.h> namespace Swift { diff --git a/Swiften/Disco/ClientDiscoManager.cpp b/Swiften/Disco/ClientDiscoManager.cpp index fb7cce9..99c0175 100644 --- a/Swiften/Disco/ClientDiscoManager.cpp +++ b/Swiften/Disco/ClientDiscoManager.cpp @@ -4,11 +4,11 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Disco/ClientDiscoManager.h" +#include <Swiften/Disco/ClientDiscoManager.h> -#include "Swiften/Disco/DiscoInfoResponder.h" -#include "Swiften/Disco/CapsInfoGenerator.h" -#include "Swiften/Presence/PayloadAddingPresenceSender.h" +#include <Swiften/Disco/DiscoInfoResponder.h> +#include <Swiften/Disco/CapsInfoGenerator.h> +#include <Swiften/Presence/PayloadAddingPresenceSender.h> namespace Swift { diff --git a/Swiften/Disco/ClientDiscoManager.h b/Swiften/Disco/ClientDiscoManager.h index 3771044..f8ba9ac 100644 --- a/Swiften/Disco/ClientDiscoManager.h +++ b/Swiften/Disco/ClientDiscoManager.h @@ -6,9 +6,9 @@ #pragma once -#include "Swiften/Elements/CapsInfo.h" -#include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/Presence/PayloadAddingPresenceSender.h" +#include <Swiften/Elements/CapsInfo.h> +#include <Swiften/Elements/DiscoInfo.h> +#include <Swiften/Presence/PayloadAddingPresenceSender.h> namespace Swift { class IQRouter; diff --git a/Swiften/Disco/DiscoInfoResponder.cpp b/Swiften/Disco/DiscoInfoResponder.cpp index 7ba044e..a8dd9f0 100644 --- a/Swiften/Disco/DiscoInfoResponder.cpp +++ b/Swiften/Disco/DiscoInfoResponder.cpp @@ -4,9 +4,9 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Disco/DiscoInfoResponder.h" -#include "Swiften/Queries/IQRouter.h" -#include "Swiften/Elements/DiscoInfo.h" +#include <Swiften/Disco/DiscoInfoResponder.h> +#include <Swiften/Queries/IQRouter.h> +#include <Swiften/Elements/DiscoInfo.h> namespace Swift { diff --git a/Swiften/Disco/DiscoInfoResponder.h b/Swiften/Disco/DiscoInfoResponder.h index f114a21..af9f48f 100644 --- a/Swiften/Disco/DiscoInfoResponder.h +++ b/Swiften/Disco/DiscoInfoResponder.h @@ -8,8 +8,8 @@ #include <map> -#include "Swiften/Queries/GetResponder.h" -#include "Swiften/Elements/DiscoInfo.h" +#include <Swiften/Queries/GetResponder.h> +#include <Swiften/Elements/DiscoInfo.h> namespace Swift { class IQRouter; diff --git a/Swiften/Disco/DummyEntityCapsProvider.cpp b/Swiften/Disco/DummyEntityCapsProvider.cpp new file mode 100644 index 0000000..a906652 --- /dev/null +++ b/Swiften/Disco/DummyEntityCapsProvider.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Disco/DummyEntityCapsProvider.h> + +#include <iostream> + +namespace Swift { + +DiscoInfo::ref DummyEntityCapsProvider::getCaps(const JID& jid) const { + std::map<JID, DiscoInfo::ref>::const_iterator i = caps.find(jid); + if (i != caps.end()) { + return i->second; + } + return DiscoInfo::ref(); +} + +} diff --git a/Swiften/Disco/DummyEntityCapsProvider.h b/Swiften/Disco/DummyEntityCapsProvider.h index 68cef2f..a1e3db6 100644 --- a/Swiften/Disco/DummyEntityCapsProvider.h +++ b/Swiften/Disco/DummyEntityCapsProvider.h @@ -7,8 +7,8 @@ #pragma once #include <map> -#include <iostream> -#include "Swiften/Disco/EntityCapsProvider.h" + +#include <Swiften/Disco/EntityCapsProvider.h> namespace Swift { class DummyEntityCapsProvider : public EntityCapsProvider { @@ -16,13 +16,7 @@ namespace Swift { DummyEntityCapsProvider() { } - DiscoInfo::ref getCaps(const JID& jid) const { - std::map<JID, DiscoInfo::ref>::const_iterator i = caps.find(jid); - if (i != caps.end()) { - return i->second; - } - return DiscoInfo::ref(); - } + DiscoInfo::ref getCaps(const JID& jid) const; std::map<JID, DiscoInfo::ref> caps; }; diff --git a/Swiften/Disco/EntityCapsManager.cpp b/Swiften/Disco/EntityCapsManager.cpp index 3f2e3d7..1a9f5fb 100644 --- a/Swiften/Disco/EntityCapsManager.cpp +++ b/Swiften/Disco/EntityCapsManager.cpp @@ -4,12 +4,12 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Disco/EntityCapsManager.h" +#include <Swiften/Disco/EntityCapsManager.h> #include <boost/bind.hpp> -#include "Swiften/Disco/CapsProvider.h" -#include "Swiften/Client/StanzaChannel.h" +#include <Swiften/Disco/CapsProvider.h> +#include <Swiften/Client/StanzaChannel.h> namespace Swift { diff --git a/Swiften/Disco/EntityCapsManager.h b/Swiften/Disco/EntityCapsManager.h index 190f876..e41c15f 100644 --- a/Swiften/Disco/EntityCapsManager.h +++ b/Swiften/Disco/EntityCapsManager.h @@ -8,11 +8,11 @@ #include <map> -#include "Swiften/Base/boost_bsignals.h" -#include "Swiften/Elements/Presence.h" -#include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/Elements/ErrorPayload.h" -#include "Swiften/Disco/EntityCapsProvider.h" +#include <Swiften/Base/boost_bsignals.h> +#include <Swiften/Elements/Presence.h> +#include <Swiften/Elements/DiscoInfo.h> +#include <Swiften/Elements/ErrorPayload.h> +#include <Swiften/Disco/EntityCapsProvider.h> namespace Swift { class StanzaChannel; diff --git a/Swiften/Disco/EntityCapsProvider.cpp b/Swiften/Disco/EntityCapsProvider.cpp index a337328..e3262b6 100644 --- a/Swiften/Disco/EntityCapsProvider.cpp +++ b/Swiften/Disco/EntityCapsProvider.cpp @@ -4,7 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Disco/EntityCapsProvider.h" +#include <Swiften/Disco/EntityCapsProvider.h> namespace Swift { diff --git a/Swiften/Disco/EntityCapsProvider.h b/Swiften/Disco/EntityCapsProvider.h index 07fa452..b38992c 100644 --- a/Swiften/Disco/EntityCapsProvider.h +++ b/Swiften/Disco/EntityCapsProvider.h @@ -6,9 +6,9 @@ #pragma once -#include "Swiften/Base/boost_bsignals.h" -#include "Swiften/JID/JID.h" -#include "Swiften/Elements/DiscoInfo.h" +#include <Swiften/Base/boost_bsignals.h> +#include <Swiften/JID/JID.h> +#include <Swiften/Elements/DiscoInfo.h> namespace Swift { /** diff --git a/Swiften/Disco/GetDiscoInfoRequest.h b/Swiften/Disco/GetDiscoInfoRequest.h index 5cec530..e211632 100644 --- a/Swiften/Disco/GetDiscoInfoRequest.h +++ b/Swiften/Disco/GetDiscoInfoRequest.h @@ -6,8 +6,8 @@ #pragma once -#include "Swiften/Queries/GenericRequest.h" -#include "Swiften/Elements/DiscoInfo.h" +#include <Swiften/Queries/GenericRequest.h> +#include <Swiften/Elements/DiscoInfo.h> namespace Swift { class GetDiscoInfoRequest : public GenericRequest<DiscoInfo> { diff --git a/Swiften/Disco/GetDiscoItemsRequest.h b/Swiften/Disco/GetDiscoItemsRequest.h index 0a94402..20d18f8 100644 --- a/Swiften/Disco/GetDiscoItemsRequest.h +++ b/Swiften/Disco/GetDiscoItemsRequest.h @@ -6,8 +6,8 @@ #pragma once -#include "Swiften/Queries/GenericRequest.h" -#include "Swiften/Elements/DiscoItems.h" +#include <Swiften/Queries/GenericRequest.h> +#include <Swiften/Elements/DiscoItems.h> namespace Swift { class GetDiscoItemsRequest : public GenericRequest<DiscoItems> { @@ -18,9 +18,18 @@ namespace Swift { return ref(new GetDiscoItemsRequest(jid, router)); } + static ref create(const JID& jid, const std::string& node, IQRouter* router) { + return ref(new GetDiscoItemsRequest(jid, node, router)); + } + private: GetDiscoItemsRequest(const JID& jid, IQRouter* router) : GenericRequest<DiscoItems>(IQ::Get, jid, boost::shared_ptr<DiscoItems>(new DiscoItems()), router) { } + + GetDiscoItemsRequest(const JID& jid, const std::string& node, IQRouter* router) : + GenericRequest<DiscoItems>(IQ::Get, jid, boost::shared_ptr<DiscoItems>(new DiscoItems()), router) { + getPayloadGeneric()->setNode(node); + } }; } diff --git a/Swiften/Disco/JIDDiscoInfoResponder.cpp b/Swiften/Disco/JIDDiscoInfoResponder.cpp index 1298e5a..0a25bef 100644 --- a/Swiften/Disco/JIDDiscoInfoResponder.cpp +++ b/Swiften/Disco/JIDDiscoInfoResponder.cpp @@ -4,9 +4,9 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#include "Swiften/Disco/JIDDiscoInfoResponder.h" -#include "Swiften/Queries/IQRouter.h" -#include "Swiften/Elements/DiscoInfo.h" +#include <Swiften/Disco/JIDDiscoInfoResponder.h> +#include <Swiften/Queries/IQRouter.h> +#include <Swiften/Elements/DiscoInfo.h> namespace Swift { diff --git a/Swiften/Disco/JIDDiscoInfoResponder.h b/Swiften/Disco/JIDDiscoInfoResponder.h index d532d0f..ebc1452 100644 --- a/Swiften/Disco/JIDDiscoInfoResponder.h +++ b/Swiften/Disco/JIDDiscoInfoResponder.h @@ -8,9 +8,9 @@ #include <map> -#include "Swiften/Queries/GetResponder.h" -#include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/JID/JID.h" +#include <Swiften/Queries/GetResponder.h> +#include <Swiften/Elements/DiscoInfo.h> +#include <Swiften/JID/JID.h> namespace Swift { class IQRouter; diff --git a/Swiften/Disco/SConscript b/Swiften/Disco/SConscript index 9982192..434018a 100644 --- a/Swiften/Disco/SConscript +++ b/Swiften/Disco/SConscript @@ -5,8 +5,8 @@ objects = swiften_env.SwiftenObject([ "CapsManager.cpp", "EntityCapsManager.cpp", "EntityCapsProvider.cpp", + "DummyEntityCapsProvider.cpp", "CapsStorage.cpp", - "CapsFileStorage.cpp", "ClientDiscoManager.cpp", "DiscoInfoResponder.cpp", "JIDDiscoInfoResponder.cpp", diff --git a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp index d4cb331..52fdbaa 100644 --- a/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp +++ b/Swiften/Disco/UnitTest/CapsInfoGeneratorTest.cpp @@ -7,8 +7,8 @@ #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/Disco/CapsInfoGenerator.h" +#include <Swiften/Elements/DiscoInfo.h> +#include <Swiften/Disco/CapsInfoGenerator.h> using namespace Swift; diff --git a/Swiften/Disco/UnitTest/CapsManagerTest.cpp b/Swiften/Disco/UnitTest/CapsManagerTest.cpp index 793fdba..0681569 100644 --- a/Swiften/Disco/UnitTest/CapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/CapsManagerTest.cpp @@ -9,13 +9,13 @@ #include <vector> #include <boost/bind.hpp> -#include "Swiften/Disco/CapsManager.h" -#include "Swiften/Disco/CapsMemoryStorage.h" -#include "Swiften/Disco/CapsInfoGenerator.h" -#include "Swiften/Queries/IQRouter.h" -#include "Swiften/Elements/CapsInfo.h" -#include "Swiften/Elements/DiscoInfo.h" -#include "Swiften/Client/DummyStanzaChannel.h" +#include <Swiften/Disco/CapsManager.h> +#include <Swiften/Disco/CapsMemoryStorage.h> +#include <Swiften/Disco/CapsInfoGenerator.h> +#include <Swiften/Queries/IQRouter.h> +#include <Swiften/Elements/CapsInfo.h> +#include <Swiften/Elements/DiscoInfo.h> +#include <Swiften/Client/DummyStanzaChannel.h> using namespace Swift; @@ -64,7 +64,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveNewHashRequestsDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); CPPUNIT_ASSERT(stanzaChannel->isRequestAtIndex<DiscoInfo>(0, user1, IQ::Get)); @@ -74,7 +74,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashDoesNotRequestDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->sentStanzas.clear(); sendPresenceWithCaps(user1, capsInfo1); @@ -83,14 +83,14 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveLegacyCapsDoesNotRequestDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, legacyCapsInfo); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(stanzaChannel->sentStanzas.size())); } void testReceiveSameHashAfterSuccesfulDiscoDoesNotRequestDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo1); @@ -101,7 +101,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromSameUserAfterFailedDiscoDoesNotRequestDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getID())); @@ -112,7 +112,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromSameUserAfterIncorrectVerificationDoesNotRequestDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo2); @@ -123,7 +123,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromDifferentUserAfterFailedDiscoRequestsDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID())); @@ -133,7 +133,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromDifferentUserAfterIncorrectVerificationRequestsDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo2); @@ -143,7 +143,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveDifferentHashFromSameUserAfterFailedDiscoDoesNotRequestDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getID())); @@ -154,7 +154,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSuccesfulDiscoStoresCaps() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo1); @@ -164,7 +164,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveIncorrectVerificationDiscoDoesNotStoreCaps() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendDiscoInfoResult(discoInfo2); @@ -173,7 +173,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveFailingDiscoFallsBack() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendPresenceWithCaps(user2, capsInfo1alt); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID())); @@ -185,7 +185,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveNoDiscoFallsBack() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendPresenceWithCaps(user2, capsInfo1alt); stanzaChannel->onIQReceived(IQ::createResult(JID("baz@fum.com/dum"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID(), boost::shared_ptr<DiscoInfo>())); @@ -197,7 +197,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveFailingFallbackDiscoFallsBack() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendPresenceWithCaps(user2, capsInfo1alt); sendPresenceWithCaps(user3, capsInfo1); @@ -208,7 +208,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReceiveSameHashFromFailingUserAfterReconnectRequestsDisco() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->onIQReceived(IQ::createError(JID("baz@fum.com/foo"), stanzaChannel->sentStanzas[0]->getTo(), stanzaChannel->sentStanzas[0]->getID())); stanzaChannel->setAvailable(false); @@ -221,7 +221,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReconnectResetsFallback() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); sendPresenceWithCaps(user2, capsInfo1alt); stanzaChannel->setAvailable(false); @@ -234,7 +234,7 @@ class CapsManagerTest : public CppUnit::TestFixture { } void testReconnectResetsRequests() { - std::auto_ptr<CapsManager> testling = createManager(); + boost::shared_ptr<CapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); stanzaChannel->sentStanzas.clear(); stanzaChannel->setAvailable(false); @@ -245,8 +245,8 @@ class CapsManagerTest : public CppUnit::TestFixture { } private: - std::auto_ptr<CapsManager> createManager() { - std::auto_ptr<CapsManager> manager(new CapsManager(storage, stanzaChannel, iqRouter)); + boost::shared_ptr<CapsManager> createManager() { + boost::shared_ptr<CapsManager> manager(new CapsManager(storage, stanzaChannel, iqRouter)); manager->setWarnOnInvalidHash(false); //manager->onCapsChanged.connect(boost::bind(&CapsManagerTest::handleCapsChanged, this, _1)); return manager; diff --git a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp index bccf0d4..1477e23 100644 --- a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp +++ b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp @@ -8,9 +8,9 @@ #include <cppunit/extensions/TestFactoryRegistry.h> #include <typeinfo> -#include "Swiften/Disco/DiscoInfoResponder.h" -#include "Swiften/Queries/IQRouter.h" -#include "Swiften/Queries/DummyIQChannel.h" +#include <Swiften/Disco/DiscoInfoResponder.h> +#include <Swiften/Queries/IQRouter.h> +#include <Swiften/Queries/DummyIQChannel.h> using namespace Swift; diff --git a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp index 544bdad..7b61cb5 100644 --- a/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp +++ b/Swiften/Disco/UnitTest/EntityCapsManagerTest.cpp @@ -9,11 +9,11 @@ #include <vector> #include <boost/bind.hpp> -#include "Swiften/Disco/EntityCapsManager.h" -#include "Swiften/Disco/CapsProvider.h" -#include "Swiften/Elements/CapsInfo.h" -#include "Swiften/Client/DummyStanzaChannel.h" -#include "Swiften/Disco/CapsInfoGenerator.h" +#include <Swiften/Disco/EntityCapsManager.h> +#include <Swiften/Disco/CapsProvider.h> +#include <Swiften/Elements/CapsInfo.h> +#include <Swiften/Client/DummyStanzaChannel.h> +#include <Swiften/Disco/CapsInfoGenerator.h> using namespace Swift; @@ -52,7 +52,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveKnownHash() { - std::auto_ptr<EntityCapsManager> testling = createManager(); + boost::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; sendPresenceWithCaps(user1, capsInfo1); @@ -62,7 +62,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveKnownHashTwiceDoesNotTriggerChange() { - std::auto_ptr<EntityCapsManager> testling = createManager(); + boost::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; sendPresenceWithCaps(user1, capsInfo1); changes.clear(); @@ -73,14 +73,14 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveUnknownHashDoesNotTriggerChange() { - std::auto_ptr<EntityCapsManager> testling = createManager(); + boost::shared_ptr<EntityCapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(changes.size())); } void testHashAvailable() { - std::auto_ptr<EntityCapsManager> testling = createManager(); + boost::shared_ptr<EntityCapsManager> testling = createManager(); sendPresenceWithCaps(user1, capsInfo1); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; @@ -92,7 +92,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveUnknownHashAfterKnownHashTriggersChangeAndClearsCaps() { - std::auto_ptr<EntityCapsManager> testling = createManager(); + boost::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; sendPresenceWithCaps(user1, capsInfo1); changes.clear(); @@ -104,7 +104,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReceiveUnavailablePresenceAfterKnownHashTriggersChangeAndClearsCaps() { - std::auto_ptr<EntityCapsManager> testling = createManager(); + boost::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; sendPresenceWithCaps(user1, capsInfo1); changes.clear(); @@ -116,7 +116,7 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } void testReconnectTriggersChangeAndClearsCaps() { - std::auto_ptr<EntityCapsManager> testling = createManager(); + boost::shared_ptr<EntityCapsManager> testling = createManager(); capsProvider->caps[capsInfo1->getVersion()] = discoInfo1; capsProvider->caps[capsInfo2->getVersion()] = discoInfo2; sendPresenceWithCaps(user1, capsInfo1); @@ -133,8 +133,8 @@ class EntityCapsManagerTest : public CppUnit::TestFixture { } private: - std::auto_ptr<EntityCapsManager> createManager() { - std::auto_ptr<EntityCapsManager> manager(new EntityCapsManager(capsProvider, stanzaChannel)); + boost::shared_ptr<EntityCapsManager> createManager() { + boost::shared_ptr<EntityCapsManager> manager(new EntityCapsManager(capsProvider, stanzaChannel)); manager->onCapsChanged.connect(boost::bind(&EntityCapsManagerTest::handleCapsChanged, this, _1)); return manager; } diff --git a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp index ef61afa..7e2e3dd 100644 --- a/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp +++ b/Swiften/Disco/UnitTest/JIDDiscoInfoResponderTest.cpp @@ -8,9 +8,9 @@ #include <cppunit/extensions/TestFactoryRegistry.h> #include <typeinfo> -#include "Swiften/Disco/JIDDiscoInfoResponder.h" -#include "Swiften/Queries/IQRouter.h" -#include "Swiften/Queries/DummyIQChannel.h" +#include <Swiften/Disco/JIDDiscoInfoResponder.h> +#include <Swiften/Queries/IQRouter.h> +#include <Swiften/Queries/DummyIQChannel.h> using namespace Swift; |