diff options
Diffstat (limited to 'Swiften/Avatars')
-rw-r--r-- | Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp | 50 | ||||
-rw-r--r-- | Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp | 46 | ||||
-rw-r--r-- | Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp | 20 | ||||
-rw-r--r-- | Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp | 28 | ||||
-rw-r--r-- | Swiften/Avatars/VCardUpdateAvatarManager.cpp | 4 | ||||
-rw-r--r-- | Swiften/Avatars/VCardUpdateAvatarManager.h | 5 |
6 files changed, 76 insertions, 77 deletions
diff --git a/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp b/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp index 79769a8..241f375 100644 --- a/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp +++ b/Swiften/Avatars/UnitTest/AvatarManagerImplTest.cpp @@ -38,14 +38,14 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { public: void setUp() { ownerJID = JID("owner@domain.com/theowner"); - stanzaChannel = boost::make_shared<DummyStanzaChannel>(); - iqRouter = boost::make_shared<IQRouter>(stanzaChannel.get()); - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); - vcardStorage = boost::make_shared<VCardMemoryStorage>(crypto.get()); - vcardManager = boost::make_shared<VCardManager>(ownerJID, iqRouter.get(), vcardStorage.get()); - avatarStorage = boost::make_shared<AvatarMemoryStorage>(); - mucRegistry = boost::make_shared<DummyMUCRegistry>(); - avatarManager = boost::make_shared<AvatarManagerImpl>(vcardManager.get(), stanzaChannel.get(), avatarStorage.get(), crypto.get(), mucRegistry.get()); + stanzaChannel = std::make_shared<DummyStanzaChannel>(); + iqRouter = std::make_shared<IQRouter>(stanzaChannel.get()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + vcardStorage = std::make_shared<VCardMemoryStorage>(crypto.get()); + vcardManager = std::make_shared<VCardManager>(ownerJID, iqRouter.get(), vcardStorage.get()); + avatarStorage = std::make_shared<AvatarMemoryStorage>(); + mucRegistry = std::make_shared<DummyMUCRegistry>(); + avatarManager = std::make_shared<AvatarManagerImpl>(vcardManager.get(), stanzaChannel.get(), avatarStorage.get(), crypto.get(), mucRegistry.get()); } void testGetSetAvatar() { @@ -57,9 +57,9 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { /* notify the 'owner' JID that our avatar has changed */ ByteArray fullAvatar = createByteArray("abcdefg"); - boost::shared_ptr<VCardUpdate> vcardUpdate = boost::make_shared<VCardUpdate>(); + std::shared_ptr<VCardUpdate> vcardUpdate = std::make_shared<VCardUpdate>(); vcardUpdate->setPhotoHash(Hexify::hexify(crypto->getSHA1Hash(fullAvatar))); - boost::shared_ptr<Presence> presence = boost::make_shared<Presence>(); + std::shared_ptr<Presence> presence = std::make_shared<Presence>(); presence->setTo(ownerJID); presence->setFrom(personJID); presence->setType(Presence::Available); @@ -69,13 +69,13 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { /* reply to the avatar request with our new avatar */ CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size()); - boost::shared_ptr<IQ> request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]); + std::shared_ptr<IQ> request = std::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]); stanzaChannel->sentStanzas.pop_back(); CPPUNIT_ASSERT(!!request); - boost::shared_ptr<VCard> vcard = request->getPayload<VCard>(); + std::shared_ptr<VCard> vcard = request->getPayload<VCard>(); CPPUNIT_ASSERT(!!vcard); - boost::shared_ptr<IQ> reply = boost::make_shared<IQ>(IQ::Result); + std::shared_ptr<IQ> reply = std::make_shared<IQ>(IQ::Result); reply->setTo(request->getFrom()); reply->setFrom(request->getTo()); reply->setID(request->getID()); @@ -90,8 +90,8 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { /* send new presence to notify of blank avatar */ - vcardUpdate = boost::make_shared<VCardUpdate>(); - presence = boost::make_shared<Presence>(); + vcardUpdate = std::make_shared<VCardUpdate>(); + presence = std::make_shared<Presence>(); presence->setTo(ownerJID); presence->setFrom(personJID); presence->setType(Presence::Available); @@ -101,14 +101,14 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { /* reply to the avatar request with our EMPTY avatar */ CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size()); - request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]); + request = std::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas[0]); stanzaChannel->sentStanzas.pop_back(); CPPUNIT_ASSERT(!!request); vcard = request->getPayload<VCard>(); CPPUNIT_ASSERT(!!vcard); ByteArray blankAvatar = createByteArray(""); - reply = boost::make_shared<IQ>(IQ::Result); + reply = std::make_shared<IQ>(IQ::Result); reply->setTo(request->getFrom()); reply->setFrom(request->getTo()); reply->setID(request->getID()); @@ -130,14 +130,14 @@ class AvatarManagerImplTest : public CppUnit::TestFixture { private: JID ownerJID; - boost::shared_ptr<DummyStanzaChannel> stanzaChannel; - boost::shared_ptr<IQRouter> iqRouter; - boost::shared_ptr<CryptoProvider> crypto; - boost::shared_ptr<VCardMemoryStorage> vcardStorage; - boost::shared_ptr<VCardManager> vcardManager; - boost::shared_ptr<AvatarMemoryStorage> avatarStorage; - boost::shared_ptr<DummyMUCRegistry> mucRegistry; - boost::shared_ptr<AvatarManagerImpl> avatarManager; + std::shared_ptr<DummyStanzaChannel> stanzaChannel; + std::shared_ptr<IQRouter> iqRouter; + std::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<VCardMemoryStorage> vcardStorage; + std::shared_ptr<VCardManager> vcardManager; + std::shared_ptr<AvatarMemoryStorage> avatarStorage; + std::shared_ptr<DummyMUCRegistry> mucRegistry; + std::shared_ptr<AvatarManagerImpl> avatarManager; }; diff --git a/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp b/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp index fb4cd8f..288a5af 100644 --- a/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp +++ b/Swiften/Avatars/UnitTest/CombinedAvatarProviderTest.cpp @@ -62,14 +62,14 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testGetAvatarWithNoAvatarProviderReturnsEmpty() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); boost::optional<std::string> hash = testling->getAvatarHash(user1); CPPUNIT_ASSERT(!hash); } void testGetAvatarWithSingleAvatarProvider() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider1->avatars[user1] = avatarHash1; testling->addProvider(avatarProvider1); @@ -79,7 +79,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testGetAvatarWithMultipleAvatarProviderReturnsFirstAvatar() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider2->avatars[user1] = avatarHash2; testling->addProvider(avatarProvider1); @@ -91,7 +91,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testGetAvatarWithMultipleAvatarProviderAndFailingFirstProviderReturnsSecondAvatar() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider2->avatars[user1] = avatarHash2; testling->addProvider(avatarProvider1); testling->addProvider(avatarProvider2); @@ -102,7 +102,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderUpdateTriggersChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider1->onAvatarChanged(user1); @@ -112,7 +112,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderUpdateWithoutChangeDoesNotTriggerChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); testling->addProvider(avatarProvider2); avatarProvider1->avatars[user1] = avatarHash1; @@ -126,7 +126,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderSecondUpdateTriggersChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider1->onAvatarChanged(user1); @@ -140,7 +140,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { void testProviderUpdateWithAvatarDisappearingTriggersChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider1->onAvatarChanged(user1); @@ -153,7 +153,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderUpdateAfterAvatarDisappearedTriggersChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; avatarProvider1->onAvatarChanged(user1); @@ -169,7 +169,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { void testProviderUpdateAfterGetDoesNotTriggerChange() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); avatarProvider1->avatars[user1] = avatarHash1; @@ -180,7 +180,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testRemoveProviderDisconnectsUpdates() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); testling->addProvider(avatarProvider1); testling->addProvider(avatarProvider2); testling->removeProvider(avatarProvider1); @@ -192,7 +192,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } void testProviderUpdateBareJIDAfterGetFullJID() { - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider1->useBare = true; testling->addProvider(avatarProvider1); @@ -210,7 +210,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { JID ownJID = JID("user0@own.com/res"); JID user1 = JID("user1@bar.com/bla"); - boost::shared_ptr<CryptoProvider> crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + std::shared_ptr<CryptoProvider> crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); DummyStanzaChannel* stanzaChannel = new DummyStanzaChannel(); stanzaChannel->setAvailable(true); IQRouter* iqRouter = new IQRouter(stanzaChannel); @@ -219,16 +219,16 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { VCardMemoryStorage* vcardStorage = new VCardMemoryStorage(crypto.get()); VCardManager* vcardManager = new VCardManager(ownJID, iqRouter, vcardStorage); - boost::shared_ptr<VCardUpdateAvatarManager> updateManager(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry)); + std::shared_ptr<VCardUpdateAvatarManager> updateManager(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry)); updateManager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1)); - boost::shared_ptr<VCardAvatarManager> manager(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry)); + std::shared_ptr<VCardAvatarManager> manager(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry)); manager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1)); - boost::shared_ptr<OfflineAvatarManager> offlineManager(new OfflineAvatarManager(avatarStorage)); + std::shared_ptr<OfflineAvatarManager> offlineManager(new OfflineAvatarManager(avatarStorage)); offlineManager->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1)); - boost::shared_ptr<CombinedAvatarProvider> testling(createProvider()); + std::shared_ptr<CombinedAvatarProvider> testling(createProvider()); avatarProvider1->useBare = true; testling->addProvider(updateManager.get()); testling->addProvider(manager.get()); @@ -257,7 +257,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { vcardManager->requestVCard(user1.toBare()); CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size()); - IQ::ref request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back()); + IQ::ref request = std::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back()); VCard::ref payload = request->getPayload<VCard>(); CPPUNIT_ASSERT(!!payload); stanzaChannel->sentStanzas.pop_back(); @@ -267,7 +267,7 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { VCard::ref vcard2(new VCard()); vcard2->setPhoto(avatar2); - IQ::ref reply = boost::make_shared<IQ>(); + IQ::ref reply = std::make_shared<IQ>(); reply->setTo(request->getFrom()); reply->setFrom(request->getTo()); reply->setID(request->getID()); @@ -295,13 +295,13 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { vcardManager->requestVCard(user1.toBare()); CPPUNIT_ASSERT_EQUAL(size_t(1), stanzaChannel->sentStanzas.size()); - request = boost::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back()); + request = std::dynamic_pointer_cast<IQ>(stanzaChannel->sentStanzas.back()); payload = request->getPayload<VCard>(); CPPUNIT_ASSERT(!!payload); stanzaChannel->sentStanzas.pop_back(); VCard::ref vcard3(new VCard()); - reply = boost::make_shared<IQ>(); + reply = std::make_shared<IQ>(); reply->setTo(request->getFrom()); reply->setFrom(request->getTo()); reply->setID(request->getID()); @@ -331,8 +331,8 @@ class CombinedAvatarProviderTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<CombinedAvatarProvider> createProvider() { - boost::shared_ptr<CombinedAvatarProvider> result(new CombinedAvatarProvider()); + std::shared_ptr<CombinedAvatarProvider> createProvider() { + std::shared_ptr<CombinedAvatarProvider> result(new CombinedAvatarProvider()); result->onAvatarChanged.connect(boost::bind(&CombinedAvatarProviderTest::handleAvatarChanged, this, _1)); return result; } diff --git a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp index 5a28995..2ca9c1a 100644 --- a/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardAvatarManagerTest.cpp @@ -38,7 +38,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); ownJID = JID("foo@fum.com/bum"); stanzaChannel = new DummyStanzaChannel(); stanzaChannel->setAvailable(true); @@ -63,7 +63,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashKnownAvatar() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); storeVCardWithPhoto(user1.toBare(), avatar1); avatarStorage->addAvatar(avatar1Hash, avatar1); @@ -74,7 +74,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashEmptyAvatar() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); storeEmptyVCard(user1.toBare()); boost::optional<std::string> result = testling->getAvatarHash(user1); @@ -84,7 +84,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashUnknownAvatarKnownVCardStoresAvatar() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); storeVCardWithPhoto(user1.toBare(), avatar1); boost::optional<std::string> result = testling->getAvatarHash(user1); @@ -96,7 +96,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashUnknownAvatarUnknownVCard() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); boost::optional<std::string> result = testling->getAvatarHash(user1); @@ -105,7 +105,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } void testGetAvatarHashKnownAvatarUnknownVCard() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); avatarStorage->setAvatarForJID(user1, avatar1Hash); @@ -117,7 +117,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { void testVCardUpdateTriggersUpdate() { - boost::shared_ptr<VCardAvatarManager> testling = createManager(); + std::shared_ptr<VCardAvatarManager> testling = createManager(); vcardManager->requestVCard(user1); sendVCardResult(); @@ -125,8 +125,8 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<VCardAvatarManager> createManager() { - boost::shared_ptr<VCardAvatarManager> result(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry)); + std::shared_ptr<VCardAvatarManager> createManager() { + std::shared_ptr<VCardAvatarManager> result(new VCardAvatarManager(vcardManager, avatarStorage, crypto.get(), mucRegistry)); result->onAvatarChanged.connect(boost::bind(&VCardAvatarManagerTest::handleAvatarChanged, this, _1)); return result; } @@ -170,7 +170,7 @@ class VCardAvatarManagerTest : public CppUnit::TestFixture { std::vector<JID> changes; JID user1; JID user2; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(VCardAvatarManagerTest); diff --git a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp index 5f6c691..bfa13cd 100644 --- a/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp +++ b/Swiften/Avatars/UnitTest/VCardUpdateAvatarManagerTest.cpp @@ -39,7 +39,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { public: void setUp() { - crypto = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); ownJID = JID("foo@fum.com/bum"); stanzaChannel = new DummyStanzaChannel(); stanzaChannel->setAvailable(true); @@ -65,7 +65,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testUpdate_NewHashNewVCardRequestsVCard() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(stanzaChannel->sentStanzas.size())); @@ -73,7 +73,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testUpdate_NewHashStoresAvatarAndEmitsNotificationOnVCardReceive() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); @@ -87,7 +87,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testUpdate_KnownHash() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); changes.clear(); @@ -100,7 +100,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testUpdate_KnownHashFromDifferentUserDoesNotRequestVCardButTriggersNotification() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); changes.clear(); @@ -117,7 +117,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testVCardWithEmptyPhoto() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); vcardManager->requestVCard(JID("foo@bar.com")); stanzaChannel->onIQReceived(createVCardResult(ByteArray())); @@ -128,7 +128,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testStanzaChannelReset_ClearsHash() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); changes.clear(); @@ -145,7 +145,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } void testStanzaChannelReset_ReceiveHashAfterResetUpdatesHash() { - boost::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); + std::shared_ptr<VCardUpdateAvatarManager> testling = createManager(); stanzaChannel->onPresenceReceived(createPresenceWithPhotoHash(user1, avatar1Hash)); stanzaChannel->onIQReceived(createVCardResult(avatar1)); changes.clear(); @@ -163,16 +163,16 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { } private: - boost::shared_ptr<VCardUpdateAvatarManager> createManager() { - boost::shared_ptr<VCardUpdateAvatarManager> result(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry)); + std::shared_ptr<VCardUpdateAvatarManager> createManager() { + std::shared_ptr<VCardUpdateAvatarManager> result(new VCardUpdateAvatarManager(vcardManager, stanzaChannel, avatarStorage, crypto.get(), mucRegistry)); result->onAvatarChanged.connect(boost::bind(&VCardUpdateAvatarManagerTest::handleAvatarChanged, this, _1)); return result; } - boost::shared_ptr<Presence> createPresenceWithPhotoHash(const JID& jid, const std::string& hash) { - boost::shared_ptr<Presence> presence(new Presence()); + std::shared_ptr<Presence> createPresenceWithPhotoHash(const JID& jid, const std::string& hash) { + std::shared_ptr<Presence> presence(new Presence()); presence->setFrom(jid); - presence->addPayload(boost::make_shared<VCardUpdate>(hash)); + presence->addPayload(std::make_shared<VCardUpdate>(hash)); return presence; } @@ -206,7 +206,7 @@ class VCardUpdateAvatarManagerTest : public CppUnit::TestFixture { std::vector<JID> changes; JID user1; JID user2; - boost::shared_ptr<CryptoProvider> crypto; + std::shared_ptr<CryptoProvider> crypto; }; CPPUNIT_TEST_SUITE_REGISTRATION(VCardUpdateAvatarManagerTest); diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.cpp b/Swiften/Avatars/VCardUpdateAvatarManager.cpp index e40eee3..3e8d87b 100644 --- a/Swiften/Avatars/VCardUpdateAvatarManager.cpp +++ b/Swiften/Avatars/VCardUpdateAvatarManager.cpp @@ -26,8 +26,8 @@ VCardUpdateAvatarManager::VCardUpdateAvatarManager(VCardManager* vcardManager, S vcardManager_->onVCardChanged.connect(boost::bind(&VCardUpdateAvatarManager::handleVCardChanged, this, _1, _2)); } -void VCardUpdateAvatarManager::handlePresenceReceived(boost::shared_ptr<Presence> presence) { - boost::shared_ptr<VCardUpdate> update = presence->getPayload<VCardUpdate>(); +void VCardUpdateAvatarManager::handlePresenceReceived(std::shared_ptr<Presence> presence) { + std::shared_ptr<VCardUpdate> update = presence->getPayload<VCardUpdate>(); if (!update || presence->getPayload<ErrorPayload>()) { return; } diff --git a/Swiften/Avatars/VCardUpdateAvatarManager.h b/Swiften/Avatars/VCardUpdateAvatarManager.h index d66da3a..c58d491 100644 --- a/Swiften/Avatars/VCardUpdateAvatarManager.h +++ b/Swiften/Avatars/VCardUpdateAvatarManager.h @@ -7,8 +7,7 @@ #pragma once #include <map> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Avatars/AvatarProvider.h> #include <Swiften/Base/API.h> @@ -31,7 +30,7 @@ namespace Swift { boost::optional<std::string> getAvatarHash(const JID&) const; private: - void handlePresenceReceived(boost::shared_ptr<Presence>); + void handlePresenceReceived(std::shared_ptr<Presence>); void handleStanzaChannelAvailableChanged(bool); void handleVCardChanged(const JID& from, VCard::ref); void setAvatarHash(const JID& from, const std::string& hash); |