diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-01 12:36:16 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-04-01 15:56:34 (GMT) |
commit | eddd92ed76ae68cb1e202602fd3ebd11b69191a2 (patch) | |
tree | 8d396e5801d77a2f0ee4ab8e4c5093d8cf8118e6 /Swift/Controllers/Chat | |
parent | a79db8d446e152b715f435550c2a6e10a36ee532 (diff) | |
download | swift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.zip swift-eddd92ed76ae68cb1e202602fd3ebd11b69191a2.tar.bz2 |
Modernize code to use C++11 nullptr using clang-tidy
Run 'clang-tidy -fix -checks=modernize-use-nullptr' on all
source code files on OS X. This does not modernize platform
specific code on Linux and Windows
Test-Information:
Code builds and unit tests pass on OS X 10.11.4.
Change-Id: Ic43ffeb1b76c1a933a55af03db3c54977f5f60dd
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r-- | Swift/Controllers/Chat/ChatControllerBase.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 20 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.h | 4 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCController.cpp | 10 | ||||
-rw-r--r-- | Swift/Controllers/Chat/MUCSearchController.cpp | 2 | ||||
-rw-r--r-- | Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp | 10 | ||||
-rw-r--r-- | Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp | 4 | ||||
-rw-r--r-- | Swift/Controllers/Chat/UserSearchController.cpp | 6 |
8 files changed, 29 insertions, 29 deletions
diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index d478e2a..7a3db1e 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -69,7 +69,7 @@ void ChatControllerBase::handleLogCleared() { ChatWindow* ChatControllerBase::detachChatWindow() { ChatWindow* chatWindow = chatWindow_; - chatWindow_ = NULL; + chatWindow_ = nullptr; return chatWindow; } diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 32da58a..7a52d9b 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -154,11 +154,11 @@ ChatsManager::ChatsManager( chatWindowFactory_ = chatWindowFactory; nickResolver_ = nickResolver; presenceOracle_ = presenceOracle; - avatarManager_ = NULL; + avatarManager_ = nullptr; serverDiscoInfo_ = boost::make_shared<DiscoInfo>(); presenceSender_ = presenceSender; uiEventStream_ = uiEventStream; - mucBookmarkManager_ = NULL; + mucBookmarkManager_ = nullptr; profileSettings_ = profileSettings; presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1)); uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&ChatsManager::handleUIEvent, this, _1)); @@ -168,7 +168,7 @@ ChatsManager::ChatsManager( chatListWindow_->onRecentActivated.connect(boost::bind(&ChatsManager::handleRecentActivated, this, _1)); chatListWindow_->onClearRecentsRequested.connect(boost::bind(&ChatsManager::handleClearRecentsRequested, this)); - joinMUCWindow_ = NULL; + joinMUCWindow_ = nullptr; mucSearchController_ = new MUCSearchController(jid_, mucSearchWindowFactory, iqRouter, profileSettings_); mucSearchController_->onMUCSelected.connect(boost::bind(&ChatsManager::handleMUCSelectedAfterSearch, this, _1)); ftOverview_->onNewFileTransferController.connect(boost::bind(&ChatsManager::handleNewFileTransferController, this, _1)); @@ -239,7 +239,7 @@ void ChatsManager::saveRecents() { void ChatsManager::handleClearRecentsRequested() { recentChats_.clear(); saveRecents(); - handleUnreadCountChanged(NULL); + handleUnreadCountChanged(nullptr); } void ChatsManager::handleJIDAddedToRoster(const JID &jid) { @@ -340,7 +340,7 @@ void ChatsManager::loadRecents() { prependRecent(chat); } } - handleUnreadCountChanged(NULL); + handleUnreadCountChanged(nullptr); } void ChatsManager::setupBookmarks() { @@ -419,7 +419,7 @@ void ChatsManager::handleChatActivity(const JID& jid, const std::string& activit ChatListWindow::Chat chat = createChatListChatItem(jid, activity, privateMessage); /* FIXME: handle nick changes */ appendRecent(chat); - handleUnreadCountChanged(NULL); + handleUnreadCountChanged(nullptr); saveRecents(); } @@ -744,7 +744,7 @@ ChatController* ChatsManager::getChatControllerOrCreate(const JID &contact) { ChatController* ChatsManager::getChatControllerIfExists(const JID &contact, bool rebindIfNeeded) { if (chatControllers_.find(contact) == chatControllers_.end()) { if (mucRegistry_->isMUC(contact.toBare())) { - return NULL; + return nullptr; } //Need to look for an unbound window to bind first JID bare(contact.toBare()); @@ -766,7 +766,7 @@ ChatController* ChatsManager::getChatControllerIfExists(const JID &contact, bool } } } - return NULL; + return nullptr; } } return chatControllers_[contact]; @@ -807,8 +807,8 @@ MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::opti muc->setCreateAsReservedIfNew(); } - MUCController* controller = NULL; - SingleChatWindowFactoryAdapter* chatWindowFactoryAdapter = NULL; + MUCController* controller = nullptr; + SingleChatWindowFactoryAdapter* chatWindowFactoryAdapter = nullptr; if (reuseChatwindow) { chatWindowFactoryAdapter = new SingleChatWindowFactoryAdapter(reuseChatwindow); } diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h index 7bba219..fa6ab3a 100644 --- a/Swift/Controllers/Chat/ChatsManager.h +++ b/Swift/Controllers/Chat/ChatsManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -89,7 +89,7 @@ namespace Swift { ChatListWindow::Chat createChatListChatItem(const JID& jid, const std::string& activity, bool privateMessage); void handleChatRequest(const std::string& contact); void finalizeImpromptuJoin(MUC::ref muc, const std::vector<JID>& jidsToInvite, const std::string& reason, const boost::optional<JID>& reuseChatJID = boost::optional<JID>()); - MUC::ref handleJoinMUCRequest(const JID& muc, const boost::optional<std::string>& password, const boost::optional<std::string>& nick, bool addAutoJoin, bool createAsReservedIfNew, bool isImpromptu, ChatWindow* reuseChatwindow = 0); + MUC::ref handleJoinMUCRequest(const JID& muc, const boost::optional<std::string>& password, const boost::optional<std::string>& nick, bool addAutoJoin, bool createAsReservedIfNew, bool isImpromptu, ChatWindow* reuseChatwindow = nullptr); void handleSearchMUCRequest(); void handleMUCSelectedAfterSearch(const JID&); void rebindControllerJID(const JID& from, const JID& to); diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 1e2b7ad..66a655c 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -154,7 +154,7 @@ MUCController::MUCController ( if (stanzaChannel->isAvailable()) { MUCController::setOnline(true); } - if (avatarManager_ != NULL) { + if (avatarManager_ != nullptr) { avatarChangedConnection_ = (avatarManager_->onAvatarChanged.connect(boost::bind(&MUCController::handleAvatarChanged, this, _1))); } MUCController::handleBareJIDCapsChanged(muc->getJID()); @@ -177,13 +177,13 @@ MUCController::MUCController ( MUCController::~MUCController() { eventStream_->onUIEvent.disconnect(boost::bind(&MUCController::handleUIEvent, this, _1)); - chatWindow_->setRosterModel(NULL); + chatWindow_->setRosterModel(nullptr); delete rosterVCardProvider_; delete roster_; if (loginCheckTimer_) { loginCheckTimer_->stop(); } - chatWindow_->setTabComplete(NULL); + chatWindow_->setTabComplete(nullptr); delete completer_; } @@ -465,7 +465,7 @@ void MUCController::handleOccupantJoined(const MUCOccupant& occupant) { onActivity(""); } } - if (avatarManager_ != NULL) { + if (avatarManager_ != nullptr) { handleAvatarChanged(jid); } } @@ -780,7 +780,7 @@ void MUCController::handleOccupantNicknameChanged(const std::string& oldNickname std::string groupName(roleToGroupName(role)); roster_->addContact(newJID, realJID, newNickname, groupName, avatarManager_->getAvatarPath(newJID)); roster_->applyOnItems(SetMUC(newJID, role, affiliation)); - if (avatarManager_ != NULL) { + if (avatarManager_ != nullptr) { handleAvatarChanged(newJID); } diff --git a/Swift/Controllers/Chat/MUCSearchController.cpp b/Swift/Controllers/Chat/MUCSearchController.cpp index 884978c..4f28058 100644 --- a/Swift/Controllers/Chat/MUCSearchController.cpp +++ b/Swift/Controllers/Chat/MUCSearchController.cpp @@ -25,7 +25,7 @@ namespace Swift { static const std::string SEARCHED_SERVICES = "searchedServices"; -MUCSearchController::MUCSearchController(const JID& jid, MUCSearchWindowFactory* factory, IQRouter* iqRouter, ProfileSettingsProvider* settings) : jid_(jid), factory_(factory), iqRouter_(iqRouter), settings_(settings), window_(NULL), walker_(NULL) { +MUCSearchController::MUCSearchController(const JID& jid, MUCSearchWindowFactory* factory, IQRouter* iqRouter, ProfileSettingsProvider* settings) : jid_(jid), factory_(factory), iqRouter_(iqRouter), settings_(settings), window_(nullptr), walker_(nullptr) { itemsInProgress_ = 0; loadSavedServices(); } diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index 7445c4b..92a8ca0 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp @@ -95,7 +95,7 @@ public: joinMUCWindowFactory_ = mocks_->InterfaceMock<JoinMUCWindowFactory>(); xmppRoster_ = new XMPPRosterImpl(); mucRegistry_ = new MUCRegistry(); - nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, NULL, mucRegistry_); + nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, nullptr, mucRegistry_); presenceOracle_ = new PresenceOracle(stanzaChannel_, xmppRoster_); serverDiscoInfo_ = boost::make_shared<DiscoInfo>(); presenceSender_ = new StanzaChannelPresenceSender(stanzaChannel_); @@ -124,7 +124,7 @@ public: vcardManager_ = new VCardManager(jid_, iqRouter_, vcardStorage_); mocks_->ExpectCall(chatListWindowFactory_, ChatListWindowFactory::createChatListWindow).With(uiEventStream_).Return(chatListWindow_); clientBlockListManager_ = new ClientBlockListManager(iqRouter_); - manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, NULL, mucRegistry_, entityCapsProvider_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, xmppRoster_, false, settings_, NULL, wbManager_, highlightManager_, clientBlockListManager_, emoticons_, vcardManager_); + manager_ = new ChatsManager(jid_, stanzaChannel_, iqRouter_, eventController_, chatWindowFactory_, joinMUCWindowFactory_, nickResolver_, presenceOracle_, directedPresenceSender_, uiEventStream_, chatListWindowFactory_, true, nullptr, mucRegistry_, entityCapsProvider_, mucManager_, mucSearchWindowFactory_, profileSettings_, ftOverview_, xmppRoster_, false, settings_, nullptr, wbManager_, highlightManager_, clientBlockListManager_, emoticons_, vcardManager_); manager_->setAvatarManager(avatarManager_); } @@ -386,7 +386,7 @@ public: manager_->handleIncomingMessage(message); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex<Stanza>(0); CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); - CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != 0); + CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != nullptr); xmppRoster_->removeContact(messageJID); @@ -416,7 +416,7 @@ public: CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex<Stanza>(0); - CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != 0); + CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != nullptr); } /** @@ -729,7 +729,7 @@ public: CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex<Stanza>(0); - CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != 0); + CPPUNIT_ASSERT(stanzaContactOnRoster->getPayload<DeliveryReceipt>() != nullptr); } void testChatControllerHighlightingNotificationTesting() { diff --git a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp index db9bcdc..80dbc32 100644 --- a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp @@ -84,7 +84,7 @@ public: directedPresenceSender_ = new DirectedPresenceSender(presenceSender_); uiEventStream_ = new UIEventStream(); avatarManager_ = new NullAvatarManager(); - TimerFactory* timerFactory = NULL; + TimerFactory* timerFactory = nullptr; window_ = new MockChatWindow(); mucRegistry_ = new MUCRegistry(); entityCapsProvider_ = new DummyEntityCapsProvider(); @@ -97,7 +97,7 @@ public: vcardManager_ = new VCardManager(self_, iqRouter_, vcardStorage_); clientBlockListManager_ = new ClientBlockListManager(iqRouter_); mucBookmarkManager_ = new MUCBookmarkManager(iqRouter_); - controller_ = new MUCController (self_, muc_, boost::optional<std::string>(), nick_, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory, eventController_, entityCapsProvider_, NULL, NULL, mucRegistry_, highlightManager_, clientBlockListManager_, chatMessageParser_, false, NULL, vcardManager_, mucBookmarkManager_); + controller_ = new MUCController (self_, muc_, boost::optional<std::string>(), nick_, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory, eventController_, entityCapsProvider_, nullptr, nullptr, mucRegistry_, highlightManager_, clientBlockListManager_, chatMessageParser_, false, nullptr, vcardManager_, mucBookmarkManager_); } void tearDown() { diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp index 216488a..c1040f0 100644 --- a/Swift/Controllers/Chat/UserSearchController.cpp +++ b/Swift/Controllers/Chat/UserSearchController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -40,8 +40,8 @@ UserSearchController::UserSearchController(Type type, const JID& jid, UIEventStr vcardManager_->onVCardChanged.connect(boost::bind(&UserSearchController::handleVCardChanged, this, _1, _2)); avatarManager_->onAvatarChanged.connect(boost::bind(&UserSearchController::handleAvatarChanged, this, _1)); presenceOracle_->onPresenceChange.connect(boost::bind(&UserSearchController::handlePresenceChanged, this, _1)); - window_ = NULL; - discoWalker_ = NULL; + window_ = nullptr; + discoWalker_ = nullptr; loadSavedDirectories(); } |