diff options
Diffstat (limited to 'Swift')
162 files changed, 908 insertions, 898 deletions
diff --git a/Swift/Controllers/AdHocController.cpp b/Swift/Controllers/AdHocController.cpp index 4b93f2b..5e10beb 100644 --- a/Swift/Controllers/AdHocController.cpp +++ b/Swift/Controllers/AdHocController.cpp @@ -12,7 +12,7 @@ namespace Swift { -AdHocController::AdHocController(AdHocCommandWindowFactory* factory, boost::shared_ptr<OutgoingAdHocCommandSession> command) { +AdHocController::AdHocController(AdHocCommandWindowFactory* factory, std::shared_ptr<OutgoingAdHocCommandSession> command) { window_ = factory->createAdHocCommandWindow(command); window_->onClosing.connect(boost::bind(&AdHocController::handleWindowClosed, this)); } diff --git a/Swift/Controllers/AdHocController.h b/Swift/Controllers/AdHocController.h index 4694991..33b22f8 100644 --- a/Swift/Controllers/AdHocController.h +++ b/Swift/Controllers/AdHocController.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/AdHoc/OutgoingAdHocCommandSession.h> @@ -17,7 +17,7 @@ class AdHocCommandWindow; class AdHocController { public: - AdHocController(AdHocCommandWindowFactory* factory, boost::shared_ptr<OutgoingAdHocCommandSession> command); + AdHocController(AdHocCommandWindowFactory* factory, std::shared_ptr<OutgoingAdHocCommandSession> command); ~AdHocController(); boost::signal<void ()> onDeleting; void setOnline(bool online); diff --git a/Swift/Controllers/AdHocManager.cpp b/Swift/Controllers/AdHocManager.cpp index 1dcefbd..4212b8a 100644 --- a/Swift/Controllers/AdHocManager.cpp +++ b/Swift/Controllers/AdHocManager.cpp @@ -6,9 +6,9 @@ #include <Swift/Controllers/AdHocManager.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/AdHoc/OutgoingAdHocCommandSession.h> #include <Swiften/Base/foreach.h> @@ -38,12 +38,12 @@ AdHocManager::~AdHocManager() { } } -void AdHocManager::removeController(boost::shared_ptr<AdHocController> controller) { +void AdHocManager::removeController(std::shared_ptr<AdHocController> controller) { controller->onDeleting.disconnect(boost::bind(&AdHocManager::removeController, this, controller)); controllers_.erase(std::find(controllers_.begin(), controllers_.end(), controller)); } -void AdHocManager::setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info) { +void AdHocManager::setServerDiscoInfo(std::shared_ptr<DiscoInfo> info) { if (iqRouter_->isAvailable() && info->hasFeature(DiscoInfo::CommandsFeature)) { if (discoItemsRequest_) { discoItemsRequest_->onResponse.disconnect(boost::bind(&AdHocManager::handleServerDiscoItemsResponse, this, _1, _2)); @@ -58,12 +58,12 @@ void AdHocManager::setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info) { } void AdHocManager::setOnline(bool online) { - foreach (boost::shared_ptr<AdHocController> controller, controllers_) { + foreach (std::shared_ptr<AdHocController> controller, controllers_) { controller->setOnline(online); } } -void AdHocManager::handleServerDiscoItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error) { +void AdHocManager::handleServerDiscoItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPayload::ref error) { std::vector<DiscoItems::Item> commands; if (!error) { foreach (DiscoItems::Item item, items->getItems()) { @@ -75,18 +75,18 @@ void AdHocManager::handleServerDiscoItemsResponse(boost::shared_ptr<DiscoItems> mainWindow_->setAvailableAdHocCommands(commands); } -void AdHocManager::handleUIEvent(boost::shared_ptr<UIEvent> event) { - boost::shared_ptr<RequestAdHocUIEvent> adHocEvent = boost::dynamic_pointer_cast<RequestAdHocUIEvent>(event); +void AdHocManager::handleUIEvent(std::shared_ptr<UIEvent> event) { + std::shared_ptr<RequestAdHocUIEvent> adHocEvent = std::dynamic_pointer_cast<RequestAdHocUIEvent>(event); if (adHocEvent) { - boost::shared_ptr<OutgoingAdHocCommandSession> command = boost::make_shared<OutgoingAdHocCommandSession>(adHocEvent->getCommand().getJID(), adHocEvent->getCommand().getNode(), iqRouter_); - boost::shared_ptr<AdHocController> controller = boost::make_shared<AdHocController>(factory_, command); + std::shared_ptr<OutgoingAdHocCommandSession> command = std::make_shared<OutgoingAdHocCommandSession>(adHocEvent->getCommand().getJID(), adHocEvent->getCommand().getNode(), iqRouter_); + std::shared_ptr<AdHocController> controller = std::make_shared<AdHocController>(factory_, command); controller->onDeleting.connect(boost::bind(&AdHocManager::removeController, this, controller)); controllers_.push_back(controller); } - boost::shared_ptr<RequestAdHocWithJIDUIEvent> adHocJIDEvent = boost::dynamic_pointer_cast<RequestAdHocWithJIDUIEvent>(event); + std::shared_ptr<RequestAdHocWithJIDUIEvent> adHocJIDEvent = std::dynamic_pointer_cast<RequestAdHocWithJIDUIEvent>(event); if (!!adHocJIDEvent) { - boost::shared_ptr<OutgoingAdHocCommandSession> command = boost::make_shared<OutgoingAdHocCommandSession>(adHocJIDEvent->getJID(), adHocJIDEvent->getNode(), iqRouter_); - boost::shared_ptr<AdHocController> controller = boost::make_shared<AdHocController>(factory_, command); + std::shared_ptr<OutgoingAdHocCommandSession> command = std::make_shared<OutgoingAdHocCommandSession>(adHocJIDEvent->getJID(), adHocJIDEvent->getNode(), iqRouter_); + std::shared_ptr<AdHocController> controller = std::make_shared<AdHocController>(factory_, command); controller->onDeleting.connect(boost::bind(&AdHocManager::removeController, this, controller)); controllers_.push_back(controller); } diff --git a/Swift/Controllers/AdHocManager.h b/Swift/Controllers/AdHocManager.h index 73c057c..3a908ec 100644 --- a/Swift/Controllers/AdHocManager.h +++ b/Swift/Controllers/AdHocManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -25,12 +25,12 @@ class AdHocManager { public: AdHocManager(const JID& jid, AdHocCommandWindowFactory* factory, IQRouter* iqRouter, UIEventStream* uiEventStream, MainWindow* mainWindow); ~AdHocManager(); - void removeController(boost::shared_ptr<AdHocController> contoller); - void setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info); + void removeController(std::shared_ptr<AdHocController> contoller); + void setServerDiscoInfo(std::shared_ptr<DiscoInfo> info); void setOnline(bool online); private: - void handleServerDiscoItemsResponse(boost::shared_ptr<DiscoItems>, ErrorPayload::ref error); - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleServerDiscoItemsResponse(std::shared_ptr<DiscoItems>, ErrorPayload::ref error); + void handleUIEvent(std::shared_ptr<UIEvent> event); boost::signal<void (const AdHocController&)> onControllerComplete; JID jid_; IQRouter* iqRouter_; @@ -38,7 +38,7 @@ private: MainWindow* mainWindow_; AdHocCommandWindowFactory* factory_; GetDiscoItemsRequest::ref discoItemsRequest_; - std::vector<boost::shared_ptr<AdHocController> > controllers_; + std::vector<std::shared_ptr<AdHocController> > controllers_; }; } diff --git a/Swift/Controllers/BlockListController.cpp b/Swift/Controllers/BlockListController.cpp index 9ed98a8..560a3f3 100644 --- a/Swift/Controllers/BlockListController.cpp +++ b/Swift/Controllers/BlockListController.cpp @@ -53,9 +53,9 @@ void BlockListController::blockListDifferences(const std::vector<JID> &newBlockL } } -void BlockListController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { +void BlockListController::handleUIEvent(std::shared_ptr<UIEvent> rawEvent) { // handle UI dialog - boost::shared_ptr<RequestBlockListDialogUIEvent> requestDialogEvent = boost::dynamic_pointer_cast<RequestBlockListDialogUIEvent>(rawEvent); + std::shared_ptr<RequestBlockListDialogUIEvent> requestDialogEvent = std::dynamic_pointer_cast<RequestBlockListDialogUIEvent>(rawEvent); if (requestDialogEvent != nullptr) { if (blockListEditorWidget_ == nullptr) { blockListEditorWidget_ = blockListEditorWidgetFactory_->createBlockListEditorWidget(); @@ -69,7 +69,7 @@ void BlockListController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { } // handle block state change - boost::shared_ptr<RequestChangeBlockStateUIEvent> changeStateEvent = boost::dynamic_pointer_cast<RequestChangeBlockStateUIEvent>(rawEvent); + std::shared_ptr<RequestChangeBlockStateUIEvent> changeStateEvent = std::dynamic_pointer_cast<RequestChangeBlockStateUIEvent>(rawEvent); if (changeStateEvent != nullptr) { if (changeStateEvent->getBlockState() == RequestChangeBlockStateUIEvent::Blocked) { GenericRequest<BlockPayload>::ref blockRequest = blockListManager_->createBlockJIDRequest(changeStateEvent->getContact()); @@ -84,7 +84,7 @@ void BlockListController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { } } -void BlockListController::handleBlockResponse(GenericRequest<BlockPayload>::ref request, boost::shared_ptr<BlockPayload>, ErrorPayload::ref error, const std::vector<JID>& jids, bool originEditor) { +void BlockListController::handleBlockResponse(GenericRequest<BlockPayload>::ref request, std::shared_ptr<BlockPayload>, ErrorPayload::ref error, const std::vector<JID>& jids, bool originEditor) { if (error) { std::string errorMessage; // FIXME: Handle reporting of list of JIDs in a translatable way. @@ -97,7 +97,7 @@ void BlockListController::handleBlockResponse(GenericRequest<BlockPayload>::ref blockListEditorWidget_->setBusy(false); } else { - eventController_->handleIncomingEvent(boost::make_shared<ErrorEvent>(request->getReceiver(), errorMessage)); + eventController_->handleIncomingEvent(std::make_shared<ErrorEvent>(request->getReceiver(), errorMessage)); } } if (originEditor) { @@ -109,7 +109,7 @@ void BlockListController::handleBlockResponse(GenericRequest<BlockPayload>::ref } } -void BlockListController::handleUnblockResponse(GenericRequest<UnblockPayload>::ref request, boost::shared_ptr<UnblockPayload>, ErrorPayload::ref error, const std::vector<JID>& jids, bool originEditor) { +void BlockListController::handleUnblockResponse(GenericRequest<UnblockPayload>::ref request, std::shared_ptr<UnblockPayload>, ErrorPayload::ref error, const std::vector<JID>& jids, bool originEditor) { if (error) { std::string errorMessage; // FIXME: Handle reporting of list of JIDs in a translatable way. @@ -122,7 +122,7 @@ void BlockListController::handleUnblockResponse(GenericRequest<UnblockPayload>:: blockListEditorWidget_->setBusy(false); } else { - eventController_->handleIncomingEvent(boost::make_shared<ErrorEvent>(request->getReceiver(), errorMessage)); + eventController_->handleIncomingEvent(std::make_shared<ErrorEvent>(request->getReceiver(), errorMessage)); } } if (originEditor) { diff --git a/Swift/Controllers/BlockListController.h b/Swift/Controllers/BlockListController.h index f9ee5a6..c1f6fee 100644 --- a/Swift/Controllers/BlockListController.h +++ b/Swift/Controllers/BlockListController.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Queries/GenericRequest.h> @@ -34,10 +34,10 @@ public: private: void blockListDifferences(const std::vector<JID> &newBlockList, std::vector<JID>& jidsToUnblock, std::vector<JID>& jidsToBlock) const; - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleUIEvent(std::shared_ptr<UIEvent> event); - void handleBlockResponse(GenericRequest<BlockPayload>::ref, boost::shared_ptr<BlockPayload>, ErrorPayload::ref error, const std::vector<JID>& jids, bool originEditor); - void handleUnblockResponse(GenericRequest<UnblockPayload>::ref, boost::shared_ptr<UnblockPayload>, ErrorPayload::ref error, const std::vector<JID>& jids, bool originEditor); + void handleBlockResponse(GenericRequest<BlockPayload>::ref, std::shared_ptr<BlockPayload>, ErrorPayload::ref error, const std::vector<JID>& jids, bool originEditor); + void handleUnblockResponse(GenericRequest<UnblockPayload>::ref, std::shared_ptr<UnblockPayload>, ErrorPayload::ref error, const std::vector<JID>& jids, bool originEditor); void handleSetNewBlockList(const std::vector<JID>& newBlockList); diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 5302492..dbc5a79 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -6,8 +6,9 @@ #include <Swift/Controllers/Chat/ChatController.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Avatars/AvatarManager.h> #include <Swiften/Base/Algorithm.h> @@ -49,7 +50,7 @@ namespace Swift { /** * The controller does not gain ownership of the stanzaChannel, nor the factory. */ -ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool isInMUC, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsProvider* entityCapsProvider, bool userWantsReceipts, SettingsProvider* settings, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, ClientBlockListManager* clientBlockListManager, boost::shared_ptr<ChatMessageParser> chatMessageParser, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider) +ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool isInMUC, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsProvider* entityCapsProvider, bool userWantsReceipts, SettingsProvider* settings, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, ClientBlockListManager* clientBlockListManager, std::shared_ptr<ChatMessageParser> chatMessageParser, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider) : ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, contact, presenceOracle, avatarManager, useDelayForLatency, eventStream, eventController, timerFactory, entityCapsProvider, historyController, mucRegistry, highlightManager, chatMessageParser, autoAcceptMUCInviteDecider), eventStream_(eventStream), userWantsReceipts_(userWantsReceipts), settings_(settings), clientBlockListManager_(clientBlockListManager) { isInMUC_ = isInMUC; lastWasPresence_ = false; @@ -147,10 +148,10 @@ void ChatController::setToJID(const JID& jid) { handleBareJIDCapsChanged(toJID_); } -void ChatController::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) { +void ChatController::setAvailableServerFeatures(std::shared_ptr<DiscoInfo> info) { ChatControllerBase::setAvailableServerFeatures(info); if (iqRouter_->isAvailable() && info->hasFeature(DiscoInfo::BlockingCommandFeature)) { - boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); + std::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); blockingOnStateChangedConnection_ = blockList->onStateChanged.connect(boost::bind(&ChatController::handleBlockingStateChanged, this)); blockingOnItemAddedConnection_ = blockList->onItemAdded.connect(boost::bind(&ChatController::handleBlockingStateChanged, this)); @@ -160,16 +161,16 @@ void ChatController::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> inf } } -bool ChatController::isIncomingMessageFromMe(boost::shared_ptr<Message>) { +bool ChatController::isIncomingMessageFromMe(std::shared_ptr<Message>) { return false; } -void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) { +void ChatController::preHandleIncomingMessage(std::shared_ptr<MessageEvent> messageEvent) { if (messageEvent->isReadable()) { chatWindow_->flash(); lastWasPresence_ = false; } - boost::shared_ptr<Message> message = messageEvent->getStanza(); + std::shared_ptr<Message> message = messageEvent->getStanza(); JID from = message->getFrom(); if (!from.equals(toJID_, JID::WithResource)) { if (toJID_.equals(from, JID::WithoutResource) && toJID_.isBare()){ @@ -185,7 +186,7 @@ void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> me // handle XEP-0184 Message Receipts // incomming receipts - if (boost::shared_ptr<DeliveryReceipt> receipt = message->getPayload<DeliveryReceipt>()) { + if (std::shared_ptr<DeliveryReceipt> receipt = message->getPayload<DeliveryReceipt>()) { SWIFT_LOG(debug) << "received receipt for id: " << receipt->getReceivedID() << std::endl; if (requestedReceipts_.find(receipt->getReceivedID()) != requestedReceipts_.end()) { chatWindow_->setMessageReceiptState(requestedReceipts_[receipt->getReceivedID()], ChatWindow::ReceiptReceived); @@ -200,15 +201,15 @@ void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> me // incoming receipt requests } else if (message->getPayload<DeliveryReceiptRequest>()) { if (receivingPresenceFromUs_) { - boost::shared_ptr<Message> receiptMessage = boost::make_shared<Message>(); + std::shared_ptr<Message> receiptMessage = std::make_shared<Message>(); receiptMessage->setTo(toJID_); - receiptMessage->addPayload(boost::make_shared<DeliveryReceipt>(message->getID())); + receiptMessage->addPayload(std::make_shared<DeliveryReceipt>(message->getID())); stanzaChannel_->sendMessage(receiptMessage); } } } -void ChatController::postHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent, const ChatWindow::ChatMessage& chatMessage) { +void ChatController::postHandleIncomingMessage(std::shared_ptr<MessageEvent> messageEvent, const ChatWindow::ChatMessage& chatMessage) { eventController_->handleIncomingEvent(messageEvent); if (!messageEvent->getConcluded()) { handleHighlightActions(chatMessage); @@ -216,10 +217,10 @@ void ChatController::postHandleIncomingMessage(boost::shared_ptr<MessageEvent> m } -void ChatController::preSendMessageRequest(boost::shared_ptr<Message> message) { +void ChatController::preSendMessageRequest(std::shared_ptr<Message> message) { chatStateNotifier_->addChatStateRequest(message); if (userWantsReceipts_ && (contactSupportsReceipts_ != No) && message) { - message->addPayload(boost::make_shared<DeliveryReceiptRequest>()); + message->addPayload(std::make_shared<DeliveryReceiptRequest>()); } } @@ -255,7 +256,7 @@ void ChatController::checkForDisplayingDisplayReceiptsAlert() { } void ChatController::handleBlockingStateChanged() { - boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); + std::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); if (blockList->getState() == BlockList::Available) { if (isInMUC_ ? blockList->isBlocked(toJID_) : blockList->isBlocked(toJID_.toBare())) { if (!blockedContactAlert_) { @@ -281,22 +282,22 @@ void ChatController::handleBlockingStateChanged() { void ChatController::handleBlockUserRequest() { if (isInMUC_) { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Blocked, toJID_)); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Blocked, toJID_)); } else { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Blocked, toJID_.toBare())); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Blocked, toJID_.toBare())); } } void ChatController::handleUnblockUserRequest() { if (isInMUC_) { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, toJID_)); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, toJID_)); } else { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, toJID_.toBare())); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, toJID_.toBare())); } } void ChatController::handleInviteToChat(const std::vector<JID>& droppedJIDs) { - boost::shared_ptr<UIEvent> event(new RequestInviteToMUCUIEvent(toJID_.toBare(), droppedJIDs, RequestInviteToMUCUIEvent::Impromptu)); + std::shared_ptr<UIEvent> event(new RequestInviteToMUCUIEvent(toJID_.toBare(), droppedJIDs, RequestInviteToMUCUIEvent::Impromptu)); eventStream_->send(event); } @@ -304,21 +305,21 @@ void ChatController::handleWindowClosed() { onWindowClosed(); } -void ChatController::handleUIEvent(boost::shared_ptr<UIEvent> event) { - boost::shared_ptr<InviteToMUCUIEvent> inviteEvent = boost::dynamic_pointer_cast<InviteToMUCUIEvent>(event); +void ChatController::handleUIEvent(std::shared_ptr<UIEvent> event) { + std::shared_ptr<InviteToMUCUIEvent> inviteEvent = std::dynamic_pointer_cast<InviteToMUCUIEvent>(event); if (inviteEvent && inviteEvent->getRoom() == toJID_.toBare()) { onConvertToMUC(detachChatWindow(), inviteEvent->getInvites(), inviteEvent->getReason()); } } -void ChatController::postSendMessage(const std::string& body, boost::shared_ptr<Stanza> sentStanza) { - boost::shared_ptr<Replace> replace = sentStanza->getPayload<Replace>(); +void ChatController::postSendMessage(const std::string& body, std::shared_ptr<Stanza> sentStanza) { + std::shared_ptr<Replace> replace = sentStanza->getPayload<Replace>(); if (replace) { - eraseIf(unackedStanzas_, PairSecondEquals<boost::shared_ptr<Stanza>, std::string>(myLastMessageUIID_)); + eraseIf(unackedStanzas_, PairSecondEquals<std::shared_ptr<Stanza>, std::string>(myLastMessageUIID_)); replaceMessage(chatMessageParser_->parseMessageBody(body, "", true), myLastMessageUIID_, boost::posix_time::microsec_clock::universal_time()); } else { - myLastMessageUIID_ = addMessage(chatMessageParser_->parseMessageBody(body, "", true), QT_TRANSLATE_NOOP("", "me"), true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel().getLabel() : boost::shared_ptr<SecurityLabel>(), avatarManager_->getAvatarPath(selfJID_), boost::posix_time::microsec_clock::universal_time()); + myLastMessageUIID_ = addMessage(chatMessageParser_->parseMessageBody(body, "", true), QT_TRANSLATE_NOOP("", "me"), true, labelsEnabled_ ? chatWindow_->getSelectedSecurityLabel().getLabel() : std::shared_ptr<SecurityLabel>(), avatarManager_->getAvatarPath(selfJID_), boost::posix_time::microsec_clock::universal_time()); } if (stanzaChannel_->getStreamManagementEnabled() && !myLastMessageUIID_.empty() ) { @@ -335,8 +336,8 @@ void ChatController::postSendMessage(const std::string& body, boost::shared_ptr< chatStateNotifier_->userSentMessage(); } -void ChatController::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) { - std::map<boost::shared_ptr<Stanza>, std::string>::iterator unackedStanza = unackedStanzas_.find(stanza); +void ChatController::handleStanzaAcked(std::shared_ptr<Stanza> stanza) { + std::map<std::shared_ptr<Stanza>, std::string>::iterator unackedStanza = unackedStanzas_.find(stanza); if (unackedStanza != unackedStanzas_.end()) { chatWindow_->setAckState(unackedStanza->second, ChatWindow::Received); unackedStanzas_.erase(unackedStanza); @@ -345,7 +346,7 @@ void ChatController::handleStanzaAcked(boost::shared_ptr<Stanza> stanza) { void ChatController::setOnline(bool online) { if (!online) { - std::map<boost::shared_ptr<Stanza>, std::string>::iterator it = unackedStanzas_.begin(); + std::map<std::shared_ptr<Stanza>, std::string>::iterator it = unackedStanzas_.begin(); for ( ; it != unackedStanzas_.end(); ++it) { chatWindow_->setAckState(it->second, ChatWindow::Failed); } @@ -403,19 +404,19 @@ void ChatController::handleFileTransferAccept(std::string id, std::string filena void ChatController::handleSendFileRequest(std::string filename) { SWIFT_LOG(debug) << "ChatController::handleSendFileRequest(" << filename << ")" << std::endl; - eventStream_->send(boost::make_shared<SendFileUIEvent>(getToJID(), filename)); + eventStream_->send(std::make_shared<SendFileUIEvent>(getToJID(), filename)); } void ChatController::handleWhiteboardSessionAccept() { - eventStream_->send(boost::make_shared<AcceptWhiteboardSessionUIEvent>(toJID_)); + eventStream_->send(std::make_shared<AcceptWhiteboardSessionUIEvent>(toJID_)); } void ChatController::handleWhiteboardSessionCancel() { - eventStream_->send(boost::make_shared<CancelWhiteboardSessionUIEvent>(toJID_)); + eventStream_->send(std::make_shared<CancelWhiteboardSessionUIEvent>(toJID_)); } void ChatController::handleWhiteboardWindowShow() { - eventStream_->send(boost::make_shared<ShowWhiteboardUIEvent>(toJID_)); + eventStream_->send(std::make_shared<ShowWhiteboardUIEvent>(toJID_)); } std::string ChatController::senderHighlightNameFromMessage(const JID& from) { @@ -431,7 +432,7 @@ std::string ChatController::senderDisplayNameFromMessage(const JID& from) { return nickResolver_->jidToNick(from); } -std::string ChatController::getStatusChangeString(boost::shared_ptr<Presence> presence) { +std::string ChatController::getStatusChangeString(std::shared_ptr<Presence> presence) { std::string nick = senderDisplayNameFromMessage(presence->getFrom()); std::string response; if (!presence || presence->getType() == Presence::Unavailable || presence->getType() == Presence::Error) { @@ -461,7 +462,7 @@ std::string ChatController::getStatusChangeString(boost::shared_ptr<Presence> pr return response + "."; } -void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresence) { +void ChatController::handlePresenceChange(std::shared_ptr<Presence> newPresence) { bool relevantPresence = false; if (isInMUC_) { @@ -487,7 +488,7 @@ void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresenc } if (!newPresence) { - newPresence = boost::make_shared<Presence>(); + newPresence = std::make_shared<Presence>(); newPresence->setType(Presence::Unavailable); } lastShownStatus_ = newPresence->getShow(); @@ -506,7 +507,7 @@ void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresenc } } -boost::optional<boost::posix_time::ptime> ChatController::getMessageTimestamp(boost::shared_ptr<Message> message) const { +boost::optional<boost::posix_time::ptime> ChatController::getMessageTimestamp(std::shared_ptr<Message> message) const { return message->getTimestamp(); } diff --git a/Swift/Controllers/Chat/ChatController.h b/Swift/Controllers/Chat/ChatController.h index aa2b203..d5553bc 100644 --- a/Swift/Controllers/Chat/ChatController.h +++ b/Swift/Controllers/Chat/ChatController.h @@ -30,10 +30,10 @@ namespace Swift { class ChatController : public ChatControllerBase { public: - ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool isInMUC, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsProvider* entityCapsProvider, bool userWantsReceipts, SettingsProvider* settings, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, ClientBlockListManager* clientBlockListManager, boost::shared_ptr<ChatMessageParser> chatMessageParser, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider); + ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool isInMUC, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsProvider* entityCapsProvider, bool userWantsReceipts, SettingsProvider* settings, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, ClientBlockListManager* clientBlockListManager, std::shared_ptr<ChatMessageParser> chatMessageParser, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider); virtual ~ChatController(); virtual void setToJID(const JID& jid) SWIFTEN_OVERRIDE; - virtual void setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) SWIFTEN_OVERRIDE; + virtual void setAvailableServerFeatures(std::shared_ptr<DiscoInfo> info) SWIFTEN_OVERRIDE; virtual void setOnline(bool online) SWIFTEN_OVERRIDE; virtual void handleNewFileTransferController(FileTransferController* ftc); virtual void handleWhiteboardSessionRequest(bool senderIsSelf); @@ -47,17 +47,17 @@ namespace Swift { virtual void logMessage(const std::string& message, const JID& fromJID, const JID& toJID, const boost::posix_time::ptime& timeStamp, bool isIncoming) SWIFTEN_OVERRIDE; private: - void handlePresenceChange(boost::shared_ptr<Presence> newPresence); - std::string getStatusChangeString(boost::shared_ptr<Presence> presence); - virtual bool isIncomingMessageFromMe(boost::shared_ptr<Message> message) SWIFTEN_OVERRIDE; - virtual void postSendMessage(const std::string &body, boost::shared_ptr<Stanza> sentStanza) SWIFTEN_OVERRIDE; - virtual void preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) SWIFTEN_OVERRIDE; - virtual void postHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent, const ChatWindow::ChatMessage& chatMessage) SWIFTEN_OVERRIDE; - virtual void preSendMessageRequest(boost::shared_ptr<Message>) SWIFTEN_OVERRIDE; + void handlePresenceChange(std::shared_ptr<Presence> newPresence); + std::string getStatusChangeString(std::shared_ptr<Presence> presence); + virtual bool isIncomingMessageFromMe(std::shared_ptr<Message> message) SWIFTEN_OVERRIDE; + virtual void postSendMessage(const std::string &body, std::shared_ptr<Stanza> sentStanza) SWIFTEN_OVERRIDE; + virtual void preHandleIncomingMessage(std::shared_ptr<MessageEvent> messageEvent) SWIFTEN_OVERRIDE; + virtual void postHandleIncomingMessage(std::shared_ptr<MessageEvent> messageEvent, const ChatWindow::ChatMessage& chatMessage) SWIFTEN_OVERRIDE; + virtual void preSendMessageRequest(std::shared_ptr<Message>) SWIFTEN_OVERRIDE; virtual std::string senderHighlightNameFromMessage(const JID& from) SWIFTEN_OVERRIDE; virtual std::string senderDisplayNameFromMessage(const JID& from) SWIFTEN_OVERRIDE; - virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message>) const SWIFTEN_OVERRIDE; - void handleStanzaAcked(boost::shared_ptr<Stanza> stanza); + virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(std::shared_ptr<Message>) const SWIFTEN_OVERRIDE; + void handleStanzaAcked(std::shared_ptr<Stanza> stanza); virtual void dayTicked() SWIFTEN_OVERRIDE { lastWasPresence_ = false; } void handleContactNickChanged(const JID& jid, const std::string& /*oldNick*/); virtual void handleBareJIDCapsChanged(const JID& jid) SWIFTEN_OVERRIDE; @@ -82,7 +82,7 @@ namespace Swift { void handleWindowClosed(); - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleUIEvent(std::shared_ptr<UIEvent> event); private: NickResolver* nickResolver_; @@ -92,7 +92,7 @@ namespace Swift { bool isInMUC_; bool lastWasPresence_; std::string lastStatusChangeString_; - std::map<boost::shared_ptr<Stanza>, std::string> unackedStanzas_; + std::map<std::shared_ptr<Stanza>, std::string> unackedStanzas_; std::map<std::string, std::string> requestedReceipts_; StatusShow::Type lastShownStatus_; UIEventStream* eventStream_; diff --git a/Swift/Controllers/Chat/ChatControllerBase.cpp b/Swift/Controllers/Chat/ChatControllerBase.cpp index 7a3db1e..5b0bbd9 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.cpp +++ b/Swift/Controllers/Chat/ChatControllerBase.cpp @@ -7,14 +7,13 @@ #include <Swift/Controllers/Chat/ChatControllerBase.h> #include <map> +#include <memory> #include <sstream> #include <boost/algorithm/string.hpp> #include <boost/bind.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/numeric/conversion/cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Avatars/AvatarManager.h> #include <Swiften/Base/Path.h> @@ -42,7 +41,7 @@ namespace Swift { -ChatControllerBase::ChatControllerBase(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &toJID, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsProvider* entityCapsProvider, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, boost::shared_ptr<ChatMessageParser> chatMessageParser, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider) : selfJID_(self), stanzaChannel_(stanzaChannel), iqRouter_(iqRouter), chatWindowFactory_(chatWindowFactory), toJID_(toJID), labelsEnabled_(false), presenceOracle_(presenceOracle), avatarManager_(avatarManager), useDelayForLatency_(useDelayForLatency), eventController_(eventController), timerFactory_(timerFactory), entityCapsProvider_(entityCapsProvider), historyController_(historyController), mucRegistry_(mucRegistry), chatMessageParser_(chatMessageParser), autoAcceptMUCInviteDecider_(autoAcceptMUCInviteDecider), eventStream_(eventStream) { +ChatControllerBase::ChatControllerBase(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &toJID, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsProvider* entityCapsProvider, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, std::shared_ptr<ChatMessageParser> chatMessageParser, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider) : selfJID_(self), stanzaChannel_(stanzaChannel), iqRouter_(iqRouter), chatWindowFactory_(chatWindowFactory), toJID_(toJID), labelsEnabled_(false), presenceOracle_(presenceOracle), avatarManager_(avatarManager), useDelayForLatency_(useDelayForLatency), eventController_(eventController), timerFactory_(timerFactory), entityCapsProvider_(entityCapsProvider), historyController_(historyController), mucRegistry_(mucRegistry), chatMessageParser_(chatMessageParser), autoAcceptMUCInviteDecider_(autoAcceptMUCInviteDecider), eventStream_(eventStream) { chatWindow_ = chatWindowFactory_->createChatWindow(toJID, eventStream); chatWindow_->onAllMessagesRead.connect(boost::bind(&ChatControllerBase::handleAllMessagesRead, this)); chatWindow_->onSendMessageRequest.connect(boost::bind(&ChatControllerBase::handleSendMessageRequest, this, _1, _2)); @@ -117,7 +116,7 @@ JID ChatControllerBase::getBaseJID() { return JID(toJID_.toBare()); } -void ChatControllerBase::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) { +void ChatControllerBase::setAvailableServerFeatures(std::shared_ptr<DiscoInfo> info) { if (iqRouter_->isAvailable() && info->hasFeature(DiscoInfo::SecurityLabelsCatalogFeature)) { GetSecurityLabelsCatalogRequest::ref request = GetSecurityLabelsCatalogRequest::create(getBaseJID(), iqRouter_); request->onResponse.connect(boost::bind(&ChatControllerBase::handleSecurityLabelsCatalogResponse, this, _1, _2)); @@ -131,7 +130,7 @@ void ChatControllerBase::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> void ChatControllerBase::handleAllMessagesRead() { if (!unreadMessages_.empty()) { targetedUnreadMessages_.clear(); - foreach (boost::shared_ptr<StanzaEvent> stanzaEvent, unreadMessages_) { + foreach (std::shared_ptr<StanzaEvent> stanzaEvent, unreadMessages_) { stanzaEvent->conclude(); } unreadMessages_.clear(); @@ -148,7 +147,7 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool if (!stanzaChannel_->isAvailable() || body.empty()) { return; } - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); message->setTo(toJID_); message->setType(Swift::Message::Chat); message->setBody(body); @@ -165,14 +164,14 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time(); if (useDelayForLatency_) { - message->addPayload(boost::make_shared<Delay>(now, selfJID_)); + message->addPayload(std::make_shared<Delay>(now, selfJID_)); } if (isCorrectionMessage) { - message->addPayload(boost::shared_ptr<Replace> (new Replace(lastSentMessageStanzaID_))); + message->addPayload(std::shared_ptr<Replace> (new Replace(lastSentMessageStanzaID_))); } message->setID(lastSentMessageStanzaID_ = idGenerator_.generateID()); stanzaChannel_->sendMessage(message); - postSendMessage(message->getBody().get(), boost::dynamic_pointer_cast<Stanza>(message)); + postSendMessage(message->getBody().get(), std::dynamic_pointer_cast<Stanza>(message)); onActivity(message->getBody().get()); #ifdef SWIFT_EXPERIMENTAL_HISTORY @@ -180,7 +179,7 @@ void ChatControllerBase::handleSendMessageRequest(const std::string &body, bool #endif } -void ChatControllerBase::handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog> catalog, ErrorPayload::ref error) { +void ChatControllerBase::handleSecurityLabelsCatalogResponse(std::shared_ptr<SecurityLabelsCatalog> catalog, ErrorPayload::ref error) { if (catalog && !error) { if (catalog->getItems().size() == 0) { chatWindow_->setSecurityLabelsEnabled(false); @@ -226,8 +225,8 @@ void ChatControllerBase::handleHighlightActions(const ChatWindow::ChatMessage& c highlighter_->handleHighlightAction(chatMessage.getFullMessageHighlightAction()); playedSounds.insert(chatMessage.getFullMessageHighlightAction().getSoundFile()); } - foreach(boost::shared_ptr<ChatWindow::ChatMessagePart> part, chatMessage.getParts()) { - boost::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightMessage = boost::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part); + foreach(std::shared_ptr<ChatWindow::ChatMessagePart> part, chatMessage.getParts()) { + std::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightMessage = std::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part); if (highlightMessage && highlightMessage->action.playSound()) { if (playedSounds.find(highlightMessage->action.getSoundFile()) == playedSounds.end()) { highlighter_->handleHighlightAction(highlightMessage->action); @@ -237,7 +236,7 @@ void ChatControllerBase::handleHighlightActions(const ChatWindow::ChatMessage& c } } -std::string ChatControllerBase::addMessage(const ChatWindow::ChatMessage& chatMessage, const std::string& senderName, bool senderIsSelf, const boost::shared_ptr<SecurityLabel> label, const boost::filesystem::path& avatarPath, const boost::posix_time::ptime& time) { +std::string ChatControllerBase::addMessage(const ChatWindow::ChatMessage& chatMessage, const std::string& senderName, bool senderIsSelf, const std::shared_ptr<SecurityLabel> label, const boost::filesystem::path& avatarPath, const boost::posix_time::ptime& time) { if (chatMessage.isMeCommand()) { return chatWindow_->addAction(chatMessage, senderName, senderIsSelf, label, pathToString(avatarPath), time); } @@ -259,7 +258,7 @@ bool ChatControllerBase::isFromContact(const JID& from) { return from.toBare() == toJID_.toBare(); } -void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) { +void ChatControllerBase::handleIncomingMessage(std::shared_ptr<MessageEvent> messageEvent) { preHandleIncomingMessage(messageEvent); if (messageEvent->isReadable() && !messageEvent->getConcluded()) { unreadMessages_.push_back(messageEvent); @@ -268,7 +267,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m } } - boost::shared_ptr<Message> message = messageEvent->getStanza(); + std::shared_ptr<Message> message = messageEvent->getStanza(); ChatWindow::ChatMessage chatMessage; boost::optional<std::string> optionalBody = message->getBody(); std::string body = optionalBody.get_value_or(""); @@ -292,7 +291,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m } showChatWindow(); JID from = message->getFrom(); - std::vector<boost::shared_ptr<Delay> > delayPayloads = message->getPayloads<Delay>(); + std::vector<std::shared_ptr<Delay> > delayPayloads = message->getPayloads<Delay>(); for (size_t i = 0; useDelayForLatency_ && i < delayPayloads.size(); i++) { if (!delayPayloads[i]->getFrom()) { continue; @@ -302,7 +301,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m s << "The following message took " << (now - delayPayloads[i]->getStamp()).total_milliseconds() / 1000.0 << " seconds to be delivered from " << delayPayloads[i]->getFrom()->toString() << "."; chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(std::string(s.str())), ChatWindow::DefaultDirection); } - boost::shared_ptr<SecurityLabel> label = message->getPayload<SecurityLabel>(); + std::shared_ptr<SecurityLabel> label = message->getPayload<SecurityLabel>(); // Determine the timestamp boost::posix_time::ptime timeStamp = boost::posix_time::microsec_clock::universal_time(); @@ -318,7 +317,7 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m fullMessageHighlight = highlighter_->findFirstFullMessageMatchAction(body, senderHighlightNameFromMessage(from)); } - boost::shared_ptr<Replace> replace = message->getPayload<Replace>(); + std::shared_ptr<Replace> replace = message->getPayload<Replace>(); bool senderIsSelf = isIncomingMessageFromMe(message); if (replace) { // Should check if the user has a previous message @@ -342,11 +341,11 @@ void ChatControllerBase::handleIncomingMessage(boost::shared_ptr<MessageEvent> m postHandleIncomingMessage(messageEvent, chatMessage); } -void ChatControllerBase::addMessageHandleIncomingMessage(const JID& from, const ChatWindow::ChatMessage& message, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& timeStamp) { +void ChatControllerBase::addMessageHandleIncomingMessage(const JID& from, const ChatWindow::ChatMessage& message, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& timeStamp) { lastMessagesUIID_[from] = addMessage(message, senderDisplayNameFromMessage(from), senderIsSelf, label, avatarManager_->getAvatarPath(from), timeStamp); } -std::string ChatControllerBase::getErrorMessage(boost::shared_ptr<ErrorPayload> error) { +std::string ChatControllerBase::getErrorMessage(std::shared_ptr<ErrorPayload> error) { std::string defaultMessage = QT_TRANSLATE_NOOP("", "Error sending message"); if (!error->getText().empty()) { return error->getText(); @@ -394,9 +393,9 @@ void ChatControllerBase::handleMUCInvitation(Message::ref message) { MUCInvitationPayload::ref invite = message->getPayload<MUCInvitationPayload>(); if (autoAcceptMUCInviteDecider_->isAutoAcceptedInvite(message->getFrom(), invite)) { - eventStream_->send(boost::make_shared<JoinMUCUIEvent>(invite->getJID(), boost::optional<std::string>(), boost::optional<std::string>(), false, false, true)); + eventStream_->send(std::make_shared<JoinMUCUIEvent>(invite->getJID(), boost::optional<std::string>(), boost::optional<std::string>(), false, false, true)); } else { - MUCInviteEvent::ref inviteEvent = boost::make_shared<MUCInviteEvent>(toJID_, invite->getJID(), invite->getReason(), invite->getPassword(), true, invite->getIsImpromptu()); + MUCInviteEvent::ref inviteEvent = std::make_shared<MUCInviteEvent>(toJID_, invite->getJID(), invite->getReason(), invite->getPassword(), true, invite->getIsImpromptu()); handleGeneralMUCInvitation(inviteEvent); } } @@ -413,7 +412,7 @@ void ChatControllerBase::handleMediatedMUCInvitation(Message::ref message) { password = *message->getPayload<MUCUserPayload>()->getPassword(); } - MUCInviteEvent::ref inviteEvent = boost::make_shared<MUCInviteEvent>(invite.from, from, reason, password, false, false); + MUCInviteEvent::ref inviteEvent = std::make_shared<MUCInviteEvent>(invite.from, from, reason, password, false, false); handleGeneralMUCInvitation(inviteEvent); } diff --git a/Swift/Controllers/Chat/ChatControllerBase.h b/Swift/Controllers/Chat/ChatControllerBase.h index bd8ba0f..2bdfe93 100644 --- a/Swift/Controllers/Chat/ChatControllerBase.h +++ b/Swift/Controllers/Chat/ChatControllerBase.h @@ -7,13 +7,13 @@ #pragma once #include <map> +#include <memory> #include <string> #include <vector> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/filesystem/path.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/IDGenerator.h> #include <Swiften/Base/boost_bsignals.h> @@ -53,9 +53,9 @@ namespace Swift { void showChatWindow(); void activateChatWindow(); bool hasOpenWindow() const; - virtual void setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info); - void handleIncomingMessage(boost::shared_ptr<MessageEvent> message); - std::string addMessage(const ChatWindow::ChatMessage& chatMessage, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const boost::filesystem::path& avatarPath, const boost::posix_time::ptime& time); + virtual void setAvailableServerFeatures(std::shared_ptr<DiscoInfo> info); + void handleIncomingMessage(std::shared_ptr<MessageEvent> message); + std::string addMessage(const ChatWindow::ChatMessage& chatMessage, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const boost::filesystem::path& avatarPath, const boost::posix_time::ptime& time); void replaceMessage(const ChatWindow::ChatMessage& chatMessage, const std::string& id, const boost::posix_time::ptime& time); virtual void setOnline(bool online); void setEnabled(bool enabled); @@ -72,24 +72,24 @@ namespace Swift { boost::signal<void(ChatWindow* /*window to reuse*/, const std::vector<JID>& /*invite people*/, const std::string& /*reason*/)> onConvertToMUC; protected: - ChatControllerBase(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &toJID, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsProvider* entityCapsProvider, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, boost::shared_ptr<ChatMessageParser> chatMessageParser, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider); + ChatControllerBase(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &toJID, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsProvider* entityCapsProvider, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, std::shared_ptr<ChatMessageParser> chatMessageParser, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider); /** * Pass the Message appended, and the stanza used to send it. */ - virtual void postSendMessage(const std::string&, boost::shared_ptr<Stanza>) {} + virtual void postSendMessage(const std::string&, std::shared_ptr<Stanza>) {} virtual std::string senderDisplayNameFromMessage(const JID& from) = 0; virtual std::string senderHighlightNameFromMessage(const JID& from) = 0; - virtual bool isIncomingMessageFromMe(boost::shared_ptr<Message>) = 0; - virtual void preHandleIncomingMessage(boost::shared_ptr<MessageEvent>) {} - virtual void addMessageHandleIncomingMessage(const JID& from, const ChatWindow::ChatMessage& message, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& time); - virtual void postHandleIncomingMessage(boost::shared_ptr<MessageEvent>, const ChatWindow::ChatMessage&) {} - virtual void preSendMessageRequest(boost::shared_ptr<Message>) {} + virtual bool isIncomingMessageFromMe(std::shared_ptr<Message>) = 0; + virtual void preHandleIncomingMessage(std::shared_ptr<MessageEvent>) {} + virtual void addMessageHandleIncomingMessage(const JID& from, const ChatWindow::ChatMessage& message, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& time); + virtual void postHandleIncomingMessage(std::shared_ptr<MessageEvent>, const ChatWindow::ChatMessage&) {} + virtual void preSendMessageRequest(std::shared_ptr<Message>) {} virtual bool isFromContact(const JID& from); - virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message>) const = 0; + virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(std::shared_ptr<Message>) const = 0; virtual void dayTicked() {} virtual void handleBareJIDCapsChanged(const JID& jid) = 0; - std::string getErrorMessage(boost::shared_ptr<ErrorPayload>); + std::string getErrorMessage(std::shared_ptr<ErrorPayload>); virtual void setContactIsReceivingPresence(bool /* isReceivingPresence */) {} virtual void cancelReplaces() = 0; /** JID any iq for account should go to - bare except for PMs */ @@ -105,7 +105,7 @@ namespace Swift { void handleSendMessageRequest(const std::string &body, bool isCorrectionMessage); void handleAllMessagesRead(); - void handleSecurityLabelsCatalogResponse(boost::shared_ptr<SecurityLabelsCatalog>, ErrorPayload::ref error); + void handleSecurityLabelsCatalogResponse(std::shared_ptr<SecurityLabelsCatalog>, ErrorPayload::ref error); void handleDayChangeTick(); void handleMUCInvitation(Message::ref message); void handleMediatedMUCInvitation(Message::ref message); @@ -114,8 +114,8 @@ namespace Swift { protected: JID selfJID_; - std::vector<boost::shared_ptr<StanzaEvent> > unreadMessages_; - std::vector<boost::shared_ptr<StanzaEvent> > targetedUnreadMessages_; + std::vector<std::shared_ptr<StanzaEvent> > unreadMessages_; + std::vector<std::shared_ptr<StanzaEvent> > targetedUnreadMessages_; StanzaChannel* stanzaChannel_; IQRouter* iqRouter_; ChatWindowFactory* chatWindowFactory_; @@ -127,14 +127,14 @@ namespace Swift { AvatarManager* avatarManager_; bool useDelayForLatency_; EventController* eventController_; - boost::shared_ptr<Timer> dateChangeTimer_; + std::shared_ptr<Timer> dateChangeTimer_; TimerFactory* timerFactory_; EntityCapsProvider* entityCapsProvider_; SecurityLabelsCatalog::Item lastLabel_; HistoryController* historyController_; MUCRegistry* mucRegistry_; Highlighter* highlighter_; - boost::shared_ptr<ChatMessageParser> chatMessageParser_; + std::shared_ptr<ChatMessageParser> chatMessageParser_; AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider_; UIEventStream* eventStream_; }; diff --git a/Swift/Controllers/Chat/ChatMessageParser.cpp b/Swift/Controllers/Chat/ChatMessageParser.cpp index 08e4fcd..c204371 100644 --- a/Swift/Controllers/Chat/ChatMessageParser.cpp +++ b/Swift/Controllers/Chat/ChatMessageParser.cpp @@ -6,11 +6,11 @@ #include <Swift/Controllers/Chat/ChatMessageParser.h> +#include <memory> #include <utility> #include <vector> #include <boost/algorithm/string.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Regex.h> #include <Swiften/Base/foreach.h> @@ -42,10 +42,10 @@ namespace Swift { else { if (i == links.second) { found = true; - parsedMessage.append(boost::make_shared<ChatWindow::ChatURIMessagePart>(part)); + parsedMessage.append(std::make_shared<ChatWindow::ChatURIMessagePart>(part)); } else { - parsedMessage.append(boost::make_shared<ChatWindow::ChatTextMessagePart>(part)); + parsedMessage.append(std::make_shared<ChatWindow::ChatTextMessagePart>(part)); } } } @@ -85,9 +85,9 @@ namespace Swift { boost::regex emoticonRegex(regexString); ChatWindow::ChatMessage newMessage; - foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, parsedMessage.getParts()) { - boost::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; - if ((textPart = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { + foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, parsedMessage.getParts()) { + std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; + if ((textPart = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { try { boost::match_results<std::string::const_iterator> match; const std::string& text = textPart->text; @@ -104,9 +104,9 @@ namespace Swift { std::string::const_iterator matchEnd = match[matchIndex].second; if (start != matchStart) { /* If we're skipping over plain text since the previous emoticon, record it as plain text */ - newMessage.append(boost::make_shared<ChatWindow::ChatTextMessagePart>(std::string(start, matchStart))); + newMessage.append(std::make_shared<ChatWindow::ChatTextMessagePart>(std::string(start, matchStart))); } - boost::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart = boost::make_shared<ChatWindow::ChatEmoticonMessagePart>(); + std::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart = std::make_shared<ChatWindow::ChatEmoticonMessagePart>(); std::string matchString = match[matchIndex].str(); std::map<std::string, std::string>::const_iterator emoticonIterator = emoticons_.find(matchString); assert (emoticonIterator != emoticons_.end()); @@ -118,7 +118,7 @@ namespace Swift { } if (start != text.end()) { /* If there's plain text after the last emoticon, record it */ - newMessage.append(boost::make_shared<ChatWindow::ChatTextMessagePart>(std::string(start, text.end()))); + newMessage.append(std::make_shared<ChatWindow::ChatTextMessagePart>(std::string(start, text.end()))); } } @@ -153,9 +153,9 @@ namespace Swift { const std::vector<boost::regex> keywordRegex = rule.getKeywordRegex(nick); foreach(const boost::regex& regex, keywordRegex) { ChatWindow::ChatMessage newMessage; - foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, parsedMessage.getParts()) { - boost::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; - if ((textPart = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { + foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, parsedMessage.getParts()) { + std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; + if ((textPart = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { try { boost::match_results<std::string::const_iterator> match; const std::string& text = textPart->text; @@ -165,9 +165,9 @@ namespace Swift { std::string::const_iterator matchEnd = match[0].second; if (start != matchStart) { /* If we're skipping over plain text since the previous emoticon, record it as plain text */ - newMessage.append(boost::make_shared<ChatWindow::ChatTextMessagePart>(std::string(start, matchStart))); + newMessage.append(std::make_shared<ChatWindow::ChatTextMessagePart>(std::string(start, matchStart))); } - boost::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart = boost::make_shared<ChatWindow::ChatHighlightingMessagePart>(); + std::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart = std::make_shared<ChatWindow::ChatHighlightingMessagePart>(); highlightPart->text = match.str(); highlightPart->action = rule.getAction(); newMessage.append(highlightPart); @@ -175,7 +175,7 @@ namespace Swift { } if (start != text.end()) { /* If there's plain text after the last emoticon, record it */ - newMessage.append(boost::make_shared<ChatWindow::ChatTextMessagePart>(std::string(start, text.end()))); + newMessage.append(std::make_shared<ChatWindow::ChatTextMessagePart>(std::string(start, text.end()))); } } catch (std::runtime_error) { diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 7a52d9b..ffca925 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -6,6 +6,8 @@ #include <Swift/Controllers/Chat/ChatsManager.h> +#include <memory> + #include <boost/algorithm/string.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/text_oarchive.hpp> @@ -15,7 +17,6 @@ #include <boost/serialization/split_free.hpp> #include <boost/serialization/string.hpp> #include <boost/serialization/vector.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Avatars/AvatarManager.h> #include <Swiften/Base/Log.h> @@ -155,7 +156,7 @@ ChatsManager::ChatsManager( nickResolver_ = nickResolver; presenceOracle_ = presenceOracle; avatarManager_ = nullptr; - serverDiscoInfo_ = boost::make_shared<DiscoInfo>(); + serverDiscoInfo_ = std::make_shared<DiscoInfo>(); presenceSender_ = presenceSender; uiEventStream_ = uiEventStream; mucBookmarkManager_ = nullptr; @@ -544,24 +545,24 @@ void ChatsManager::finalizeImpromptuJoin(MUC::ref muc, const std::vector<JID>& j } } -void ChatsManager::handleUIEvent(boost::shared_ptr<UIEvent> event) { - boost::shared_ptr<RequestChatUIEvent> chatEvent = boost::dynamic_pointer_cast<RequestChatUIEvent>(event); +void ChatsManager::handleUIEvent(std::shared_ptr<UIEvent> event) { + std::shared_ptr<RequestChatUIEvent> chatEvent = std::dynamic_pointer_cast<RequestChatUIEvent>(event); if (chatEvent) { handleChatRequest(chatEvent->getContact()); return; } - boost::shared_ptr<RemoveMUCBookmarkUIEvent> removeMUCBookmarkEvent = boost::dynamic_pointer_cast<RemoveMUCBookmarkUIEvent>(event); + std::shared_ptr<RemoveMUCBookmarkUIEvent> removeMUCBookmarkEvent = std::dynamic_pointer_cast<RemoveMUCBookmarkUIEvent>(event); if (removeMUCBookmarkEvent) { mucBookmarkManager_->removeBookmark(removeMUCBookmarkEvent->getBookmark()); return; } - boost::shared_ptr<AddMUCBookmarkUIEvent> addMUCBookmarkEvent = boost::dynamic_pointer_cast<AddMUCBookmarkUIEvent>(event); + std::shared_ptr<AddMUCBookmarkUIEvent> addMUCBookmarkEvent = std::dynamic_pointer_cast<AddMUCBookmarkUIEvent>(event); if (addMUCBookmarkEvent) { mucBookmarkManager_->addBookmark(addMUCBookmarkEvent->getBookmark()); return; } - boost::shared_ptr<CreateImpromptuMUCUIEvent> createImpromptuMUCEvent = boost::dynamic_pointer_cast<CreateImpromptuMUCUIEvent>(event); + std::shared_ptr<CreateImpromptuMUCUIEvent> createImpromptuMUCEvent = std::dynamic_pointer_cast<CreateImpromptuMUCUIEvent>(event); if (createImpromptuMUCEvent) { assert(!localMUCServiceJID_.toString().empty()); // create new muc @@ -573,15 +574,15 @@ void ChatsManager::handleUIEvent(boost::shared_ptr<UIEvent> event) { mucControllers_[roomJID]->activateChatWindow(); } - boost::shared_ptr<EditMUCBookmarkUIEvent> editMUCBookmarkEvent = boost::dynamic_pointer_cast<EditMUCBookmarkUIEvent>(event); + std::shared_ptr<EditMUCBookmarkUIEvent> editMUCBookmarkEvent = std::dynamic_pointer_cast<EditMUCBookmarkUIEvent>(event); if (editMUCBookmarkEvent) { mucBookmarkManager_->replaceBookmark(editMUCBookmarkEvent->getOldBookmark(), editMUCBookmarkEvent->getNewBookmark()); } - else if (JoinMUCUIEvent::ref joinEvent = boost::dynamic_pointer_cast<JoinMUCUIEvent>(event)) { + else if (JoinMUCUIEvent::ref joinEvent = std::dynamic_pointer_cast<JoinMUCUIEvent>(event)) { handleJoinMUCRequest(joinEvent->getJID(), joinEvent->getPassword(), joinEvent->getNick(), joinEvent->getShouldJoinAutomatically(), joinEvent->getCreateAsReservedRoomIfNew(), joinEvent->isImpromptu()); mucControllers_[joinEvent->getJID()]->activateChatWindow(); } - else if (boost::shared_ptr<RequestJoinMUCUIEvent> joinEvent = boost::dynamic_pointer_cast<RequestJoinMUCUIEvent>(event)) { + else if (std::shared_ptr<RequestJoinMUCUIEvent> joinEvent = std::dynamic_pointer_cast<RequestJoinMUCUIEvent>(event)) { if (!joinMUCWindow_) { joinMUCWindow_ = joinMUCWindowFactory_->createJoinMUCWindow(uiEventStream_); joinMUCWindow_->onSearchMUC.connect(boost::bind(&ChatsManager::handleSearchMUCRequest, this)); @@ -619,7 +620,7 @@ void ChatsManager::handleTransformChatToMUC(ChatController* chatController, Chat /** * If a resource goes offline, release bound chatdialog to that resource. */ -void ChatsManager::handlePresenceChange(boost::shared_ptr<Presence> newPresence) { +void ChatsManager::handlePresenceChange(std::shared_ptr<Presence> newPresence) { if (mucRegistry_->isMUC(newPresence->getFrom().toBare())) return; foreach (ChatListWindow::Chat& chat, recentChats_) { @@ -663,7 +664,7 @@ void ChatsManager::handleAvatarChanged(const JID& jid) { } } -void ChatsManager::setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info) { +void ChatsManager::setServerDiscoInfo(std::shared_ptr<DiscoInfo> info) { serverDiscoInfo_ = info; foreach (JIDChatControllerPair pair, chatControllers_) { pair.second->setAvailableServerFeatures(info); @@ -691,7 +692,7 @@ void ChatsManager::setOnline(bool enabled) { } else { setupBookmarks(); localMUCServiceJID_ = JID(); - localMUCServiceFinderWalker_ = boost::make_shared<DiscoServiceWalker>(jid_.getDomain(), iqRouter_); + localMUCServiceFinderWalker_ = std::make_shared<DiscoServiceWalker>(jid_.getDomain(), iqRouter_); localMUCServiceFinderWalker_->onServiceFound.connect(boost::bind(&ChatsManager::handleLocalServiceFound, this, _1, _2)); localMUCServiceFinderWalker_->onWalkAborted.connect(boost::bind(&ChatsManager::handleLocalServiceWalkFinished, this)); localMUCServiceFinderWalker_->onWalkComplete.connect(boost::bind(&ChatsManager::handleLocalServiceWalkFinished, this)); @@ -723,7 +724,7 @@ ChatController* ChatsManager::getChatControllerOrFindAnother(const JID &contact) ChatController* ChatsManager::createNewChatController(const JID& contact) { assert(chatControllers_.find(contact) == chatControllers_.end()); - boost::shared_ptr<ChatMessageParser> chatMessageParser = boost::make_shared<ChatMessageParser>(emoticons_, highlightManager_->getRules(), false); /* a message parser that knows this is a chat (not a room/MUC) */ + std::shared_ptr<ChatMessageParser> chatMessageParser = std::make_shared<ChatMessageParser>(emoticons_, highlightManager_->getRules(), false); /* a message parser that knows this is a chat (not a room/MUC) */ ChatController* controller = new ChatController(jid_, stanzaChannel_, iqRouter_, chatWindowFactory_, contact, nickResolver_, presenceOracle_, avatarManager_, mucRegistry_->isMUC(contact.toBare()), useDelayForLatency_, uiEventStream_, eventController_, timerFactory_, entityCapsProvider_, userWantsReceipts_, settings_, historyController_, mucRegistry_, highlightManager_, clientBlockListManager_, chatMessageParser, autoAcceptMUCInviteDecider_); chatControllers_[contact] = controller; controller->setAvailableServerFeatures(serverDiscoInfo_); @@ -812,7 +813,7 @@ MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::opti if (reuseChatwindow) { chatWindowFactoryAdapter = new SingleChatWindowFactoryAdapter(reuseChatwindow); } - boost::shared_ptr<ChatMessageParser> chatMessageParser = boost::make_shared<ChatMessageParser>(emoticons_, highlightManager_->getRules(), true); /* a message parser that knows this is a room/MUC (not a chat) */ + std::shared_ptr<ChatMessageParser> chatMessageParser = std::make_shared<ChatMessageParser>(emoticons_, highlightManager_->getRules(), true); /* a message parser that knows this is a room/MUC (not a chat) */ controller = new MUCController(jid_, muc, password, nick, stanzaChannel_, iqRouter_, reuseChatwindow ? chatWindowFactoryAdapter : chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory_, eventController_, entityCapsProvider_, roster_, historyController_, mucRegistry_, highlightManager_, clientBlockListManager_, chatMessageParser, isImpromptu, autoAcceptMUCInviteDecider_, vcardManager_, mucBookmarkManager_); if (chatWindowFactoryAdapter) { /* The adapters are only passed to chat windows, which are deleted in their @@ -866,9 +867,9 @@ void ChatsManager::handleUserNicknameChanged(MUCController* mucController, const } } -void ChatsManager::handleIncomingMessage(boost::shared_ptr<Message> message) { +void ChatsManager::handleIncomingMessage(std::shared_ptr<Message> message) { JID jid = message->getFrom(); - boost::shared_ptr<MessageEvent> event(new MessageEvent(message)); + std::shared_ptr<MessageEvent> event(new MessageEvent(message)); bool isInvite = !!message->getPayload<MUCInvitationPayload>(); bool isMediatedInvite = (message->getPayload<MUCUserPayload>() && message->getPayload<MUCUserPayload>()->getInvite()); if (isMediatedInvite) { @@ -937,7 +938,7 @@ void ChatsManager::handleMUCSelectedAfterSearch(const JID& muc) { } void ChatsManager::handleMUCBookmarkActivated(const MUCBookmark& mucBookmark) { - uiEventStream_->send(boost::make_shared<JoinMUCUIEvent>(mucBookmark.getRoom(), mucBookmark.getPassword(), mucBookmark.getNick())); + uiEventStream_->send(std::make_shared<JoinMUCUIEvent>(mucBookmark.getRoom(), mucBookmark.getPassword(), mucBookmark.getNick())); } void ChatsManager::handleNewFileTransferController(FileTransferController* ftc) { @@ -945,7 +946,7 @@ void ChatsManager::handleNewFileTransferController(FileTransferController* ftc) chatController->handleNewFileTransferController(ftc); chatController->activateChatWindow(); if (ftc->isIncoming()) { - eventController_->handleIncomingEvent(boost::make_shared<IncomingFileTransferEvent>(ftc->getOtherParty())); + eventController_->handleIncomingEvent(std::make_shared<IncomingFileTransferEvent>(ftc->getOtherParty())); } } @@ -979,18 +980,18 @@ void ChatsManager::handleRecentActivated(const ChatListWindow::Chat& chat) { foreach(StringJIDPair pair, chat.impromptuJIDs) { inviteJIDs.push_back(pair.second); } - uiEventStream_->send(boost::make_shared<CreateImpromptuMUCUIEvent>(inviteJIDs, chat.jid, "")); + uiEventStream_->send(std::make_shared<CreateImpromptuMUCUIEvent>(inviteJIDs, chat.jid, "")); } else if (chat.isMUC) { /* FIXME: This means that recents requiring passwords will just flat-out not work */ - uiEventStream_->send(boost::make_shared<JoinMUCUIEvent>(chat.jid, boost::optional<std::string>(), chat.nick)); + uiEventStream_->send(std::make_shared<JoinMUCUIEvent>(chat.jid, boost::optional<std::string>(), chat.nick)); } else { - uiEventStream_->send(boost::make_shared<RequestChatUIEvent>(chat.jid)); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(chat.jid)); } } -void ChatsManager::handleLocalServiceFound(const JID& service, boost::shared_ptr<DiscoInfo> info) { +void ChatsManager::handleLocalServiceFound(const JID& service, std::shared_ptr<DiscoInfo> info) { foreach (DiscoInfo::Identity identity, info->getIdentities()) { if ((identity.getCategory() == "directory" && identity.getType() == "chatroom") @@ -1023,7 +1024,7 @@ std::vector<Contact::ref> Swift::ChatsManager::getContacts(bool withMUCNicks) { std::vector<Contact::ref> result; foreach (ChatListWindow::Chat chat, recentChats_) { if (!chat.isMUC) { - result.push_back(boost::make_shared<Contact>(chat.chatName.empty() ? chat.jid.toString() : chat.chatName, chat.jid, chat.statusType, chat.avatarPath)); + result.push_back(std::make_shared<Contact>(chat.chatName.empty() ? chat.jid.toString() : chat.chatName, chat.jid, chat.statusType, chat.avatarPath)); } } if (withMUCNicks) { @@ -1037,7 +1038,7 @@ std::vector<Contact::ref> Swift::ChatsManager::getContacts(bool withMUCNicks) { const JID nickJID = JID(mucJID.getNode(), mucJID.getDomain(), participant.first); Presence::ref presence = presenceOracle_->getLastPresence(nickJID); const boost::filesystem::path avatar = avatarManager_->getAvatarPath(nickJID); - result.push_back(boost::make_shared<Contact>(participant.first, JID(), presence->getShow(), avatar)); + result.push_back(std::make_shared<Contact>(participant.first, JID(), presence->getShow(), avatar)); } } } diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h index fa6ab3a..1b97be8 100644 --- a/Swift/Controllers/Chat/ChatsManager.h +++ b/Swift/Controllers/Chat/ChatsManager.h @@ -7,10 +7,9 @@ #pragma once #include <map> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/IDGenerator.h> #include <Swiften/Elements/DiscoInfo.h> #include <Swiften/Elements/Message.h> @@ -67,8 +66,8 @@ namespace Swift { virtual ~ChatsManager(); void setAvatarManager(AvatarManager* avatarManager); void setOnline(bool enabled); - void setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info); - void handleIncomingMessage(boost::shared_ptr<Message> message); + void setServerDiscoInfo(std::shared_ptr<DiscoInfo> info); + void handleIncomingMessage(std::shared_ptr<Message> message); std::vector<ChatListWindow::Chat> getRecentChats() const; virtual std::vector<Contact::ref> getContacts(bool withMUCNicks); @@ -93,8 +92,8 @@ namespace Swift { void handleSearchMUCRequest(); void handleMUCSelectedAfterSearch(const JID&); void rebindControllerJID(const JID& from, const JID& to); - void handlePresenceChange(boost::shared_ptr<Presence> newPresence); - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handlePresenceChange(std::shared_ptr<Presence> newPresence); + void handleUIEvent(std::shared_ptr<UIEvent> event); void handleMUCBookmarkAdded(const MUCBookmark& bookmark); void handleMUCBookmarkRemoved(const MUCBookmark& bookmark); void handleUserLeftMUC(MUCController* mucController); @@ -126,7 +125,7 @@ namespace Swift { void markAllRecentsOffline(); void handleTransformChatToMUC(ChatController* chatController, ChatWindow* chatWindow, const std::vector<JID>& jidsToInvite, const std::string& reason); - void handleLocalServiceFound(const JID& service, boost::shared_ptr<DiscoInfo> info); + void handleLocalServiceFound(const JID& service, std::shared_ptr<DiscoInfo> info); void handleLocalServiceWalkFinished(); void updatePresenceReceivingStateOnChatController(const JID&); @@ -154,7 +153,7 @@ namespace Swift { PresenceSender* presenceSender_; UIEventStream* uiEventStream_; MUCBookmarkManager* mucBookmarkManager_; - boost::shared_ptr<DiscoInfo> serverDiscoInfo_; + std::shared_ptr<DiscoInfo> serverDiscoInfo_; ChatListWindow* chatListWindow_; JoinMUCWindow* joinMUCWindow_; boost::bsignals::scoped_connection uiEventConnection_; @@ -177,7 +176,7 @@ namespace Swift { std::map<std::string, std::string> emoticons_; ClientBlockListManager* clientBlockListManager_; JID localMUCServiceJID_; - boost::shared_ptr<DiscoServiceWalker> localMUCServiceFinderWalker_; + std::shared_ptr<DiscoServiceWalker> localMUCServiceFinderWalker_; AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider_; IDGenerator idGenerator_; VCardManager* vcardManager_; diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp index 66a655c..9ae3845 100644 --- a/Swift/Controllers/Chat/MUCController.cpp +++ b/Swift/Controllers/Chat/MUCController.cpp @@ -91,7 +91,7 @@ MUCController::MUCController ( MUCRegistry* mucRegistry, HighlightManager* highlightManager, ClientBlockListManager* clientBlockListManager, - boost::shared_ptr<ChatMessageParser> chatMessageParser, + std::shared_ptr<ChatMessageParser> chatMessageParser, bool isImpromptu, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider, VCardManager* vcardManager, @@ -135,7 +135,7 @@ MUCController::MUCController ( highlighter_->setMode(isImpromptu_ ? Highlighter::ChatMode : Highlighter::MUCMode); highlighter_->setNick(nick_); if (timerFactory && stanzaChannel_->isAvailable()) { - loginCheckTimer_ = boost::shared_ptr<Timer>(timerFactory->createTimer(MUC_JOIN_WARNING_TIMEOUT_MILLISECONDS)); + loginCheckTimer_ = std::shared_ptr<Timer>(timerFactory->createTimer(MUC_JOIN_WARNING_TIMEOUT_MILLISECONDS)); loginCheckTimer_->onTick.connect(boost::bind(&MUCController::handleJoinTimeoutTick, this)); loginCheckTimer_->start(); } @@ -230,8 +230,8 @@ void MUCController::handleActionRequestedOnOccupant(ChatWindow::OccupantAction a case ChatWindow::MakeModerator: muc_->changeOccupantRole(mucJID, MUCOccupant::Moderator);break; case ChatWindow::MakeParticipant: muc_->changeOccupantRole(mucJID, MUCOccupant::Participant);break; case ChatWindow::MakeVisitor: muc_->changeOccupantRole(mucJID, MUCOccupant::Visitor);break; - case ChatWindow::AddContact: if (occupant.getRealJID()) events_->send(boost::make_shared<RequestAddUserDialogUIEvent>(realJID, occupant.getNick()));break; - case ChatWindow::ShowProfile: events_->send(boost::make_shared<ShowProfileForRosterItemUIEvent>(mucJID));break; + case ChatWindow::AddContact: if (occupant.getRealJID()) events_->send(std::make_shared<RequestAddUserDialogUIEvent>(realJID, occupant.getNick()));break; + case ChatWindow::ShowProfile: events_->send(std::make_shared<ShowProfileForRosterItemUIEvent>(mucJID));break; } } @@ -325,7 +325,7 @@ void MUCController::receivedActivity() { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wswitch-enum" -void MUCController::handleJoinFailed(boost::shared_ptr<ErrorPayload> error) { +void MUCController::handleJoinFailed(std::shared_ptr<ErrorPayload> error) { receivedActivity(); std::string errorMessage = QT_TRANSLATE_NOOP("", "Unable to enter this room"); std::string rejoinNick; @@ -529,18 +529,18 @@ JID MUCController::nickToJID(const std::string& nick) { return muc_->getJID().withResource(nick); } -bool MUCController::messageTargetsMe(boost::shared_ptr<Message> message) { +bool MUCController::messageTargetsMe(std::shared_ptr<Message> message) { std::string stringRegexp(".*\\b" + boost::to_lower_copy(nick_) + "\\b.*"); boost::regex myRegexp(stringRegexp); return boost::regex_match(boost::to_lower_copy(message->getBody().get_value_or("")), myRegexp); } -void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent) { +void MUCController::preHandleIncomingMessage(std::shared_ptr<MessageEvent> messageEvent) { if (messageEvent->getStanza()->getType() == Message::Groupchat) { lastActivity_ = boost::posix_time::microsec_clock::universal_time(); } clearPresenceQueue(); - boost::shared_ptr<Message> message = messageEvent->getStanza(); + std::shared_ptr<Message> message = messageEvent->getStanza(); if (joined_ && messageEvent->getStanza()->getFrom().getResource() != nick_ && messageTargetsMe(message) && !message->getPayload<Delay>() && messageEvent->isReadable()) { chatWindow_->flash(); } @@ -576,7 +576,7 @@ void MUCController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> mes } } -void MUCController::addMessageHandleIncomingMessage(const JID& from, const ChatWindow::ChatMessage& message, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& time) { +void MUCController::addMessageHandleIncomingMessage(const JID& from, const ChatWindow::ChatMessage& message, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& time) { if (from.isBare()) { chatWindow_->addSystemMessage(message, ChatWindow::DefaultDirection); } @@ -585,8 +585,8 @@ void MUCController::addMessageHandleIncomingMessage(const JID& from, const ChatW } } -void MUCController::postHandleIncomingMessage(boost::shared_ptr<MessageEvent> messageEvent, const ChatWindow::ChatMessage& chatMessage) { - boost::shared_ptr<Message> message = messageEvent->getStanza(); +void MUCController::postHandleIncomingMessage(std::shared_ptr<MessageEvent> messageEvent, const ChatWindow::ChatMessage& chatMessage) { + std::shared_ptr<Message> message = messageEvent->getStanza(); if (joined_ && messageEvent->getStanza()->getFrom().getResource() != nick_ && !message->getPayload<Delay>()) { if (messageTargetsMe(message) || isImpromptu_) { eventController_->handleIncomingEvent(messageEvent); @@ -646,7 +646,7 @@ void MUCController::setOnline(bool online) { } else { if (shouldJoinOnReconnect_) { renameCounter_ = 0; - boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); + std::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); if (blockList && blockList->isBlocked(muc_->getJID())) { handleBlockingStateChanged(); lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(QT_TRANSLATE_NOOP("", "You've blocked this room. To enter the room, first unblock it using the cog menu and try again")), ChatWindow::DefaultDirection); @@ -788,12 +788,12 @@ void MUCController::handleOccupantNicknameChanged(const std::string& oldNickname onUserNicknameChanged(oldNickname, newNickname); } -void MUCController::handleOccupantPresenceChange(boost::shared_ptr<Presence> presence) { +void MUCController::handleOccupantPresenceChange(std::shared_ptr<Presence> presence) { receivedActivity(); roster_->applyOnItems(SetPresence(presence, JID::WithResource)); } -bool MUCController::isIncomingMessageFromMe(boost::shared_ptr<Message> message) { +bool MUCController::isIncomingMessageFromMe(std::shared_ptr<Message> message) { JID from = message->getFrom(); return nick_ == from.getResource(); } @@ -806,11 +806,11 @@ std::string MUCController::senderDisplayNameFromMessage(const JID& from) { return from.getResource(); } -void MUCController::preSendMessageRequest(boost::shared_ptr<Message> message) { +void MUCController::preSendMessageRequest(std::shared_ptr<Message> message) { message->setType(Swift::Message::Groupchat); } -boost::optional<boost::posix_time::ptime> MUCController::getMessageTimestamp(boost::shared_ptr<Message> message) const { +boost::optional<boost::posix_time::ptime> MUCController::getMessageTimestamp(std::shared_ptr<Message> message) const { return message->getTimestampFrom(toJID_); } @@ -994,12 +994,12 @@ void MUCController::handleDestroyRoomRequest() { void MUCController::handleInvitePersonToThisMUCRequest(const std::vector<JID>& jidsToInvite) { RequestInviteToMUCUIEvent::ImpromptuMode mode = isImpromptu_ ? RequestInviteToMUCUIEvent::Impromptu : RequestInviteToMUCUIEvent::NotImpromptu; - boost::shared_ptr<UIEvent> event(new RequestInviteToMUCUIEvent(muc_->getJID(), jidsToInvite, mode)); + std::shared_ptr<UIEvent> event(new RequestInviteToMUCUIEvent(muc_->getJID(), jidsToInvite, mode)); eventStream_->send(event); } -void MUCController::handleUIEvent(boost::shared_ptr<UIEvent> event) { - boost::shared_ptr<InviteToMUCUIEvent> inviteEvent = boost::dynamic_pointer_cast<InviteToMUCUIEvent>(event); +void MUCController::handleUIEvent(std::shared_ptr<UIEvent> event) { + std::shared_ptr<InviteToMUCUIEvent> inviteEvent = std::dynamic_pointer_cast<InviteToMUCUIEvent>(event); if (inviteEvent && inviteEvent->getRoom() == muc_->getJID()) { foreach (const JID& jid, inviteEvent->getInvites()) { muc_->invitePerson(jid, inviteEvent->getReason(), isImpromptu_); @@ -1031,11 +1031,11 @@ void MUCController::handleChangeAffiliationsRequest(const std::vector<std::pair< } void MUCController::handleUnblockUserRequest() { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, muc_->getJID())); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, muc_->getJID())); } void MUCController::handleBlockingStateChanged() { - boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); + std::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); if (blockList->getState() == BlockList::Available) { if (blockList->isBlocked(toJID_)) { if (!blockedContactAlert_) { @@ -1074,11 +1074,11 @@ void MUCController::addRecentLogs() { bool senderIsSelf = nick_ == message.getFromJID().getResource(); // the chatWindow uses utc timestamps - addMessage(chatMessageParser_->parseMessageBody(message.getMessage()), senderDisplayNameFromMessage(message.getFromJID()), senderIsSelf, boost::shared_ptr<SecurityLabel>(new SecurityLabel()), avatarManager_->getAvatarPath(message.getFromJID()), message.getTime() - boost::posix_time::hours(message.getOffset())); + addMessage(chatMessageParser_->parseMessageBody(message.getMessage()), senderDisplayNameFromMessage(message.getFromJID()), senderIsSelf, std::make_shared<SecurityLabel>(), avatarManager_->getAvatarPath(message.getFromJID()), message.getTime() - boost::posix_time::hours(message.getOffset())); } } -void MUCController::checkDuplicates(boost::shared_ptr<Message> newMessage) { +void MUCController::checkDuplicates(std::shared_ptr<Message> newMessage) { std::string body = newMessage->getBody().get_value_or(""); JID jid = newMessage->getFrom(); boost::optional<boost::posix_time::ptime> time = newMessage->getTimestamp(); @@ -1109,26 +1109,26 @@ void MUCController::setNick(const std::string& nick) { } Form::ref MUCController::buildImpromptuRoomConfiguration(Form::ref roomConfigurationForm) { - Form::ref result = boost::make_shared<Form>(Form::SubmitType); + Form::ref result = std::make_shared<Form>(Form::SubmitType); std::string impromptuConfigs[] = { "muc#roomconfig_enablelogging", "muc#roomconfig_persistentroom", "muc#roomconfig_publicroom", "muc#roomconfig_whois"}; std::set<std::string> impromptuConfigsMissing(impromptuConfigs, impromptuConfigs + 4); - foreach (boost::shared_ptr<FormField> field, roomConfigurationForm->getFields()) { - boost::shared_ptr<FormField> resultField; + foreach (std::shared_ptr<FormField> field, roomConfigurationForm->getFields()) { + std::shared_ptr<FormField> resultField; if (field->getName() == "muc#roomconfig_enablelogging") { - resultField = boost::make_shared<FormField>(FormField::BooleanType, "0"); + resultField = std::make_shared<FormField>(FormField::BooleanType, "0"); } if (field->getName() == "muc#roomconfig_persistentroom") { - resultField = boost::make_shared<FormField>(FormField::BooleanType, "0"); + resultField = std::make_shared<FormField>(FormField::BooleanType, "0"); } if (field->getName() == "muc#roomconfig_publicroom") { - resultField = boost::make_shared<FormField>(FormField::BooleanType, "0"); + resultField = std::make_shared<FormField>(FormField::BooleanType, "0"); } if (field->getName() == "muc#roomconfig_whois") { - resultField = boost::make_shared<FormField>(FormField::ListSingleType, "anyone"); + resultField = std::make_shared<FormField>(FormField::ListSingleType, "anyone"); } if (field->getName() == "FORM_TYPE") { - resultField = boost::make_shared<FormField>(FormField::HiddenType, "http://jabber.org/protocol/muc#roomconfig"); + resultField = std::make_shared<FormField>(FormField::HiddenType, "http://jabber.org/protocol/muc#roomconfig"); } if (resultField) { @@ -1177,10 +1177,10 @@ void MUCController::handleRoomUnlocked() { } } -void MUCController::setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) { +void MUCController::setAvailableServerFeatures(std::shared_ptr<DiscoInfo> info) { ChatControllerBase::setAvailableServerFeatures(info); if (iqRouter_->isAvailable() && info->hasFeature(DiscoInfo::BlockingCommandFeature)) { - boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); + std::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); blockingOnStateChangedConnection_ = blockList->onStateChanged.connect(boost::bind(&MUCController::handleBlockingStateChanged, this)); blockingOnItemAddedConnection_ = blockList->onItemAdded.connect(boost::bind(&MUCController::handleBlockingStateChanged, this)); diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h index 3a61952..b2e2698 100644 --- a/Swift/Controllers/Chat/MUCController.h +++ b/Swift/Controllers/Chat/MUCController.h @@ -7,10 +7,10 @@ #pragma once #include <map> +#include <memory> #include <set> #include <string> -#include <boost/shared_ptr.hpp> #include <boost/signals/connection.hpp> #include <Swiften/Base/Override.h> @@ -54,14 +54,14 @@ namespace Swift { class MUCController : public ChatControllerBase { public: - MUCController(const JID& self, MUC::ref muc, const boost::optional<std::string>& password, const std::string &nick, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager, UIEventStream* events, bool useDelayForLatency, TimerFactory* timerFactory, EventController* eventController, EntityCapsProvider* entityCapsProvider, XMPPRoster* roster, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, ClientBlockListManager* clientBlockListManager, boost::shared_ptr<ChatMessageParser> chatMessageParser, bool isImpromptu, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider, VCardManager* vcardManager, MUCBookmarkManager* mucBookmarkManager); + MUCController(const JID& self, MUC::ref muc, const boost::optional<std::string>& password, const std::string &nick, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, PresenceOracle* presenceOracle, AvatarManager* avatarManager, UIEventStream* events, bool useDelayForLatency, TimerFactory* timerFactory, EventController* eventController, EntityCapsProvider* entityCapsProvider, XMPPRoster* roster, HistoryController* historyController, MUCRegistry* mucRegistry, HighlightManager* highlightManager, ClientBlockListManager* clientBlockListManager, std::shared_ptr<ChatMessageParser> chatMessageParser, bool isImpromptu, AutoAcceptMUCInviteDecider* autoAcceptMUCInviteDecider, VCardManager* vcardManager, MUCBookmarkManager* mucBookmarkManager); virtual ~MUCController(); boost::signal<void ()> onUserLeft; boost::signal<void ()> onUserJoined; boost::signal<void ()> onImpromptuConfigCompleted; boost::signal<void (const std::string&, const std::string& )> onUserNicknameChanged; virtual void setOnline(bool online) SWIFTEN_OVERRIDE; - virtual void setAvailableServerFeatures(boost::shared_ptr<DiscoInfo> info) SWIFTEN_OVERRIDE; + virtual void setAvailableServerFeatures(std::shared_ptr<DiscoInfo> info) SWIFTEN_OVERRIDE; void rejoin(); static void appendToJoinParts(std::vector<NickJoinPart>& joinParts, const NickJoinPart& newEvent); static std::string generateJoinPartString(const std::vector<NickJoinPart>& joinParts, bool isImpromptu); @@ -75,14 +75,14 @@ namespace Swift { void sendInvites(const std::vector<JID>& jids, const std::string& reason) const; protected: - virtual void preSendMessageRequest(boost::shared_ptr<Message> message) SWIFTEN_OVERRIDE; - virtual bool isIncomingMessageFromMe(boost::shared_ptr<Message> message) SWIFTEN_OVERRIDE; + virtual void preSendMessageRequest(std::shared_ptr<Message> message) SWIFTEN_OVERRIDE; + virtual bool isIncomingMessageFromMe(std::shared_ptr<Message> message) SWIFTEN_OVERRIDE; virtual std::string senderHighlightNameFromMessage(const JID& from) SWIFTEN_OVERRIDE; virtual std::string senderDisplayNameFromMessage(const JID& from) SWIFTEN_OVERRIDE; - virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(boost::shared_ptr<Message> message) const SWIFTEN_OVERRIDE; - virtual void preHandleIncomingMessage(boost::shared_ptr<MessageEvent>) SWIFTEN_OVERRIDE; - virtual void addMessageHandleIncomingMessage(const JID& from, const ChatWindow::ChatMessage& message, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; - virtual void postHandleIncomingMessage(boost::shared_ptr<MessageEvent>, const ChatWindow::ChatMessage& chatMessage) SWIFTEN_OVERRIDE; + virtual boost::optional<boost::posix_time::ptime> getMessageTimestamp(std::shared_ptr<Message> message) const SWIFTEN_OVERRIDE; + virtual void preHandleIncomingMessage(std::shared_ptr<MessageEvent>) SWIFTEN_OVERRIDE; + virtual void addMessageHandleIncomingMessage(const JID& from, const ChatWindow::ChatMessage& message, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; + virtual void postHandleIncomingMessage(std::shared_ptr<MessageEvent>, const ChatWindow::ChatMessage& chatMessage) SWIFTEN_OVERRIDE; virtual void cancelReplaces() SWIFTEN_OVERRIDE; virtual void logMessage(const std::string& message, const JID& fromJID, const JID& toJID, const boost::posix_time::ptime& timeStamp, bool isIncoming) SWIFTEN_OVERRIDE; @@ -97,11 +97,11 @@ namespace Swift { void handleOccupantJoined(const MUCOccupant& occupant); void handleOccupantNicknameChanged(const std::string& oldNickname, const std::string& newNickname); void handleOccupantLeft(const MUCOccupant& occupant, MUC::LeavingType type, const std::string& reason); - void handleOccupantPresenceChange(boost::shared_ptr<Presence> presence); + void handleOccupantPresenceChange(std::shared_ptr<Presence> presence); void handleOccupantRoleChanged(const std::string& nick, const MUCOccupant& occupant,const MUCOccupant::Role& oldRole); void handleOccupantAffiliationChanged(const std::string& nick, const MUCOccupant::Affiliation& affiliation,const MUCOccupant::Affiliation& oldAffiliation); void handleJoinComplete(const std::string& nick); - void handleJoinFailed(boost::shared_ptr<ErrorPayload> error); + void handleJoinFailed(std::shared_ptr<ErrorPayload> error); void handleJoinTimeoutTick(); void handleChangeSubjectRequest(const std::string&); void handleBookmarkRequest(); @@ -110,7 +110,7 @@ namespace Swift { JID nickToJID(const std::string& nick); std::string roleToFriendlyName(MUCOccupant::Role role); void receivedActivity(); - bool messageTargetsMe(boost::shared_ptr<Message> message); + bool messageTargetsMe(std::shared_ptr<Message> message); void updateJoinParts(); bool shouldUpdateJoinParts(); virtual void dayTicked() SWIFTEN_OVERRIDE { clearPresenceQueue(); } @@ -128,9 +128,9 @@ namespace Swift { void handleChangeAffiliationsRequest(const std::vector<std::pair<MUCOccupant::Affiliation, JID> >& changes); void handleInviteToMUCWindowDismissed(); void handleInviteToMUCWindowCompleted(); - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleUIEvent(std::shared_ptr<UIEvent> event); void addRecentLogs(); - void checkDuplicates(boost::shared_ptr<Message> newMessage); + void checkDuplicates(std::shared_ptr<Message> newMessage); void setNick(const std::string& nick); void setImpromptuWindowTitle(); void handleRoomUnlocked(); @@ -157,7 +157,7 @@ namespace Swift { bool shouldJoinOnReconnect_; bool doneGettingHistory_; boost::bsignals::scoped_connection avatarChangedConnection_; - boost::shared_ptr<Timer> loginCheckTimer_; + std::shared_ptr<Timer> loginCheckTimer_; std::set<std::string> currentOccupants_; std::vector<NickJoinPart> joinParts_; boost::posix_time::ptime lastActivity_; diff --git a/Swift/Controllers/Chat/MUCSearchController.cpp b/Swift/Controllers/Chat/MUCSearchController.cpp index 4f28058..0893799 100644 --- a/Swift/Controllers/Chat/MUCSearchController.cpp +++ b/Swift/Controllers/Chat/MUCSearchController.cpp @@ -7,9 +7,9 @@ #include <Swift/Controllers/Chat/MUCSearchController.h> #include <iostream> +#include <memory> #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/String.h> @@ -101,7 +101,7 @@ void MUCSearchController::handleSearchService(const JID& jid) { walker_->beginWalk(); } -void MUCSearchController::handleDiscoServiceFound(const JID& jid, boost::shared_ptr<DiscoInfo> info) { +void MUCSearchController::handleDiscoServiceFound(const JID& jid, std::shared_ptr<DiscoInfo> info) { bool isMUC = false; std::string name; foreach (DiscoInfo::Identity identity, info->getIdentities()) { @@ -143,7 +143,7 @@ void MUCSearchController::removeService(const JID& jid) { refreshView(); } -void MUCSearchController::handleRoomsItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error, const JID& jid) { +void MUCSearchController::handleRoomsItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPayload::ref error, const JID& jid) { itemsInProgress_--; SWIFT_LOG(debug) << "Items received for " << jid << " (" << itemsInProgress_ << " item requests in progress)" << std::endl; updateInProgressness(); diff --git a/Swift/Controllers/Chat/MUCSearchController.h b/Swift/Controllers/Chat/MUCSearchController.h index 3d2a2ca..99da8d0 100644 --- a/Swift/Controllers/Chat/MUCSearchController.h +++ b/Swift/Controllers/Chat/MUCSearchController.h @@ -7,11 +7,10 @@ #pragma once #include <map> +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/DiscoInfo.h> #include <Swiften/Elements/DiscoItems.h> @@ -97,9 +96,9 @@ namespace Swift { private: void handleSearchService(const JID& jid); - void handleRoomsItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error, const JID& jid); + void handleRoomsItemsResponse(std::shared_ptr<DiscoItems> items, ErrorPayload::ref error, const JID& jid); void handleDiscoError(const JID& jid, ErrorPayload::ref error); - void handleDiscoServiceFound(const JID&, boost::shared_ptr<DiscoInfo>); + void handleDiscoServiceFound(const JID&, std::shared_ptr<DiscoInfo>); void handleDiscoWalkFinished(); void handleMUCSearchFinished(const boost::optional<JID>& result); void removeService(const JID& jid); diff --git a/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp index 9ed8bf4..bc72b33 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatMessageParserTest.cpp @@ -38,12 +38,12 @@ public: } void assertText(const ChatWindow::ChatMessage& result, size_t index, const std::string& text) { - boost::shared_ptr<ChatWindow::ChatTextMessagePart> part = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(result.getParts()[index]); + std::shared_ptr<ChatWindow::ChatTextMessagePart> part = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(result.getParts()[index]); CPPUNIT_ASSERT_EQUAL(text, part->text); } void assertEmoticon(const ChatWindow::ChatMessage& result, size_t index, const std::string& text, const std::string& path) { - boost::shared_ptr<ChatWindow::ChatEmoticonMessagePart> part = boost::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(result.getParts()[index]); + std::shared_ptr<ChatWindow::ChatEmoticonMessagePart> part = std::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(result.getParts()[index]); CPPUNIT_ASSERT(!!part); CPPUNIT_ASSERT_EQUAL(text, part->alternativeText); CPPUNIT_ASSERT_EQUAL(path, part->imagePath); @@ -51,13 +51,13 @@ public: #define assertHighlight(RESULT, INDEX, TEXT, EXPECTED_HIGHLIGHT) \ { \ - boost::shared_ptr<ChatWindow::ChatHighlightingMessagePart> part = boost::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(RESULT.getParts()[INDEX]); \ + std::shared_ptr<ChatWindow::ChatHighlightingMessagePart> part = std::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(RESULT.getParts()[INDEX]); \ CPPUNIT_ASSERT_EQUAL(std::string(TEXT), part->text); \ CPPUNIT_ASSERT(EXPECTED_HIGHLIGHT == part->action); \ } void assertURL(const ChatWindow::ChatMessage& result, size_t index, const std::string& text) { - boost::shared_ptr<ChatWindow::ChatURIMessagePart> part = boost::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(result.getParts()[index]); + std::shared_ptr<ChatWindow::ChatURIMessagePart> part = std::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(result.getParts()[index]); CPPUNIT_ASSERT_EQUAL(text, part->target); } @@ -76,14 +76,14 @@ public: static const HighlightRulesListPtr ruleListFromKeyword(const std::string& keyword, bool matchCase, bool matchWholeWord) { - boost::shared_ptr<HighlightManager::HighlightRulesList> list = boost::make_shared<HighlightManager::HighlightRulesList>(); + std::shared_ptr<HighlightManager::HighlightRulesList> list = std::make_shared<HighlightManager::HighlightRulesList>(); list->addRule(ruleFromKeyword(keyword, matchCase, matchWholeWord)); return list; } static const HighlightRulesListPtr ruleListFromKeywords(const HighlightRule &rule1, const HighlightRule &rule2) { - boost::shared_ptr<HighlightManager::HighlightRulesList> list = boost::make_shared<HighlightManager::HighlightRulesList>(); + std::shared_ptr<HighlightManager::HighlightRulesList> list = std::make_shared<HighlightManager::HighlightRulesList>(); list->addRule(rule1); list->addRule(rule2); return list; @@ -99,14 +99,14 @@ public: if (withHighlightColour) { rule.getAction().setTextBackground("white"); } - boost::shared_ptr<HighlightManager::HighlightRulesList> list = boost::make_shared<HighlightManager::HighlightRulesList>(); + std::shared_ptr<HighlightManager::HighlightRulesList> list = std::make_shared<HighlightManager::HighlightRulesList>(); list->addRule(rule); return list; } void testFullBody() { const std::string no_special_message = "a message with no special content"; - ChatMessageParser testling(emoticons_, boost::make_shared<HighlightManager::HighlightRulesList>()); + ChatMessageParser testling(emoticons_, std::make_shared<HighlightManager::HighlightRulesList>()); ChatWindow::ChatMessage result = testling.parseMessageBody(no_special_message); assertText(result, 0, no_special_message); @@ -221,7 +221,7 @@ public: } void testOneEmoticon() { - ChatMessageParser testling(emoticons_, boost::make_shared<HighlightManager::HighlightRulesList>()); + ChatMessageParser testling(emoticons_, std::make_shared<HighlightManager::HighlightRulesList>()); ChatWindow::ChatMessage result = testling.parseMessageBody(" :) "); assertText(result, 0, " "); assertEmoticon(result, 1, smile1_, smile1Path_); @@ -230,26 +230,26 @@ public: void testBareEmoticon() { - ChatMessageParser testling(emoticons_, boost::make_shared<HighlightManager::HighlightRulesList>()); + ChatMessageParser testling(emoticons_, std::make_shared<HighlightManager::HighlightRulesList>()); ChatWindow::ChatMessage result = testling.parseMessageBody(":)"); assertEmoticon(result, 0, smile1_, smile1Path_); } void testHiddenEmoticon() { - ChatMessageParser testling(emoticons_, boost::make_shared<HighlightManager::HighlightRulesList>()); + ChatMessageParser testling(emoticons_, std::make_shared<HighlightManager::HighlightRulesList>()); ChatWindow::ChatMessage result = testling.parseMessageBody("b:)a"); assertText(result, 0, "b:)a"); } void testEndlineEmoticon() { - ChatMessageParser testling(emoticons_, boost::make_shared<HighlightManager::HighlightRulesList>()); + ChatMessageParser testling(emoticons_, std::make_shared<HighlightManager::HighlightRulesList>()); ChatWindow::ChatMessage result = testling.parseMessageBody("Lazy:)"); assertText(result, 0, "Lazy"); assertEmoticon(result, 1, smile1_, smile1Path_); } void testBoundedEmoticons() { - ChatMessageParser testling(emoticons_, boost::make_shared<HighlightManager::HighlightRulesList>()); + ChatMessageParser testling(emoticons_, std::make_shared<HighlightManager::HighlightRulesList>()); ChatWindow::ChatMessage result = testling.parseMessageBody(":)Lazy:("); assertEmoticon(result, 0, smile1_, smile1Path_); assertText(result, 1, "Lazy"); @@ -257,7 +257,7 @@ public: } void testEmoticonParenthesis() { - ChatMessageParser testling(emoticons_, boost::make_shared<HighlightManager::HighlightRulesList>()); + ChatMessageParser testling(emoticons_, std::make_shared<HighlightManager::HighlightRulesList>()); ChatWindow::ChatMessage result = testling.parseMessageBody("(Like this :))"); assertText(result, 0, "(Like this "); assertEmoticon(result, 1, smile1_, smile1Path_); diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp index 92a8ca0..90600dc 100644 --- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp @@ -97,7 +97,7 @@ public: mucRegistry_ = new MUCRegistry(); nickResolver_ = new NickResolver(jid_.toBare(), xmppRoster_, nullptr, mucRegistry_); presenceOracle_ = new PresenceOracle(stanzaChannel_, xmppRoster_); - serverDiscoInfo_ = boost::make_shared<DiscoInfo>(); + serverDiscoInfo_ = std::make_shared<DiscoInfo>(); presenceSender_ = new StanzaChannelPresenceSender(stanzaChannel_); directedPresenceSender_ = new DirectedPresenceSender(presenceSender_); mucManager_ = new MUCManager(stanzaChannel_, iqRouter_, directedPresenceSender_, mucRegistry_); @@ -167,7 +167,7 @@ public: MockChatWindow* window = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID, uiEventStream_).Return(window); - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); message->setFrom(messageJID); std::string body("This is a legible message. >HEH@)oeueu"); message->setBody(body); @@ -181,7 +181,7 @@ public: MockChatWindow* window1 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID1, uiEventStream_).Return(window1); - boost::shared_ptr<Message> message1(new Message()); + std::shared_ptr<Message> message1(new Message()); message1->setFrom(messageJID1); std::string body1("This is a legible message. >HEH@)oeueu"); message1->setBody(body1); @@ -193,7 +193,7 @@ public: //MockChatWindow* window2 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); //mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID2, uiEventStream_).Return(window2); - boost::shared_ptr<Message> message2(new Message()); + std::shared_ptr<Message> message2(new Message()); message2->setFrom(messageJID2); std::string body2("This is a legible message. .cmaulm.chul"); message2->setBody(body2); @@ -207,7 +207,7 @@ public: ChatWindow* window = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString), uiEventStream_).Return(window); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(messageJIDString))); } @@ -217,9 +217,9 @@ public: MockChatWindow* window = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(bareJIDString), uiEventStream_).Return(window); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(bareJIDString)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(bareJIDString))); - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); message->setFrom(JID(fullJIDString)); std::string body("This is a legible message. mjuga3089gm8G(*>M)@*("); message->setBody(body); @@ -231,13 +231,13 @@ public: std::string messageJIDString1("testling1@test.com"); ChatWindow* window1 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString1), uiEventStream_).Return(window1); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString1)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(messageJIDString1))); std::string messageJIDString2("testling2@test.com"); ChatWindow* window2 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString2), uiEventStream_).Return(window2); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString2)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(messageJIDString2))); } /** Complete cycle. @@ -253,23 +253,23 @@ public: MockChatWindow* window = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(bareJIDString), uiEventStream_).Return(window); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(bareJIDString)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(bareJIDString))); - boost::shared_ptr<Message> message1(new Message()); + std::shared_ptr<Message> message1(new Message()); message1->setFrom(JID(fullJIDString1)); std::string messageBody1("This is a legible message."); message1->setBody(messageBody1); manager_->handleIncomingMessage(message1); CPPUNIT_ASSERT_EQUAL(messageBody1, window->lastMessageBody_); - boost::shared_ptr<Presence> jid1Online(new Presence()); + std::shared_ptr<Presence> jid1Online(new Presence()); jid1Online->setFrom(JID(fullJIDString1)); - boost::shared_ptr<Presence> jid1Offline(new Presence()); + std::shared_ptr<Presence> jid1Offline(new Presence()); jid1Offline->setFrom(JID(fullJIDString1)); jid1Offline->setType(Presence::Unavailable); presenceOracle_->onPresenceChange(jid1Offline); - boost::shared_ptr<Message> message2(new Message()); + std::shared_ptr<Message> message2(new Message()); message2->setFrom(JID(fullJIDString2)); std::string messageBody2("This is another legible message."); message2->setBody(messageBody2); @@ -284,29 +284,29 @@ public: JID muc("testling@test.com"); ChatWindow* mucWindow = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(muc, uiEventStream_).Return(mucWindow); - uiEventStream_->send(boost::make_shared<JoinMUCUIEvent>(muc, std::string("nick"))); + uiEventStream_->send(std::make_shared<JoinMUCUIEvent>(muc, std::string("nick"))); std::string messageJIDString1("testling@test.com/1"); ChatWindow* window1 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString1), uiEventStream_).Return(window1); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString1)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(messageJIDString1))); std::string messageJIDString2("testling@test.com/2"); ChatWindow* window2 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString2), uiEventStream_).Return(window2); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString2)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(messageJIDString2))); std::string messageJIDString3("testling@test.com/3"); ChatWindow* window3 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString3), uiEventStream_).Return(window3); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString3)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(messageJIDString3))); /* Refetch an earlier window */ /* We do not expect a new window to be created */ - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString1)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(messageJIDString1))); } @@ -325,7 +325,7 @@ public: MockChatWindow* window1 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID1, uiEventStream_).Return(window1); - boost::shared_ptr<Message> message1(new Message()); + std::shared_ptr<Message> message1(new Message()); message1->setFrom(messageJID1); message1->setBody("This is a legible message1."); manager_->handleIncomingMessage(message1); @@ -335,35 +335,35 @@ public: //MockChatWindow* window2 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>(); //mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID2, uiEventStream_).Return(window2); - boost::shared_ptr<Message> message2(new Message()); + std::shared_ptr<Message> message2(new Message()); message2->setFrom(messageJID2); message2->setBody("This is a legible message2."); manager_->handleIncomingMessage(message2); - boost::shared_ptr<Presence> jid1Online(new Presence()); + std::shared_ptr<Presence> jid1Online(new Presence()); jid1Online->setFrom(JID(messageJID1)); - boost::shared_ptr<Presence> jid1Offline(new Presence()); + std::shared_ptr<Presence> jid1Offline(new Presence()); jid1Offline->setFrom(JID(messageJID1)); jid1Offline->setType(Presence::Unavailable); presenceOracle_->onPresenceChange(jid1Offline); - boost::shared_ptr<Presence> jid2Online(new Presence()); + std::shared_ptr<Presence> jid2Online(new Presence()); jid2Online->setFrom(JID(messageJID2)); - boost::shared_ptr<Presence> jid2Offline(new Presence()); + std::shared_ptr<Presence> jid2Offline(new Presence()); jid2Offline->setFrom(JID(messageJID2)); jid2Offline->setType(Presence::Unavailable); presenceOracle_->onPresenceChange(jid2Offline); JID messageJID3("testling@test.com/resource3"); - boost::shared_ptr<Message> message3(new Message()); + std::shared_ptr<Message> message3(new Message()); message3->setFrom(messageJID3); std::string body3("This is a legible message3."); message3->setBody(body3); manager_->handleIncomingMessage(message3); CPPUNIT_ASSERT_EQUAL(body3, window1->lastMessageBody_); - boost::shared_ptr<Message> message2b(new Message()); + std::shared_ptr<Message> message2b(new Message()); message2b->setFrom(messageJID2); std::string body2b("This is a legible message2b."); message2b->setBody(body2b); @@ -382,7 +382,7 @@ public: mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID, uiEventStream_).Return(window); settings_->storeSetting(SettingConstants::REQUEST_DELIVERYRECEIPTS, true); - boost::shared_ptr<Message> message = makeDeliveryReceiptTestMessage(messageJID, "1"); + std::shared_ptr<Message> message = makeDeliveryReceiptTestMessage(messageJID, "1"); manager_->handleIncomingMessage(message); Stanza::ref stanzaContactOnRoster = stanzaChannel_->getStanzaAtIndex<Stanza>(0); CPPUNIT_ASSERT_EQUAL(st(1), stanzaChannel_->sentStanzas.size()); @@ -405,7 +405,7 @@ public: mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID, uiEventStream_).Return(window); settings_->storeSetting(SettingConstants::REQUEST_DELIVERYRECEIPTS, true); - boost::shared_ptr<Message> message = makeDeliveryReceiptTestMessage(messageJID, "1"); + std::shared_ptr<Message> message = makeDeliveryReceiptTestMessage(messageJID, "1"); manager_->handleIncomingMessage(message); CPPUNIT_ASSERT_EQUAL(st(0), stanzaChannel_->sentStanzas.size()); @@ -447,16 +447,16 @@ public: MockChatWindow* window = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(sender, uiEventStream_).Return(window); - uiEventStream_->send(boost::make_shared<RequestChatUIEvent>(sender)); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(sender)); foreach(const JID& senderJID, senderResource) { // The sender supports delivery receipts. - DiscoInfo::ref disco = boost::make_shared<DiscoInfo>(); + DiscoInfo::ref disco = std::make_shared<DiscoInfo>(); disco->addFeature(DiscoInfo::MessageDeliveryReceiptsFeature); entityCapsProvider_->caps[senderJID] = disco; // The sender is online. - Presence::ref senderPresence = boost::make_shared<Presence>(); + Presence::ref senderPresence = std::make_shared<Presence>(); senderPresence->setFrom(senderJID); senderPresence->setTo(ownJID); stanzaChannel_->onPresenceReceived(senderPresence); @@ -473,11 +473,11 @@ public: // Two resources respond with message receipts. foreach(const JID& senderJID, senderResource) { - Message::ref receiptReply = boost::make_shared<Message>(); + Message::ref receiptReply = std::make_shared<Message>(); receiptReply->setFrom(senderJID); receiptReply->setTo(ownJID); - boost::shared_ptr<DeliveryReceipt> receipt = boost::make_shared<DeliveryReceipt>(); + std::shared_ptr<DeliveryReceipt> receipt = std::make_shared<DeliveryReceipt>(); receipt->setReceivedID(stanzaChannel_->getStanzaAtIndex<Message>(0)->getID()); receiptReply->addPayload(receipt); manager_->handleIncomingMessage(receiptReply); @@ -492,18 +492,18 @@ public: // Two resources respond with message receipts. foreach(const JID& senderJID, senderResource) { - Message::ref receiptReply = boost::make_shared<Message>(); + Message::ref receiptReply = std::make_shared<Message>(); receiptReply->setFrom(senderJID); receiptReply->setTo(ownJID); - boost::shared_ptr<DeliveryReceipt> receipt = boost::make_shared<DeliveryReceipt>(); + std::shared_ptr<DeliveryReceipt> receipt = std::make_shared<DeliveryReceipt>(); receipt->setReceivedID(stanzaChannel_->getStanzaAtIndex<Message>(1)->getID()); receiptReply->addPayload(receipt); manager_->handleIncomingMessage(receiptReply); } // Reply with a message including a body text. - Message::ref reply = boost::make_shared<Message>(); + Message::ref reply = std::make_shared<Message>(); reply->setFrom(senderResource[0]); reply->setTo(ownJID); reply->setBody("fine."); @@ -517,11 +517,11 @@ public: CPPUNIT_ASSERT(stanzaChannel_->getStanzaAtIndex<Message>(2)->getPayload<DeliveryReceiptRequest>()); // Receive random receipt from second sender resource. - reply = boost::make_shared<Message>(); + reply = std::make_shared<Message>(); reply->setFrom(senderResource[1]); reply->setTo(ownJID); - boost::shared_ptr<DeliveryReceipt> receipt = boost::make_shared<DeliveryReceipt>(); + std::shared_ptr<DeliveryReceipt> receipt = std::make_shared<DeliveryReceipt>(); receipt->setReceivedID(stanzaChannel_->getStanzaAtIndex<Message>(2)->getID()); reply->addPayload(receipt); manager_->handleIncomingMessage(reply); @@ -534,7 +534,7 @@ public: CPPUNIT_ASSERT(stanzaChannel_->getStanzaAtIndex<Message>(3)->getPayload<DeliveryReceiptRequest>()); // Reply with a message including a body text from second resource. - reply = boost::make_shared<Message>(); + reply = std::make_shared<Message>(); reply->setFrom(senderResource[1]); reply->setTo(ownJID); reply->setBody("nothing."); @@ -562,16 +562,16 @@ public: MockChatWindow* window = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(sender, uiEventStream_).Return(window); - uiEventStream_->send(boost::make_shared<RequestChatUIEvent>(sender)); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(sender)); foreach(const JID& senderJID, senderResource) { // The sender supports delivery receipts. - DiscoInfo::ref disco = boost::make_shared<DiscoInfo>(); + DiscoInfo::ref disco = std::make_shared<DiscoInfo>(); disco->addFeature(DiscoInfo::MessageDeliveryReceiptsFeature); entityCapsProvider_->caps[senderJID] = disco; // The sender is online. - Presence::ref senderPresence = boost::make_shared<Presence>(); + Presence::ref senderPresence = std::make_shared<Presence>(); senderPresence->setFrom(senderJID); senderPresence->setTo(ownJID); stanzaChannel_->onPresenceReceived(senderPresence); @@ -588,11 +588,11 @@ public: // Two resources respond with message receipts. foreach(const JID& senderJID, senderResource) { - Message::ref reply = boost::make_shared<Message>(); + Message::ref reply = std::make_shared<Message>(); reply->setFrom(senderJID); reply->setTo(ownJID); - boost::shared_ptr<ChatState> csn = boost::make_shared<ChatState>(); + std::shared_ptr<ChatState> csn = std::make_shared<ChatState>(); csn->setChatState(ChatState::Active); reply->addPayload(csn); manager_->handleIncomingMessage(reply); @@ -607,22 +607,22 @@ public: // Two resources respond with message receipts. foreach(const JID& senderJID, senderResource) { - Message::ref receiptReply = boost::make_shared<Message>(); + Message::ref receiptReply = std::make_shared<Message>(); receiptReply->setFrom(senderJID); receiptReply->setTo(ownJID); - boost::shared_ptr<DeliveryReceipt> receipt = boost::make_shared<DeliveryReceipt>(); + std::shared_ptr<DeliveryReceipt> receipt = std::make_shared<DeliveryReceipt>(); receipt->setReceivedID(stanzaChannel_->getStanzaAtIndex<Message>(1)->getID()); receiptReply->addPayload(receipt); manager_->handleIncomingMessage(receiptReply); } // Reply with a message including a CSN. - Message::ref reply = boost::make_shared<Message>(); + Message::ref reply = std::make_shared<Message>(); reply->setFrom(senderResource[0]); reply->setTo(ownJID); - boost::shared_ptr<ChatState> csn = boost::make_shared<ChatState>(); + std::shared_ptr<ChatState> csn = std::make_shared<ChatState>(); csn->setChatState(ChatState::Composing); reply->addPayload(csn); manager_->handleIncomingMessage(reply); @@ -635,11 +635,11 @@ public: CPPUNIT_ASSERT(stanzaChannel_->getStanzaAtIndex<Message>(2)->getPayload<DeliveryReceiptRequest>()); // Reply with a message including a CSN from the other resource. - reply = boost::make_shared<Message>(); + reply = std::make_shared<Message>(); reply->setFrom(senderResource[1]); reply->setTo(ownJID); - csn = boost::make_shared<ChatState>(); + csn = std::make_shared<ChatState>(); csn->setChatState(ChatState::Composing); reply->addPayload(csn); manager_->handleIncomingMessage(reply); @@ -661,7 +661,7 @@ public: MockChatWindow* window = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(participantA, uiEventStream_).Return(window); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(participantA)))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(JID(participantA))); Presence::ref presence = Presence::create(); presence->setFrom(participantA); @@ -692,17 +692,17 @@ public: MockChatWindow* window = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(sender, uiEventStream_).Return(window); - uiEventStream_->send(boost::make_shared<RequestChatUIEvent>(sender)); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(sender)); CPPUNIT_ASSERT_EQUAL(false, window->impromptuMUCSupported_); - boost::shared_ptr<IQ> infoRequest= iqChannel_->iqs_[1]; - boost::shared_ptr<IQ> infoResponse = IQ::createResult(infoRequest->getFrom(), infoRequest->getTo(), infoRequest->getID()); + std::shared_ptr<IQ> infoRequest= iqChannel_->iqs_[1]; + std::shared_ptr<IQ> infoResponse = IQ::createResult(infoRequest->getFrom(), infoRequest->getTo(), infoRequest->getID()); DiscoInfo info; info.addIdentity(DiscoInfo::Identity("Shakespearean Chat Service", "conference", "text")); info.addFeature("http://jabber.org/protocol/muc"); - infoResponse->addPayload(boost::make_shared<DiscoInfo>(info)); + infoResponse->addPayload(std::make_shared<DiscoInfo>(info)); iqChannel_->onIQReceived(infoResponse); CPPUNIT_ASSERT_EQUAL(true, window->impromptuMUCSupported_); @@ -718,7 +718,7 @@ public: mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID, uiEventStream_).Return(window); settings_->storeSetting(SettingConstants::REQUEST_DELIVERYRECEIPTS, true); - boost::shared_ptr<Message> message = makeDeliveryReceiptTestMessage(messageJID, "1"); + std::shared_ptr<Message> message = makeDeliveryReceiptTestMessage(messageJID, "1"); manager_->handleIncomingMessage(message); CPPUNIT_ASSERT_EQUAL(st(0), stanzaChannel_->sentStanzas.size()); @@ -757,7 +757,7 @@ public: MockChatWindow* window = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID, uiEventStream_).Return(window); - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); message->setFrom(messageJID); std::string body("This message should cause two sounds: Juliet and Romeo."); message->setBody(body); @@ -792,7 +792,7 @@ public: MockChatWindow* window = new MockChatWindow(); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(messageJID, uiEventStream_).Return(window); - boost::shared_ptr<Message> message(new Message()); + std::shared_ptr<Message> message(new Message()); message->setFrom(messageJID); std::string body("This message should cause one sound, because both actions have the same sound: Juliet and Romeo."); message->setBody(body); @@ -804,12 +804,12 @@ public: } private: - boost::shared_ptr<Message> makeDeliveryReceiptTestMessage(const JID& from, const std::string& id) { - boost::shared_ptr<Message> message = boost::make_shared<Message>(); + std::shared_ptr<Message> makeDeliveryReceiptTestMessage(const JID& from, const std::string& id) { + std::shared_ptr<Message> message = std::make_shared<Message>(); message->setFrom(from); message->setID(id); message->setBody("This will cause the window to open"); - message->addPayload(boost::make_shared<DeliveryReceiptRequest>()); + message->addPayload(std::make_shared<DeliveryReceiptRequest>()); return message; } @@ -836,7 +836,7 @@ private: NickResolver* nickResolver_; PresenceOracle* presenceOracle_; AvatarManager* avatarManager_; - boost::shared_ptr<DiscoInfo> serverDiscoInfo_; + std::shared_ptr<DiscoInfo> serverDiscoInfo_; XMPPRosterImpl* xmppRoster_; PresenceSender* presenceSender_; MockRepository* mocks_; diff --git a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp index 80dbc32..1142c98 100644 --- a/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp +++ b/Swift/Controllers/Chat/UnitTest/MUCControllerTest.cpp @@ -67,7 +67,7 @@ class MUCControllerTest : public CppUnit::TestFixture { public: void setUp() { - crypto_ = boost::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); + crypto_ = std::shared_ptr<CryptoProvider>(PlatformCryptoProvider::create()); self_ = JID("girl@wonderland.lit/rabbithole"); nick_ = "aLiCe"; mucJID_ = JID("teaparty@rooms.wonderland.lit"); @@ -90,9 +90,9 @@ public: entityCapsProvider_ = new DummyEntityCapsProvider(); settings_ = new DummySettingsProvider(); highlightManager_ = new HighlightManager(settings_); - muc_ = boost::make_shared<MockMUC>(mucJID_); + muc_ = std::make_shared<MockMUC>(mucJID_); mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(muc_->getJID(), uiEventStream_).Return(window_); - chatMessageParser_ = boost::make_shared<ChatMessageParser>(std::map<std::string, std::string>(), highlightManager_->getRules(), true); + chatMessageParser_ = std::make_shared<ChatMessageParser>(std::map<std::string, std::string>(), highlightManager_->getRules(), true); vcardStorage_ = new VCardMemoryStorage(crypto_.get()); vcardManager_ = new VCardManager(self_, iqRouter_, vcardStorage_); clientBlockListManager_ = new ClientBlockListManager(iqRouter_); @@ -204,18 +204,18 @@ public: SecurityLabelsCatalog::Item label; label.setSelector("Bob"); window_->label_ = label; - boost::shared_ptr<DiscoInfo> features = boost::make_shared<DiscoInfo>(); + std::shared_ptr<DiscoInfo> features = std::make_shared<DiscoInfo>(); features->addFeature(DiscoInfo::SecurityLabelsCatalogFeature); controller_->setAvailableServerFeatures(features); IQ::ref iq = iqChannel_->iqs_[iqChannel_->iqs_.size() - 1]; - SecurityLabelsCatalog::ref labelPayload = boost::make_shared<SecurityLabelsCatalog>(); + SecurityLabelsCatalog::ref labelPayload = std::make_shared<SecurityLabelsCatalog>(); labelPayload->addItem(label); IQ::ref result = IQ::createResult(self_, iq->getID(), labelPayload); iqChannel_->onIQReceived(result); std::string messageBody("agamemnon"); window_->onSendMessageRequest(messageBody, false); - boost::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; - Message::ref message = boost::dynamic_pointer_cast<Message>(rawStanza); + std::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; + Message::ref message = std::dynamic_pointer_cast<Message>(rawStanza); CPPUNIT_ASSERT_EQUAL(iq->getTo(), result->getFrom()); CPPUNIT_ASSERT(window_->labelsEnabled_); CPPUNIT_ASSERT(stanzaChannel_->isAvailable()); /* Otherwise will prevent sends. */ @@ -225,24 +225,24 @@ public: } void testMessageWithLabelItem() { - boost::shared_ptr<SecurityLabel> label = boost::make_shared<SecurityLabel>(); + std::shared_ptr<SecurityLabel> label = std::make_shared<SecurityLabel>(); label->setLabel("a"); SecurityLabelsCatalog::Item labelItem; labelItem.setSelector("Bob"); labelItem.setLabel(label); window_->label_ = labelItem; - boost::shared_ptr<DiscoInfo> features = boost::make_shared<DiscoInfo>(); + std::shared_ptr<DiscoInfo> features = std::make_shared<DiscoInfo>(); features->addFeature(DiscoInfo::SecurityLabelsCatalogFeature); controller_->setAvailableServerFeatures(features); IQ::ref iq = iqChannel_->iqs_[iqChannel_->iqs_.size() - 1]; - SecurityLabelsCatalog::ref labelPayload = boost::make_shared<SecurityLabelsCatalog>(); + SecurityLabelsCatalog::ref labelPayload = std::make_shared<SecurityLabelsCatalog>(); labelPayload->addItem(labelItem); IQ::ref result = IQ::createResult(self_, iq->getID(), labelPayload); iqChannel_->onIQReceived(result); std::string messageBody("agamemnon"); window_->onSendMessageRequest(messageBody, false); - boost::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; - Message::ref message = boost::dynamic_pointer_cast<Message>(rawStanza); + std::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; + Message::ref message = std::dynamic_pointer_cast<Message>(rawStanza); CPPUNIT_ASSERT_EQUAL(iq->getTo(), result->getFrom()); CPPUNIT_ASSERT(window_->labelsEnabled_); CPPUNIT_ASSERT(stanzaChannel_->isAvailable()); /* Otherwise will prevent sends. */ @@ -252,29 +252,29 @@ public: } void testCorrectMessageWithLabelItem() { - boost::shared_ptr<SecurityLabel> label = boost::make_shared<SecurityLabel>(); + std::shared_ptr<SecurityLabel> label = std::make_shared<SecurityLabel>(); label->setLabel("a"); SecurityLabelsCatalog::Item labelItem; labelItem.setSelector("Bob"); labelItem.setLabel(label); - boost::shared_ptr<SecurityLabel> label2 = boost::make_shared<SecurityLabel>(); + std::shared_ptr<SecurityLabel> label2 = std::make_shared<SecurityLabel>(); label->setLabel("b"); SecurityLabelsCatalog::Item labelItem2; labelItem2.setSelector("Charlie"); labelItem2.setLabel(label2); window_->label_ = labelItem; - boost::shared_ptr<DiscoInfo> features = boost::make_shared<DiscoInfo>(); + std::shared_ptr<DiscoInfo> features = std::make_shared<DiscoInfo>(); features->addFeature(DiscoInfo::SecurityLabelsCatalogFeature); controller_->setAvailableServerFeatures(features); IQ::ref iq = iqChannel_->iqs_[iqChannel_->iqs_.size() - 1]; - SecurityLabelsCatalog::ref labelPayload = boost::make_shared<SecurityLabelsCatalog>(); + SecurityLabelsCatalog::ref labelPayload = std::make_shared<SecurityLabelsCatalog>(); labelPayload->addItem(labelItem); IQ::ref result = IQ::createResult(self_, iq->getID(), labelPayload); iqChannel_->onIQReceived(result); std::string messageBody("agamemnon"); window_->onSendMessageRequest(messageBody, false); - boost::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; - Message::ref message = boost::dynamic_pointer_cast<Message>(rawStanza); + std::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; + Message::ref message = std::dynamic_pointer_cast<Message>(rawStanza); CPPUNIT_ASSERT_EQUAL(iq->getTo(), result->getFrom()); CPPUNIT_ASSERT(window_->labelsEnabled_); CPPUNIT_ASSERT(stanzaChannel_->isAvailable()); /* Otherwise will prevent sends. */ @@ -284,7 +284,7 @@ public: window_->label_ = labelItem2; window_->onSendMessageRequest(messageBody, true); rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; - message = boost::dynamic_pointer_cast<Message>(rawStanza); + message = std::dynamic_pointer_cast<Message>(rawStanza); CPPUNIT_ASSERT_EQUAL(messageBody, message->getBody().get()); CPPUNIT_ASSERT_EQUAL(label, message->getPayload<SecurityLabel>()); } @@ -406,22 +406,22 @@ public: void testSubjectChangeCorrect() { std::string messageBody("test message"); window_->onSendMessageRequest(messageBody, false); - boost::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; - Message::ref message = boost::dynamic_pointer_cast<Message>(rawStanza); + std::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; + Message::ref message = std::dynamic_pointer_cast<Message>(rawStanza); CPPUNIT_ASSERT(stanzaChannel_->isAvailable()); /* Otherwise will prevent sends. */ CPPUNIT_ASSERT(message); CPPUNIT_ASSERT_EQUAL(messageBody, message->getBody().get_value_or("")); { - Message::ref message = boost::make_shared<Message>(); + Message::ref message = std::make_shared<Message>(); message->setType(Message::Groupchat); message->setTo(self_); message->setFrom(mucJID_.withResource("SomeNickname")); message->setID(iqChannel_->getNewIQID()); message->setSubject("New Room Subject"); - controller_->handleIncomingMessage(boost::make_shared<MessageEvent>(message)); - CPPUNIT_ASSERT_EQUAL(std::string("The room subject is now: New Room Subject"), boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(window_->lastAddedSystemMessage_.getParts()[0])->text); + controller_->handleIncomingMessage(std::make_shared<MessageEvent>(message)); + CPPUNIT_ASSERT_EQUAL(std::string("The room subject is now: New Room Subject"), std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(window_->lastAddedSystemMessage_.getParts()[0])->text); } } @@ -431,14 +431,14 @@ public: void testSubjectChangeIncorrectA() { std::string messageBody("test message"); window_->onSendMessageRequest(messageBody, false); - boost::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; - Message::ref message = boost::dynamic_pointer_cast<Message>(rawStanza); + std::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; + Message::ref message = std::dynamic_pointer_cast<Message>(rawStanza); CPPUNIT_ASSERT(stanzaChannel_->isAvailable()); /* Otherwise will prevent sends. */ CPPUNIT_ASSERT(message); CPPUNIT_ASSERT_EQUAL(messageBody, message->getBody().get_value_or("")); { - Message::ref message = boost::make_shared<Message>(); + Message::ref message = std::make_shared<Message>(); message->setType(Message::Groupchat); message->setTo(self_); message->setFrom(mucJID_.withResource("SomeNickname")); @@ -446,8 +446,8 @@ public: message->setSubject("New Room Subject"); message->setBody("Some body text that prevents this stanza from being a subject change."); - controller_->handleIncomingMessage(boost::make_shared<MessageEvent>(message)); - CPPUNIT_ASSERT_EQUAL(std::string("Trying to enter room teaparty@rooms.wonderland.lit"), boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(window_->lastAddedSystemMessage_.getParts()[0])->text); + controller_->handleIncomingMessage(std::make_shared<MessageEvent>(message)); + CPPUNIT_ASSERT_EQUAL(std::string("Trying to enter room teaparty@rooms.wonderland.lit"), std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(window_->lastAddedSystemMessage_.getParts()[0])->text); } } @@ -457,23 +457,23 @@ public: void testSubjectChangeIncorrectB() { std::string messageBody("test message"); window_->onSendMessageRequest(messageBody, false); - boost::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; - Message::ref message = boost::dynamic_pointer_cast<Message>(rawStanza); + std::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; + Message::ref message = std::dynamic_pointer_cast<Message>(rawStanza); CPPUNIT_ASSERT(stanzaChannel_->isAvailable()); /* Otherwise will prevent sends. */ CPPUNIT_ASSERT(message); CPPUNIT_ASSERT_EQUAL(messageBody, message->getBody().get_value_or("")); { - Message::ref message = boost::make_shared<Message>(); + Message::ref message = std::make_shared<Message>(); message->setType(Message::Groupchat); message->setTo(self_); message->setFrom(mucJID_.withResource("SomeNickname")); message->setID(iqChannel_->getNewIQID()); message->setSubject("New Room Subject"); - message->addPayload(boost::make_shared<Thread>("Thread that prevents the subject change.")); + message->addPayload(std::make_shared<Thread>("Thread that prevents the subject change.")); - controller_->handleIncomingMessage(boost::make_shared<MessageEvent>(message)); - CPPUNIT_ASSERT_EQUAL(std::string("Trying to enter room teaparty@rooms.wonderland.lit"), boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(window_->lastAddedSystemMessage_.getParts()[0])->text); + controller_->handleIncomingMessage(std::make_shared<MessageEvent>(message)); + CPPUNIT_ASSERT_EQUAL(std::string("Trying to enter room teaparty@rooms.wonderland.lit"), std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(window_->lastAddedSystemMessage_.getParts()[0])->text); } } @@ -483,14 +483,14 @@ public: void testSubjectChangeIncorrectC() { std::string messageBody("test message"); window_->onSendMessageRequest(messageBody, false); - boost::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; - Message::ref message = boost::dynamic_pointer_cast<Message>(rawStanza); + std::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1]; + Message::ref message = std::dynamic_pointer_cast<Message>(rawStanza); CPPUNIT_ASSERT(stanzaChannel_->isAvailable()); /* Otherwise will prevent sends. */ CPPUNIT_ASSERT(message); CPPUNIT_ASSERT_EQUAL(messageBody, message->getBody().get_value_or("")); { - Message::ref message = boost::make_shared<Message>(); + Message::ref message = std::make_shared<Message>(); message->setType(Message::Groupchat); message->setTo(self_); message->setFrom(mucJID_.withResource("SomeNickname")); @@ -498,8 +498,8 @@ public: message->setSubject("New Room Subject"); message->setBody(""); - controller_->handleIncomingMessage(boost::make_shared<MessageEvent>(message)); - CPPUNIT_ASSERT_EQUAL(std::string("Trying to enter room teaparty@rooms.wonderland.lit"), boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(window_->lastAddedSystemMessage_.getParts()[0])->text); + controller_->handleIncomingMessage(std::make_shared<MessageEvent>(message)); + CPPUNIT_ASSERT_EQUAL(std::string("Trying to enter room teaparty@rooms.wonderland.lit"), std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(window_->lastAddedSystemMessage_.getParts()[0])->text); } } @@ -544,8 +544,8 @@ private: DummyEntityCapsProvider* entityCapsProvider_; DummySettingsProvider* settings_; HighlightManager* highlightManager_; - boost::shared_ptr<ChatMessageParser> chatMessageParser_; - boost::shared_ptr<CryptoProvider> crypto_; + std::shared_ptr<ChatMessageParser> chatMessageParser_; + std::shared_ptr<CryptoProvider> crypto_; VCardManager* vcardManager_; VCardMemoryStorage* vcardStorage_; ClientBlockListManager* clientBlockListManager_; diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp index c1040f0..305049f 100644 --- a/Swift/Controllers/Chat/UserSearchController.cpp +++ b/Swift/Controllers/Chat/UserSearchController.cpp @@ -6,9 +6,9 @@ #include <Swift/Controllers/Chat/UserSearchController.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Avatars/AvatarManager.h> #include <Swiften/Base/String.h> @@ -79,23 +79,23 @@ void UserSearchController::setCanInitiateImpromptuMUC(bool supportsImpromptu) { } // Else doesn't support search } -void UserSearchController::handleUIEvent(boost::shared_ptr<UIEvent> event) { +void UserSearchController::handleUIEvent(std::shared_ptr<UIEvent> event) { bool handle = false; - boost::shared_ptr<RequestAddUserDialogUIEvent> addUserRequest = boost::shared_ptr<RequestAddUserDialogUIEvent>(); + std::shared_ptr<RequestAddUserDialogUIEvent> addUserRequest = std::shared_ptr<RequestAddUserDialogUIEvent>(); RequestInviteToMUCUIEvent::ref inviteToMUCRequest = RequestInviteToMUCUIEvent::ref(); switch (type_) { case AddContact: - if ((addUserRequest = boost::dynamic_pointer_cast<RequestAddUserDialogUIEvent>(event))) { + if ((addUserRequest = std::dynamic_pointer_cast<RequestAddUserDialogUIEvent>(event))) { handle = true; } break; case StartChat: - if (boost::dynamic_pointer_cast<RequestChatWithUserDialogUIEvent>(event)) { + if (std::dynamic_pointer_cast<RequestChatWithUserDialogUIEvent>(event)) { handle = true; } break; case InviteToChat: - if ((inviteToMUCRequest = boost::dynamic_pointer_cast<RequestInviteToMUCUIEvent>(event))) { + if ((inviteToMUCRequest = std::dynamic_pointer_cast<RequestInviteToMUCUIEvent>(event))) { handle = true; } break; @@ -140,7 +140,7 @@ void UserSearchController::endDiscoWalker() { } } -void UserSearchController::handleDiscoServiceFound(const JID& jid, boost::shared_ptr<DiscoInfo> info) { +void UserSearchController::handleDiscoServiceFound(const JID& jid, std::shared_ptr<DiscoInfo> info) { //bool isUserDirectory = false; bool supports55 = false; foreach (DiscoInfo::Identity identity, info->getIdentities()) { @@ -154,13 +154,13 @@ void UserSearchController::handleDiscoServiceFound(const JID& jid, boost::shared if (/*isUserDirectory && */supports55) { //FIXME: once M-Link correctly advertises directoryness. /* Abort further searches.*/ endDiscoWalker(); - boost::shared_ptr<GenericRequest<SearchPayload> > searchRequest(new GenericRequest<SearchPayload>(IQ::Get, jid, boost::make_shared<SearchPayload>(), iqRouter_)); + std::shared_ptr<GenericRequest<SearchPayload> > searchRequest(new GenericRequest<SearchPayload>(IQ::Get, jid, std::make_shared<SearchPayload>(), iqRouter_)); searchRequest->onResponse.connect(boost::bind(&UserSearchController::handleFormResponse, this, _1, _2)); searchRequest->send(); } } -void UserSearchController::handleFormResponse(boost::shared_ptr<SearchPayload> fields, ErrorPayload::ref error) { +void UserSearchController::handleFormResponse(std::shared_ptr<SearchPayload> fields, ErrorPayload::ref error) { if (error || !fields) { window_->setServerSupportsSearch(false); return; @@ -168,14 +168,14 @@ void UserSearchController::handleFormResponse(boost::shared_ptr<SearchPayload> f window_->setSearchFields(fields); } -void UserSearchController::handleSearch(boost::shared_ptr<SearchPayload> fields, const JID& jid) { +void UserSearchController::handleSearch(std::shared_ptr<SearchPayload> fields, const JID& jid) { addToSavedDirectories(jid); - boost::shared_ptr<GenericRequest<SearchPayload> > searchRequest(new GenericRequest<SearchPayload>(IQ::Set, jid, fields, iqRouter_)); + std::shared_ptr<GenericRequest<SearchPayload> > searchRequest(new GenericRequest<SearchPayload>(IQ::Set, jid, fields, iqRouter_)); searchRequest->onResponse.connect(boost::bind(&UserSearchController::handleSearchResponse, this, _1, _2)); searchRequest->send(); } -void UserSearchController::handleSearchResponse(boost::shared_ptr<SearchPayload> resultsPayload, ErrorPayload::ref error) { +void UserSearchController::handleSearchResponse(std::shared_ptr<SearchPayload> resultsPayload, ErrorPayload::ref error) { if (error || !resultsPayload) { window_->setSearchError(true); return; @@ -290,7 +290,7 @@ void UserSearchController::handleJIDAddRequested(const std::vector<JID>& jids) { } Contact::ref UserSearchController::convertJIDtoContact(const JID& jid) { - Contact::ref contact = boost::make_shared<Contact>(); + Contact::ref contact = std::make_shared<Contact>(); contact->jid = jid; // name lookup diff --git a/Swift/Controllers/Chat/UserSearchController.h b/Swift/Controllers/Chat/UserSearchController.h index 71b8331..1c2f40a 100644 --- a/Swift/Controllers/Chat/UserSearchController.h +++ b/Swift/Controllers/Chat/UserSearchController.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. */ @@ -7,11 +7,10 @@ #pragma once #include <map> +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/DiscoInfo.h> #include <Swiften/Elements/DiscoItems.h> @@ -57,13 +56,13 @@ namespace Swift { void setCanInitiateImpromptuMUC(bool supportsImpromptu); private: - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleUIEvent(std::shared_ptr<UIEvent> event); void handleFormRequested(const JID& service); - void handleDiscoServiceFound(const JID& jid, boost::shared_ptr<DiscoInfo> info); + void handleDiscoServiceFound(const JID& jid, std::shared_ptr<DiscoInfo> info); void handleDiscoWalkFinished(); - void handleFormResponse(boost::shared_ptr<SearchPayload> items, ErrorPayload::ref error); - void handleSearch(boost::shared_ptr<SearchPayload> fields, const JID& jid); - void handleSearchResponse(boost::shared_ptr<SearchPayload> results, ErrorPayload::ref error); + void handleFormResponse(std::shared_ptr<SearchPayload> items, ErrorPayload::ref error); + void handleSearch(std::shared_ptr<SearchPayload> fields, const JID& jid); + void handleSearchResponse(std::shared_ptr<SearchPayload> results, ErrorPayload::ref error); void handleNameSuggestionRequest(const JID& jid); void handleContactSuggestionsRequested(std::string text); void handleVCardChanged(const JID& jid, VCard::ref vcard); diff --git a/Swift/Controllers/Contact.h b/Swift/Controllers/Contact.h index 4aa6999..47dda43 100644 --- a/Swift/Controllers/Contact.h +++ b/Swift/Controllers/Contact.h @@ -5,14 +5,15 @@ */ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/enable_shared_from_this.hpp> +#include <memory> + #include <boost/filesystem/path.hpp> #include <Swiften/Elements/StatusShow.h> @@ -20,9 +21,9 @@ namespace Swift { -class Contact : public boost::enable_shared_from_this<Contact> { +class Contact : public std::enable_shared_from_this<Contact> { public: - typedef boost::shared_ptr<Contact> ref; + typedef std::shared_ptr<Contact> ref; Contact(); Contact(const std::string& name, const JID& jid, StatusShow::Type statusType, const boost::filesystem::path& path); diff --git a/Swift/Controllers/ContactEditController.cpp b/Swift/Controllers/ContactEditController.cpp index d3106ed..2ea1f7e 100644 --- a/Swift/Controllers/ContactEditController.cpp +++ b/Swift/Controllers/ContactEditController.cpp @@ -6,9 +6,10 @@ #include <Swift/Controllers/ContactEditController.h> +#include <memory> + #include <boost/algorithm/string.hpp> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/VCards/VCardManager.h> @@ -35,7 +36,7 @@ ContactEditController::~ContactEditController() { } void ContactEditController::handleUIEvent(UIEvent::ref event) { - RequestContactEditorUIEvent::ref editEvent = boost::dynamic_pointer_cast<RequestContactEditorUIEvent>(event); + RequestContactEditorUIEvent::ref editEvent = std::dynamic_pointer_cast<RequestContactEditorUIEvent>(event); if (!editEvent) { return; } @@ -90,7 +91,7 @@ std::vector<std::string> ContactEditController::nameSuggestionsFromVCard(VCard:: void ContactEditController::handleRemoveContactRequest() { assert(currentContact); - uiEventStream->send(boost::make_shared<RemoveRosterItemUIEvent>(currentContact->getJID())); + uiEventStream->send(std::make_shared<RemoveRosterItemUIEvent>(currentContact->getJID())); contactEditWindow->hide(); } diff --git a/Swift/Controllers/ContactsFromXMPPRoster.cpp b/Swift/Controllers/ContactsFromXMPPRoster.cpp index 1aa4424..e3c5d97 100644 --- a/Swift/Controllers/ContactsFromXMPPRoster.cpp +++ b/Swift/Controllers/ContactsFromXMPPRoster.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -30,7 +30,7 @@ std::vector<Contact::ref> ContactsFromXMPPRoster::getContacts(bool /*withMUCNick std::vector<Contact::ref> results; std::vector<XMPPRosterItem> rosterItems = roster_->getItems(); foreach(const XMPPRosterItem& rosterItem, rosterItems) { - Contact::ref contact = boost::make_shared<Contact>(rosterItem.getName().empty() ? rosterItem.getJID().toString() : rosterItem.getName(), rosterItem.getJID(), StatusShow::None,""); + Contact::ref contact = std::make_shared<Contact>(rosterItem.getName().empty() ? rosterItem.getJID().toString() : rosterItem.getName(), rosterItem.getJID(), StatusShow::None,""); contact->statusType = presenceOracle_->getAccountPresence(contact->jid) ? presenceOracle_->getAccountPresence(contact->jid)->getShow() : StatusShow::None; contact->avatarPath = avatarManager_->getAvatarPath(contact->jid); results.push_back(contact); diff --git a/Swift/Controllers/EventNotifier.cpp b/Swift/Controllers/EventNotifier.cpp index f4a9c2f..6ea2ea5 100644 --- a/Swift/Controllers/EventNotifier.cpp +++ b/Swift/Controllers/EventNotifier.cpp @@ -36,11 +36,11 @@ EventNotifier::~EventNotifier() { eventController->onEventQueueEventAdded.disconnect(boost::bind(&EventNotifier::handleEventAdded, this, _1)); } -void EventNotifier::handleEventAdded(boost::shared_ptr<StanzaEvent> event) { +void EventNotifier::handleEventAdded(std::shared_ptr<StanzaEvent> event) { if (event->getConcluded()) { return; } - if (boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event)) { + if (std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(event)) { JID jid = messageEvent->getStanza()->getFrom(); std::string title = nickResolver->jidToNick(jid); if (!messageEvent->getStanza()->isError() && !messageEvent->getStanza()->getBody().get_value_or("").empty()) { @@ -55,16 +55,16 @@ void EventNotifier::handleEventAdded(boost::shared_ptr<StanzaEvent> event) { notifier->showMessage(Notifier::IncomingMessage, title, messageText, avatarManager->getAvatarPath(jid), boost::bind(&EventNotifier::handleNotificationActivated, this, activationJID)); } } - else if(boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event)) { + else if(std::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(event)) { JID jid = subscriptionEvent->getJID(); std::string title = jid; std::string message = str(format(QT_TRANSLATE_NOOP("", "%1% wants to add you to his/her contact list")) % nickResolver->jidToNick(jid)); notifier->showMessage(Notifier::SystemMessage, title, message, boost::filesystem::path(), boost::function<void()>()); } - else if(boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event)) { + else if(std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(event)) { notifier->showMessage(Notifier::SystemMessage, QT_TRANSLATE_NOOP("", "Error"), errorEvent->getText(), boost::filesystem::path(), boost::function<void()>()); } - else if (boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event)) { + else if (std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(event)) { std::string title = mucInviteEvent->getInviter(); std::string message = str(format(QT_TRANSLATE_NOOP("", "%1% has invited you to enter the %2% room")) % nickResolver->jidToNick(mucInviteEvent->getInviter()) % mucInviteEvent->getRoomJID()); // FIXME: not show avatar or greyed out avatar for mediated invites diff --git a/Swift/Controllers/EventNotifier.h b/Swift/Controllers/EventNotifier.h index 4661c46..e9c1466 100644 --- a/Swift/Controllers/EventNotifier.h +++ b/Swift/Controllers/EventNotifier.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/JID/JID.h> @@ -32,7 +32,7 @@ namespace Swift { boost::signal<void (const JID&)> onNotificationActivated; private: - void handleEventAdded(boost::shared_ptr<StanzaEvent>); + void handleEventAdded(std::shared_ptr<StanzaEvent>); void handleNotificationActivated(JID jid); private: diff --git a/Swift/Controllers/EventWindowController.cpp b/Swift/Controllers/EventWindowController.cpp index 2739a87..412bb71 100644 --- a/Swift/Controllers/EventWindowController.cpp +++ b/Swift/Controllers/EventWindowController.cpp @@ -26,11 +26,11 @@ EventWindowController::~EventWindowController() { } } -void EventWindowController::handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent> event) { +void EventWindowController::handleEventQueueEventAdded(std::shared_ptr<StanzaEvent> event) { if (event->getConcluded()) { handleEventConcluded(event); } else { - boost::shared_ptr<MessageEvent> message = boost::dynamic_pointer_cast<MessageEvent>(event); + std::shared_ptr<MessageEvent> message = std::dynamic_pointer_cast<MessageEvent>(event); if (!(message && message->isReadable())) { event->onConclusion.connect(boost::bind(&EventWindowController::handleEventConcluded, this, event)); window_->addEvent(event, true); @@ -38,11 +38,11 @@ void EventWindowController::handleEventQueueEventAdded(boost::shared_ptr<StanzaE } } -void EventWindowController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) { +void EventWindowController::handleEventConcluded(std::shared_ptr<StanzaEvent> event) { window_->removeEvent(event); bool includeAsCompleted = true; /* Because subscription requests get duplicated, don't add them back */ - if (boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event) || boost::dynamic_pointer_cast<MessageEvent>(event)) { + if (std::dynamic_pointer_cast<SubscriptionRequestEvent>(event) || std::dynamic_pointer_cast<MessageEvent>(event)) { includeAsCompleted = false; } if (includeAsCompleted) { diff --git a/Swift/Controllers/EventWindowController.h b/Swift/Controllers/EventWindowController.h index eba07ca..7db7c25 100644 --- a/Swift/Controllers/EventWindowController.h +++ b/Swift/Controllers/EventWindowController.h @@ -17,8 +17,8 @@ namespace Swift { EventWindowController(EventController* eventController, EventWindowFactory* windowFactory); ~EventWindowController(); private: - void handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent> event); - void handleEventConcluded(boost::shared_ptr<StanzaEvent> event); + void handleEventQueueEventAdded(std::shared_ptr<StanzaEvent> event); + void handleEventConcluded(std::shared_ptr<StanzaEvent> event); EventController* eventController_; EventWindowFactory* windowFactory_; diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp index c005705..dd4e95c 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp @@ -12,9 +12,10 @@ #include <Swift/Controllers/FileTransfer/FileTransferController.h> +#include <memory> + #include <boost/bind.hpp> #include <boost/filesystem.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Base/Log.h> #include <Swiften/Base/boost_bsignals.h> @@ -82,7 +83,7 @@ boost::uintmax_t FileTransferController::getSize() const { void FileTransferController::start(std::string& description) { SWIFT_LOG(debug) << "FileTransferController::start" << std::endl; - fileReadStream = boost::make_shared<FileReadBytestream>(boost::filesystem::path(filename)); + fileReadStream = std::make_shared<FileReadBytestream>(boost::filesystem::path(filename)); OutgoingFileTransfer::ref outgoingTransfer = ftManager->createOutgoingFileTransfer(otherParty, boost::filesystem::path(filename), description, fileReadStream); if (outgoingTransfer) { ftProgressInfo = new FileTransferProgressInfo(outgoingTransfer->getFileSizeInBytes()); @@ -98,9 +99,9 @@ void FileTransferController::start(std::string& description) { void FileTransferController::accept(std::string& file) { SWIFT_LOG(debug) << "FileTransferController::accept" << std::endl; - IncomingFileTransfer::ref incomingTransfer = boost::dynamic_pointer_cast<IncomingFileTransfer>(transfer); + IncomingFileTransfer::ref incomingTransfer = std::dynamic_pointer_cast<IncomingFileTransfer>(transfer); if (incomingTransfer) { - fileWriteStream = boost::make_shared<FileWriteBytestream>(boost::filesystem::path(file)); + fileWriteStream = std::make_shared<FileWriteBytestream>(boost::filesystem::path(file)); ftProgressInfo = new FileTransferProgressInfo(transfer->getFileSizeInBytes()); ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1)); diff --git a/Swift/Controllers/FileTransfer/FileTransferController.h b/Swift/Controllers/FileTransfer/FileTransferController.h index a25abee..01d65e7 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.h +++ b/Swift/Controllers/FileTransfer/FileTransferController.h @@ -5,17 +5,17 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> #include <boost/cstdint.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/FileTransfer/FileReadBytestream.h> #include <Swiften/FileTransfer/FileTransfer.h> @@ -68,8 +68,8 @@ private: JID otherParty; std::string filename; FileTransfer::ref transfer; - boost::shared_ptr<FileReadBytestream> fileReadStream; - boost::shared_ptr<FileWriteBytestream> fileWriteStream; + std::shared_ptr<FileReadBytestream> fileReadStream; + std::shared_ptr<FileWriteBytestream> fileWriteStream; FileTransferManager* ftManager; FileTransferProgressInfo* ftProgressInfo; ChatWindow* chatWindow; diff --git a/Swift/Controllers/FileTransferListController.cpp b/Swift/Controllers/FileTransferListController.cpp index 8400e52..4f85b81 100644 --- a/Swift/Controllers/FileTransferListController.cpp +++ b/Swift/Controllers/FileTransferListController.cpp @@ -34,8 +34,8 @@ void FileTransferListController::setFileTransferOverview(FileTransferOverview *o } } -void FileTransferListController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { - boost::shared_ptr<RequestFileTransferListUIEvent> event = boost::dynamic_pointer_cast<RequestFileTransferListUIEvent>(rawEvent); +void FileTransferListController::handleUIEvent(std::shared_ptr<UIEvent> rawEvent) { + std::shared_ptr<RequestFileTransferListUIEvent> event = std::dynamic_pointer_cast<RequestFileTransferListUIEvent>(rawEvent); if (event != nullptr) { if (fileTransferListWidget == nullptr) { fileTransferListWidget = fileTransferListWidgetFactory->createFileTransferListWidget(); diff --git a/Swift/Controllers/FileTransferListController.h b/Swift/Controllers/FileTransferListController.h index df79d1f..832a99c 100644 --- a/Swift/Controllers/FileTransferListController.h +++ b/Swift/Controllers/FileTransferListController.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swift/Controllers/UIEvents/UIEventStream.h> @@ -30,7 +30,7 @@ public: void setFileTransferOverview(FileTransferOverview* overview); private: - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleUIEvent(std::shared_ptr<UIEvent> event); private: FileTransferListWidgetFactory* fileTransferListWidgetFactory; diff --git a/Swift/Controllers/HighlightEditorController.cpp b/Swift/Controllers/HighlightEditorController.cpp index 2c71e1d..1f5f928 100644 --- a/Swift/Controllers/HighlightEditorController.cpp +++ b/Swift/Controllers/HighlightEditorController.cpp @@ -34,9 +34,9 @@ HighlightEditorController::~HighlightEditorController() highlightEditorWindow_ = nullptr; } -void HighlightEditorController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) +void HighlightEditorController::handleUIEvent(std::shared_ptr<UIEvent> rawEvent) { - boost::shared_ptr<RequestHighlightEditorUIEvent> event = boost::dynamic_pointer_cast<RequestHighlightEditorUIEvent>(rawEvent); + std::shared_ptr<RequestHighlightEditorUIEvent> event = std::dynamic_pointer_cast<RequestHighlightEditorUIEvent>(rawEvent); if (event) { if (!highlightEditorWindow_) { highlightEditorWindow_ = highlightEditorWindowFactory_->createHighlightEditorWindow(); diff --git a/Swift/Controllers/HighlightEditorController.h b/Swift/Controllers/HighlightEditorController.h index 24ad9c2..a699751 100644 --- a/Swift/Controllers/HighlightEditorController.h +++ b/Swift/Controllers/HighlightEditorController.h @@ -5,14 +5,15 @@ */ /* - * Copyright (c) 2014 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> +#include <string> #include <Swift/Controllers/UIEvents/UIEvent.h> @@ -35,7 +36,7 @@ namespace Swift { void setContactSuggester(ContactSuggester *suggester) { contactSuggester_ = suggester; } private: - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleUIEvent(std::shared_ptr<UIEvent> event); void handleContactSuggestionsRequested(const std::string& text); private: diff --git a/Swift/Controllers/HighlightManager.cpp b/Swift/Controllers/HighlightManager.cpp index 45b800a..426afc1 100644 --- a/Swift/Controllers/HighlightManager.cpp +++ b/Swift/Controllers/HighlightManager.cpp @@ -50,7 +50,7 @@ namespace Swift { HighlightManager::HighlightManager(SettingsProvider* settings) : settings_(settings) , storingSettings_(false) { - rules_ = boost::make_shared<HighlightRulesList>(); + rules_ = std::make_shared<HighlightRulesList>(); loadSettings(); handleSettingChangedConnection_ = settings_->onSettingChanged.connect(boost::bind(&HighlightManager::handleSettingChanged, this, _1)); } diff --git a/Swift/Controllers/HighlightManager.h b/Swift/Controllers/HighlightManager.h index 1d2eb8a..25503a7 100644 --- a/Swift/Controllers/HighlightManager.h +++ b/Swift/Controllers/HighlightManager.h @@ -47,7 +47,7 @@ namespace Swift { Highlighter* createHighlighter(); - boost::shared_ptr<const HighlightManager::HighlightRulesList> getRules() const { return rules_; } + std::shared_ptr<const HighlightManager::HighlightRulesList> getRules() const { return rules_; } bool isDefaultRulesList() const; void resetToDefaultRulesList(); @@ -72,10 +72,10 @@ namespace Swift { SettingsProvider* settings_; bool storingSettings_; - boost::shared_ptr<HighlightManager::HighlightRulesList> rules_; + std::shared_ptr<HighlightManager::HighlightRulesList> rules_; boost::bsignals::scoped_connection handleSettingChangedConnection_; }; - typedef boost::shared_ptr<const HighlightManager::HighlightRulesList> HighlightRulesListPtr; + typedef std::shared_ptr<const HighlightManager::HighlightRulesList> HighlightRulesListPtr; } diff --git a/Swift/Controllers/HistoryViewController.cpp b/Swift/Controllers/HistoryViewController.cpp index 827d7d6..d66b2b2 100644 --- a/Swift/Controllers/HistoryViewController.cpp +++ b/Swift/Controllers/HistoryViewController.cpp @@ -70,8 +70,8 @@ HistoryViewController::~HistoryViewController() { delete roster_; } -void HistoryViewController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { - boost::shared_ptr<RequestHistoryUIEvent> event = boost::dynamic_pointer_cast<RequestHistoryUIEvent>(rawEvent); +void HistoryViewController::handleUIEvent(std::shared_ptr<UIEvent> rawEvent) { + std::shared_ptr<RequestHistoryUIEvent> event = std::dynamic_pointer_cast<RequestHistoryUIEvent>(rawEvent); if (event != nullptr) { if (historyWindow_ == nullptr) { historyWindow_ = historyWindowFactory_->createHistoryWindow(uiEventStream_); @@ -320,7 +320,7 @@ void HistoryViewController::handlePresenceChanged(Presence::ref presence) { } if (contacts_[HistoryMessage::Groupchat].count(jid.toBare())) { - Presence::ref availablePresence = boost::make_shared<Presence>(Presence()); + Presence::ref availablePresence = std::make_shared<Presence>(Presence()); availablePresence->setFrom(jid.toBare()); roster_->applyOnItems(SetPresence(availablePresence, JID::WithResource)); } @@ -342,7 +342,7 @@ Presence::ref HistoryViewController::getPresence(const JID& jid, bool isMUC) { std::vector<Presence::ref> mucPresence = presenceOracle_->getAllPresence(jid.toBare()); if (isMUC && !mucPresence.empty()) { - Presence::ref presence = boost::make_shared<Presence>(Presence()); + Presence::ref presence = std::make_shared<Presence>(Presence()); presence->setFrom(jid); return presence; } diff --git a/Swift/Controllers/HistoryViewController.h b/Swift/Controllers/HistoryViewController.h index 463ee06..0ba681c 100644 --- a/Swift/Controllers/HistoryViewController.h +++ b/Swift/Controllers/HistoryViewController.h @@ -12,10 +12,10 @@ #pragma once +#include <memory> #include <set> #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/History/HistoryStorage.h> @@ -40,7 +40,7 @@ namespace Swift { ~HistoryViewController(); private: - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleUIEvent(std::shared_ptr<UIEvent> event); void handleSelectedContactChanged(RosterItem* item); void handleNewMessage(const HistoryMessage& message); void handleReturnPressed(const std::string& keyword); diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index e8cd012..eebac37 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -10,8 +10,8 @@ #include <boost/bind.hpp> #include <boost/lexical_cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> +#include <memory> #include <Swiften/Base/Algorithm.h> #include <Swiften/Base/String.h> @@ -328,7 +328,7 @@ void MainController::resetPendingReconnects() { void MainController::resetCurrentError() { if (lastDisconnectError_) { lastDisconnectError_->conclude(); - lastDisconnectError_ = boost::shared_ptr<ErrorEvent>(); + lastDisconnectError_ = std::shared_ptr<ErrorEvent>(); } } @@ -447,7 +447,7 @@ void MainController::reconnectAfterError() { } void MainController::handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText) { - boost::shared_ptr<Presence> presence(new Presence()); + std::shared_ptr<Presence> presence(new Presence()); if (show == StatusShow::None) { // Note: this is misleading, None doesn't mean unavailable on the wire. presence->setType(Presence::Unavailable); @@ -472,14 +472,14 @@ void MainController::handleChangeStatusRequest(StatusShow::Type show, const std: } } -void MainController::sendPresence(boost::shared_ptr<Presence> presence) { +void MainController::sendPresence(std::shared_ptr<Presence> presence) { rosterController_->getWindow()->setMyStatusType(presence->getShow()); rosterController_->getWindow()->setMyStatusText(presence->getStatus()); systemTrayController_->setMyStatusType(presence->getShow()); notifier_->setTemporarilyDisabled(presence->getShow() == StatusShow::DND); // Add information and send - presence->updatePayload(boost::make_shared<VCardUpdate>(vCardPhotoHash_)); + presence->updatePayload(std::make_shared<VCardUpdate>(vCardPhotoHash_)); client_->getPresenceSender()->sendPresence(presence); if (presence->getType() == Presence::Unavailable) { logout(); @@ -533,7 +533,7 @@ void MainController::handleLoginRequest(const std::string &username, const std:: std::string userName; std::string clientName; std::string serverName; - boost::shared_ptr<boost::system::error_code> errorCode = getUserNameEx(userName, clientName, serverName); + std::shared_ptr<boost::system::error_code> errorCode = getUserNameEx(userName, clientName, serverName); if (!errorCode) { /* Create JID using the Windows logon name and user provided domain name */ @@ -593,7 +593,7 @@ void MainController::performLoginFromCachedCredentials() { certificateStorage_ = certificateStorageFactory_->createCertificateStorage(jid_.toBare()); certificateTrustChecker_ = new CertificateStorageTrustChecker(certificateStorage_); - client_ = boost::make_shared<Swift::Client>(clientJID, createSafeByteArray(password_.c_str()), networkFactories_, storages_); + client_ = std::make_shared<Swift::Client>(clientJID, createSafeByteArray(password_.c_str()), networkFactories_, storages_); clientInitialized_ = true; client_->setCertificateTrustChecker(certificateTrustChecker_); client_->onDataRead.connect(boost::bind(&XMLConsoleController::handleDataRead, xmlConsoleController_, _1)); @@ -611,7 +611,7 @@ void MainController::performLoginFromCachedCredentials() { if (certificate_) { client_->setCertificate(certificate_); } - boost::shared_ptr<Presence> presence(new Presence()); + std::shared_ptr<Presence> presence(new Presence()); presence->setShow(static_cast<StatusShow::Type>(profileSettings_->getIntSetting("lastShow", StatusShow::Online))); presence->setStatus(profileSettings_->getStringSetting("lastStatus")); statusTracker_->setRequestedPresence(presence); @@ -725,7 +725,7 @@ void MainController::handleDisconnected(const boost::optional<ClientError>& erro } else { message = str(format(QT_TRANSLATE_NOOP("", "Disconnected from %1%: %2%.")) % jid_.getDomain() % message); } - lastDisconnectError_ = boost::make_shared<ErrorEvent>(JID(jid_.getDomain()), message); + lastDisconnectError_ = std::make_shared<ErrorEvent>(JID(jid_.getDomain()), message); eventController_->handleIncomingEvent(lastDisconnectError_); } } @@ -794,7 +794,7 @@ void MainController::setManagersOffline() { } } -void MainController::handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, ErrorPayload::ref error) { +void MainController::handleServerDiscoInfoResponse(std::shared_ptr<DiscoInfo> info, ErrorPayload::ref error) { if (!error) { chatsManager_->setServerDiscoInfo(info); adHocManager_->setServerDiscoInfo(info); @@ -825,10 +825,10 @@ void MainController::handleNotificationClicked(const JID& jid) { assert(chatsManager_); if (clientInitialized_) { if (client_->getMUCRegistry()->isMUC(jid)) { - uiEventStream_->send(boost::make_shared<JoinMUCUIEvent>(jid)); + uiEventStream_->send(std::make_shared<JoinMUCUIEvent>(jid)); } else { - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(jid))); + uiEventStream_->send(std::make_shared<RequestChatUIEvent>(jid)); } } } diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index ed7765a..b5c8d79 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -7,11 +7,10 @@ #pragma once #include <map> +#include <memory> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Client/ClientError.h> #include <Swiften/Client/ClientXMLTracer.h> @@ -109,12 +108,12 @@ namespace Swift { void handleQuitRequest(); void handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText); void handleDisconnected(const boost::optional<ClientError>& error); - void handleServerDiscoInfoResponse(boost::shared_ptr<DiscoInfo>, ErrorPayload::ref); + void handleServerDiscoInfoResponse(std::shared_ptr<DiscoInfo>, ErrorPayload::ref); void handleEventQueueLengthChange(int count); void handleVCardReceived(const JID& j, VCard::ref vCard); void handleSettingChanged(const std::string& settingPath); void handlePurgeSavedLoginRequest(const std::string& username); - void sendPresence(boost::shared_ptr<Presence> presence); + void sendPresence(std::shared_ptr<Presence> presence); void handleInputIdleChanged(bool); void handleShowCertificateRequest(); void logout(); @@ -142,7 +141,7 @@ namespace Swift { CertificateStorage* certificateStorage_; CertificateStorageTrustChecker* certificateTrustChecker_; bool clientInitialized_; - boost::shared_ptr<Client> client_; + std::shared_ptr<Client> client_; SettingsProvider *settings_; ProfileSettingsProvider* profileSettings_; Dock* dock_; @@ -178,7 +177,7 @@ namespace Swift { std::string password_; CertificateWithKey::ref certificate_; ClientOptions clientOptions_; - boost::shared_ptr<ErrorEvent> lastDisconnectError_; + std::shared_ptr<ErrorEvent> lastDisconnectError_; bool useDelayForLatency_; UserSearchController* userSearchControllerChat_; UserSearchController* userSearchControllerAdd_; diff --git a/Swift/Controllers/PresenceNotifier.cpp b/Swift/Controllers/PresenceNotifier.cpp index c000107..91deae6 100644 --- a/Swift/Controllers/PresenceNotifier.cpp +++ b/Swift/Controllers/PresenceNotifier.cpp @@ -38,7 +38,7 @@ PresenceNotifier::~PresenceNotifier() { stanzaChannel->onPresenceReceived.disconnect(boost::bind(&PresenceNotifier::handlePresenceReceived, this, _1)); } -void PresenceNotifier::handlePresenceReceived(boost::shared_ptr<Presence> presence) { +void PresenceNotifier::handlePresenceReceived(std::shared_ptr<Presence> presence) { JID from = presence->getFrom(); if (mucRegistry->isMUC(from.toBare())) { diff --git a/Swift/Controllers/PresenceNotifier.h b/Swift/Controllers/PresenceNotifier.h index 3d498bd..defdd2f 100644 --- a/Swift/Controllers/PresenceNotifier.h +++ b/Swift/Controllers/PresenceNotifier.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <set> -#include <boost/shared_ptr.hpp> - #include <Swiften/Avatars/AvatarManager.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/Presence.h> @@ -35,7 +34,7 @@ namespace Swift { boost::signal<void (const JID&)> onNotificationActivated; private: - void handlePresenceReceived(boost::shared_ptr<Presence>); + void handlePresenceReceived(std::shared_ptr<Presence>); void handleStanzaChannelAvailableChanged(bool); void handleNotificationActivated(JID jid); void handleTimerTick(); @@ -53,7 +52,7 @@ namespace Swift { NickResolver* nickResolver; const PresenceOracle* presenceOracle; TimerFactory* timerFactory; - boost::shared_ptr<Timer> timer; + std::shared_ptr<Timer> timer; bool justInitialized; bool inQuietPeriod; std::set<JID> availableUsers; diff --git a/Swift/Controllers/ProfileController.cpp b/Swift/Controllers/ProfileController.cpp index 48a4c93..d000164 100644 --- a/Swift/Controllers/ProfileController.cpp +++ b/Swift/Controllers/ProfileController.cpp @@ -33,7 +33,7 @@ ProfileController::~ProfileController() { } void ProfileController::handleUIEvent(UIEvent::ref event) { - if (!boost::dynamic_pointer_cast<RequestProfileEditorUIEvent>(event)) { + if (!std::dynamic_pointer_cast<RequestProfileEditorUIEvent>(event)) { return; } @@ -77,7 +77,7 @@ void ProfileController::handleVCardRetrievalError(const JID& jid, ErrorPayload:: if ((jid == JID()) && profileWindow) { profileWindow->setProcessing(false); profileWindow->setEnabled(false); - profileWindow->setVCard(boost::make_shared<VCard>()); + profileWindow->setVCard(std::make_shared<VCard>()); profileWindow->setError(QT_TRANSLATE_NOOP("", "There was an error fetching your current profile data")); } } diff --git a/Swift/Controllers/Roster/ContactRosterItem.cpp b/Swift/Controllers/Roster/ContactRosterItem.cpp index 89053e6..0ad023a 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.cpp +++ b/Swift/Controllers/Roster/ContactRosterItem.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. */ @@ -87,14 +87,14 @@ const JID& ContactRosterItem::getDisplayJID() const { } -typedef std::pair<std::string, boost::shared_ptr<Presence> > StringPresencePair; +typedef std::pair<std::string, std::shared_ptr<Presence> > StringPresencePair; void ContactRosterItem::clearPresence() { presence_.reset(); onDataChanged(); } -void ContactRosterItem::applyPresence(boost::shared_ptr<Presence> presence) { +void ContactRosterItem::applyPresence(std::shared_ptr<Presence> presence) { presence_ = presence; onDataChanged(); } diff --git a/Swift/Controllers/Roster/ContactRosterItem.h b/Swift/Controllers/Roster/ContactRosterItem.h index d77ba2d..5cc722e 100644 --- a/Swift/Controllers/Roster/ContactRosterItem.h +++ b/Swift/Controllers/Roster/ContactRosterItem.h @@ -1,11 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <set> #include <string> #include <vector> @@ -13,7 +14,6 @@ #include <boost/bind.hpp> #include <boost/date_time/posix_time/ptime.hpp> #include <boost/filesystem/path.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/MUCOccupant.h> @@ -55,7 +55,7 @@ class ContactRosterItem : public RosterItem { const JID& getJID() const; void setDisplayJID(const JID& jid); const JID& getDisplayJID() const; - void applyPresence(boost::shared_ptr<Presence> presence); + void applyPresence(std::shared_ptr<Presence> presence); const std::vector<std::string>& getGroups() const; /** Only used so a contact can know about the groups it's in*/ void addGroup(const std::string& group); @@ -84,7 +84,7 @@ class ContactRosterItem : public RosterItem { JID displayJID_; boost::posix_time::ptime lastAvailableTime_; boost::filesystem::path avatarPath_; - boost::shared_ptr<Presence> presence_; + std::shared_ptr<Presence> presence_; std::vector<std::string> groups_; MUCOccupant::Role mucRole_; MUCOccupant::Affiliation mucAffiliation_; diff --git a/Swift/Controllers/Roster/Roster.h b/Swift/Controllers/Roster/Roster.h index 70e5bab..3bd9ec0 100644 --- a/Swift/Controllers/Roster/Roster.h +++ b/Swift/Controllers/Roster/Roster.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. */ @@ -7,12 +7,11 @@ #pragma once #include <map> +#include <memory> #include <set> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/JID/JID.h> diff --git a/Swift/Controllers/Roster/RosterController.cpp b/Swift/Controllers/Roster/RosterController.cpp index f863ed7..47c24fc 100644 --- a/Swift/Controllers/Roster/RosterController.cpp +++ b/Swift/Controllers/Roster/RosterController.cpp @@ -6,8 +6,9 @@ #include <Swift/Controllers/Roster/RosterController.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Avatars/AvatarManager.h> #include <Swiften/Base/Path.h> @@ -96,7 +97,7 @@ RosterController::RosterController(const JID& jid, XMPPRoster* xmppRoster, Avata handleShowOfflineToggled(settings_->getSetting(SettingConstants::SHOW_OFFLINE)); - ownContact_ = boost::make_shared<ContactRosterItem>(myJID_.toBare(), myJID_.toBare(), nickManager_->getOwnNick(), static_cast<GroupRosterItem*>(nullptr)); + ownContact_ = std::make_shared<ContactRosterItem>(myJID_.toBare(), myJID_.toBare(), nickManager_->getOwnNick(), static_cast<GroupRosterItem*>(nullptr)); ownContact_->setVCard(vcardManager_->getVCard(myJID_.toBare())); ownContact_->setAvatarPath(pathToString(avatarManager_->getAvatarPath(myJID_.toBare()))); mainWindow_->setMyContactRosterItem(ownContact_); @@ -216,39 +217,39 @@ void RosterController::handleBlockingItemRemoved(const JID& jid) { roster_->applyOnItems(SetBlockingState(jid, ContactRosterItem::IsUnblocked)); } -void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) { - if (boost::shared_ptr<AddContactUIEvent> addContactEvent = boost::dynamic_pointer_cast<AddContactUIEvent>(event)) { +void RosterController::handleUIEvent(std::shared_ptr<UIEvent> event) { + if (std::shared_ptr<AddContactUIEvent> addContactEvent = std::dynamic_pointer_cast<AddContactUIEvent>(event)) { RosterItemPayload item; item.setName(addContactEvent->getName()); item.setJID(addContactEvent->getJID()); item.setGroups(std::vector<std::string>(addContactEvent->getGroups().begin(), addContactEvent->getGroups().end())); - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); + std::shared_ptr<RosterPayload> roster(new RosterPayload()); roster->addItem(item); SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_); request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster)); request->send(); subscriptionManager_->requestSubscription(addContactEvent->getJID()); } - else if (boost::shared_ptr<RemoveRosterItemUIEvent> removeEvent = boost::dynamic_pointer_cast<RemoveRosterItemUIEvent>(event)) { + else if (std::shared_ptr<RemoveRosterItemUIEvent> removeEvent = std::dynamic_pointer_cast<RemoveRosterItemUIEvent>(event)) { RosterItemPayload item(removeEvent->getJID(), "", RosterItemPayload::Remove); - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); + std::shared_ptr<RosterPayload> roster(new RosterPayload()); roster->addItem(item); SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_); request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster)); request->send(); } - else if (boost::shared_ptr<RenameRosterItemUIEvent> renameEvent = boost::dynamic_pointer_cast<RenameRosterItemUIEvent>(event)) { + else if (std::shared_ptr<RenameRosterItemUIEvent> renameEvent = std::dynamic_pointer_cast<RenameRosterItemUIEvent>(event)) { JID contact(renameEvent->getJID()); RosterItemPayload item(contact, renameEvent->getNewName(), xmppRoster_->getSubscriptionStateForJID(contact)); item.setGroups(xmppRoster_->getGroupsForJID(contact)); - boost::shared_ptr<RosterPayload> roster(new RosterPayload()); + std::shared_ptr<RosterPayload> roster(new RosterPayload()); roster->addItem(item); SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_); request->onResponse.connect(boost::bind(&RosterController::handleRosterSetError, this, _1, roster)); request->send(); } - else if (boost::shared_ptr<RenameGroupUIEvent> renameGroupEvent = boost::dynamic_pointer_cast<RenameGroupUIEvent>(event)) { + else if (std::shared_ptr<RenameGroupUIEvent> renameGroupEvent = std::dynamic_pointer_cast<RenameGroupUIEvent>(event)) { std::vector<XMPPRosterItem> items = xmppRoster_->getItems(); std::string group = renameGroupEvent->getGroup(); // FIXME: We should handle contacts groups specially to avoid clashes @@ -267,7 +268,7 @@ void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) { } } } - else if (boost::shared_ptr<SendFileUIEvent> sendFileEvent = boost::dynamic_pointer_cast<SendFileUIEvent>(event)) { + else if (std::shared_ptr<SendFileUIEvent> sendFileEvent = std::dynamic_pointer_cast<SendFileUIEvent>(event)) { //TODO add send file dialog to ChatView of receipient jid ftOverview_->sendFile(sendFileEvent->getJID(), sendFileEvent->getFilename()); } @@ -281,7 +282,7 @@ void RosterController::updateItem(const XMPPRosterItem& item) { RosterItemPayload itemPayload(item.getJID(), item.getName(), item.getSubscription()); itemPayload.setGroups(item.getGroups()); - RosterPayload::ref roster = boost::make_shared<RosterPayload>(); + RosterPayload::ref roster = std::make_shared<RosterPayload>(); roster->addItem(itemPayload); SetRosterRequest::ref request = SetRosterRequest::create(roster, iqRouter_); @@ -290,7 +291,7 @@ void RosterController::updateItem(const XMPPRosterItem& item) { } void RosterController::initBlockingCommand() { - boost::shared_ptr<BlockList> blockList = clientBlockListManager_->requestBlockList(); + std::shared_ptr<BlockList> blockList = clientBlockListManager_->requestBlockList(); blockingOnStateChangedConnection_ = blockList->onStateChanged.connect(boost::bind(&RosterController::handleBlockingStateChanged, this)); blockingOnItemAddedConnection_ = blockList->onItemAdded.connect(boost::bind(&RosterController::handleBlockingItemAdded, this, _1)); @@ -303,11 +304,11 @@ void RosterController::initBlockingCommand() { } } -void RosterController::handleRosterItemUpdated(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload) { +void RosterController::handleRosterItemUpdated(ErrorPayload::ref error, std::shared_ptr<RosterPayload> rosterPayload) { if (!!error) { handleRosterSetError(error, rosterPayload); } - boost::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); + std::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList(); std::vector<RosterItemPayload> items = rosterPayload->getItems(); if (blockList->getState() == BlockList::Available && items.size() > 0) { std::vector<JID> jids = blockList->getItems(); @@ -317,7 +318,7 @@ void RosterController::handleRosterItemUpdated(ErrorPayload::ref error, boost::s } } -void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload) { +void RosterController::handleRosterSetError(ErrorPayload::ref error, std::shared_ptr<RosterPayload> rosterPayload) { if (!error) { return; } @@ -325,7 +326,7 @@ void RosterController::handleRosterSetError(ErrorPayload::ref error, boost::shar if (!error->getText().empty()) { text += ": " + error->getText(); } - boost::shared_ptr<ErrorEvent> errorEvent(new ErrorEvent(JID(myJID_.getDomain()), text)); + std::shared_ptr<ErrorEvent> errorEvent(new ErrorEvent(JID(myJID_.getDomain()), text)); eventController_->handleIncomingEvent(errorEvent); } @@ -350,7 +351,7 @@ void RosterController::handleSubscriptionRequest(const JID& jid, const std::stri SubscriptionRequestEvent* eventPointer = new SubscriptionRequestEvent(jid, message); eventPointer->onAccept.connect(boost::bind(&RosterController::handleSubscriptionRequestAccepted, this, eventPointer)); eventPointer->onDecline.connect(boost::bind(&RosterController::handleSubscriptionRequestDeclined, this, eventPointer)); - boost::shared_ptr<StanzaEvent> event(eventPointer); + std::shared_ptr<StanzaEvent> event(eventPointer); eventController_->handleIncomingEvent(event); } diff --git a/Swift/Controllers/Roster/RosterController.h b/Swift/Controllers/Roster/RosterController.h index f1660a8..333a0a5 100644 --- a/Swift/Controllers/Roster/RosterController.h +++ b/Swift/Controllers/Roster/RosterController.h @@ -1,16 +1,15 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <set> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Avatars/AvatarManager.h> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/ErrorPayload.h> @@ -77,13 +76,13 @@ namespace Swift { void handleStartChatRequest(const JID& contact); void handleChangeStatusRequest(StatusShow::Type show, const std::string &statusText); void handleShowOfflineToggled(bool state); - void handleIncomingPresence(boost::shared_ptr<Presence> newPresence); + void handleIncomingPresence(std::shared_ptr<Presence> newPresence); void handleSubscriptionRequest(const JID& jid, const std::string& message); void handleSubscriptionRequestAccepted(SubscriptionRequestEvent* event); void handleSubscriptionRequestDeclined(SubscriptionRequestEvent* event); - void handleUIEvent(boost::shared_ptr<UIEvent> event); - void handleRosterItemUpdated(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload); - void handleRosterSetError(ErrorPayload::ref error, boost::shared_ptr<RosterPayload> rosterPayload); + void handleUIEvent(std::shared_ptr<UIEvent> event); + void handleRosterItemUpdated(ErrorPayload::ref error, std::shared_ptr<RosterPayload> rosterPayload); + void handleRosterSetError(ErrorPayload::ref error, std::shared_ptr<RosterPayload> rosterPayload); void applyAllPresenceTo(const JID& jid); void handleEditProfileRequest(); void handleOnCapsChanged(const JID& jid); @@ -114,7 +113,7 @@ namespace Swift { FileTransferOverview* ftOverview_; ClientBlockListManager* clientBlockListManager_; RosterVCardProvider* rosterVCardProvider_; - boost::shared_ptr<ContactRosterItem> ownContact_; + std::shared_ptr<ContactRosterItem> ownContact_; boost::bsignals::scoped_connection blockingOnStateChangedConnection_; boost::bsignals::scoped_connection blockingOnItemAddedConnection_; diff --git a/Swift/Controllers/Roster/RosterItem.h b/Swift/Controllers/Roster/RosterItem.h index e7a3e20..2c51ae9 100644 --- a/Swift/Controllers/Roster/RosterItem.h +++ b/Swift/Controllers/Roster/RosterItem.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> namespace Swift { diff --git a/Swift/Controllers/Roster/TableRoster.h b/Swift/Controllers/Roster/TableRoster.h index 3d336ef..19a4ec6 100644 --- a/Swift/Controllers/Roster/TableRoster.h +++ b/Swift/Controllers/Roster/TableRoster.h @@ -80,6 +80,6 @@ namespace Swift { Roster* model; std::vector<Section> sections; bool updatePending; - boost::shared_ptr<Timer> updateTimer; + std::shared_ptr<Timer> updateTimer; }; } diff --git a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp index 91cc764..e01f78a 100644 --- a/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/RosterControllerTest.cpp @@ -318,10 +318,10 @@ class RosterControllerTest : public CppUnit::TestFixture { groups.push_back("Enemies"); xmppRoster_->addContact(jid, "Bob", groups, RosterItemPayload::From); CPPUNIT_ASSERT_EQUAL(groups.size(), xmppRoster_->getGroupsForJID(jid).size()); - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RenameRosterItemUIEvent(jid, "Robert"))); + uiEventStream_->send(std::make_shared<RenameRosterItemUIEvent>(jid, "Robert")); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), channel_->iqs_.size()); CPPUNIT_ASSERT_EQUAL(IQ::Set, channel_->iqs_[0]->getType()); - boost::shared_ptr<RosterPayload> payload = channel_->iqs_[0]->getPayload<RosterPayload>(); + std::shared_ptr<RosterPayload> payload = channel_->iqs_[0]->getPayload<RosterPayload>(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), payload->getItems().size()); RosterItemPayload item = payload->getItems()[0]; CPPUNIT_ASSERT_EQUAL(jid, item.getJID()); diff --git a/Swift/Controllers/Roster/UnitTest/RosterTest.cpp b/Swift/Controllers/Roster/UnitTest/RosterTest.cpp index dd22cb7..4687176 100644 --- a/Swift/Controllers/Roster/UnitTest/RosterTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/RosterTest.cpp @@ -4,7 +4,7 @@ * See the COPYING file for more information. */ -#include <boost/shared_ptr.hpp> +#include <memory> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -90,7 +90,7 @@ class RosterTest : public CppUnit::TestFixture { roster_->removeContact(jid4b); roster_->addContact(jid4c, JID(), "Bert", "group1", ""); roster_->addContact(jid4b, JID(), "Ernie", "group1", ""); - boost::shared_ptr<Presence> presence(new Presence()); + std::shared_ptr<Presence> presence(new Presence()); presence->setShow(StatusShow::DND); presence->setFrom(jid4a); roster_->applyOnItems(SetPresence(presence, JID::WithResource)); @@ -99,7 +99,7 @@ class RosterTest : public CppUnit::TestFixture { presence->setFrom(jid4c); roster_->applyOnItems(SetPresence(presence, JID::WithResource)); - presence = boost::make_shared<Presence>(); + presence = std::make_shared<Presence>(); presence->setFrom(jid4b); presence->setShow(StatusShow::Online); roster_->applyOnItems(SetPresence(presence, JID::WithResource)); @@ -111,7 +111,7 @@ class RosterTest : public CppUnit::TestFixture { CPPUNIT_ASSERT_EQUAL(std::string("Bert"), children[1]->getDisplayName()); CPPUNIT_ASSERT_EQUAL(std::string("Bird"), children[2]->getDisplayName()); - presence = boost::make_shared<Presence>(); + presence = std::make_shared<Presence>(); presence->setFrom(jid4c); presence->setType(Presence::Unavailable); roster_->removeContact(jid4c); diff --git a/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp b/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp index 086bd6f..e4e8bdb 100644 --- a/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -16,7 +16,7 @@ std::ostream& operator<<(std::ostream& os, const Swift::TableRoster::Index& i) { #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include <boost/shared_ptr.hpp> +#include <memory> #include <boost/variant.hpp> #include <Swiften/Network/DummyTimerFactory.h> @@ -46,7 +46,7 @@ class TableRosterTest : public CppUnit::TestFixture { void testAddContact_EmptyRoster() { /* - boost::shared_ptr<TableRoster> tableRoster(createTestling()); + std::shared_ptr<TableRoster> tableRoster(createTestling()); addContact(jid1, "1", "group1"); diff --git a/Swift/Controllers/ShowProfileController.cpp b/Swift/Controllers/ShowProfileController.cpp index bf5eb1e..add6e73 100644 --- a/Swift/Controllers/ShowProfileController.cpp +++ b/Swift/Controllers/ShowProfileController.cpp @@ -41,7 +41,7 @@ ShowProfileController::~ShowProfileController() { } void ShowProfileController::handleUIEvent(UIEvent::ref event) { - ShowProfileForRosterItemUIEvent::ref showProfileEvent = boost::dynamic_pointer_cast<ShowProfileForRosterItemUIEvent>(event); + ShowProfileForRosterItemUIEvent::ref showProfileEvent = std::dynamic_pointer_cast<ShowProfileForRosterItemUIEvent>(event); if (!showProfileEvent) { return; } diff --git a/Swift/Controllers/SoundEventController.cpp b/Swift/Controllers/SoundEventController.cpp index 433937b..5c7568f 100644 --- a/Swift/Controllers/SoundEventController.cpp +++ b/Swift/Controllers/SoundEventController.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. */ @@ -30,8 +30,8 @@ SoundEventController::SoundEventController(EventController* eventController, Sou playSounds_ = settings->getSetting(SettingConstants::PLAY_SOUNDS); } -void SoundEventController::handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent> event) { - if (playSounds_ && boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event)) { +void SoundEventController::handleEventQueueEventAdded(std::shared_ptr<StanzaEvent> event) { + if (playSounds_ && std::dynamic_pointer_cast<IncomingFileTransferEvent>(event)) { soundPlayer_->playSound(SoundPlayer::MessageReceived, ""); } } diff --git a/Swift/Controllers/SoundEventController.h b/Swift/Controllers/SoundEventController.h index 3ea682a..e5b43b4 100644 --- a/Swift/Controllers/SoundEventController.h +++ b/Swift/Controllers/SoundEventController.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swift/Controllers/HighlightAction.h> #include <Swift/Controllers/Settings/SettingsProvider.h> @@ -23,7 +23,7 @@ namespace Swift { bool getSoundEnabled() {return playSounds_;} private: void handleSettingChanged(const std::string& settingPath); - void handleEventQueueEventAdded(boost::shared_ptr<StanzaEvent> event); + void handleEventQueueEventAdded(std::shared_ptr<StanzaEvent> event); void handleHighlight(const HighlightAction& action); EventController* eventController_; SoundPlayer* soundPlayer_; diff --git a/Swift/Controllers/StatusTracker.cpp b/Swift/Controllers/StatusTracker.cpp index 51db328..56cd27f 100644 --- a/Swift/Controllers/StatusTracker.cpp +++ b/Swift/Controllers/StatusTracker.cpp @@ -6,7 +6,7 @@ #include <Swift/Controllers/StatusTracker.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <Swiften/Elements/Idle.h> @@ -14,27 +14,27 @@ namespace Swift { StatusTracker::StatusTracker() { isAutoAway_ = false; - queuedPresence_ = boost::make_shared<Presence>(); + queuedPresence_ = std::make_shared<Presence>(); } -boost::shared_ptr<Presence> StatusTracker::getNextPresence() { - boost::shared_ptr<Presence> presence; +std::shared_ptr<Presence> StatusTracker::getNextPresence() { + std::shared_ptr<Presence> presence; if (isAutoAway_) { - presence = boost::make_shared<Presence>(); + presence = std::make_shared<Presence>(); presence->setShow(StatusShow::Away); presence->setStatus(queuedPresence_->getStatus()); - presence->addPayload(boost::make_shared<Idle>(isAutoAwaySince_)); + presence->addPayload(std::make_shared<Idle>(isAutoAwaySince_)); } else { presence = queuedPresence_; } return presence; } -void StatusTracker::setRequestedPresence(boost::shared_ptr<Presence> presence) { +void StatusTracker::setRequestedPresence(std::shared_ptr<Presence> presence) { isAutoAway_ = false; queuedPresence_ = presence; // if (presence->getType() == Presence::Unavailable) { -// queuedPresence_ = boost::make_shared<Presence>(); +// queuedPresence_ = std::make_shared<Presence>(); // } } diff --git a/Swift/Controllers/StatusTracker.h b/Swift/Controllers/StatusTracker.h index cf92781..a74ab6e 100644 --- a/Swift/Controllers/StatusTracker.h +++ b/Swift/Controllers/StatusTracker.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Elements/Presence.h> @@ -16,12 +17,12 @@ namespace Swift { class StatusTracker { public: StatusTracker(); - boost::shared_ptr<Presence> getNextPresence(); - void setRequestedPresence(boost::shared_ptr<Presence> presence); + std::shared_ptr<Presence> getNextPresence(); + void setRequestedPresence(std::shared_ptr<Presence> presence); bool goAutoAway(const int& seconds); bool goAutoUnAway(); private: - boost::shared_ptr<Presence> queuedPresence_; + std::shared_ptr<Presence> queuedPresence_; bool isAutoAway_; boost::posix_time::ptime isAutoAwaySince_; }; diff --git a/Swift/Controllers/Storages/RosterFileStorage.cpp b/Swift/Controllers/Storages/RosterFileStorage.cpp index 6cc5c61..1f0a90b 100644 --- a/Swift/Controllers/Storages/RosterFileStorage.cpp +++ b/Swift/Controllers/Storages/RosterFileStorage.cpp @@ -17,10 +17,10 @@ typedef GenericPayloadPersister<RosterPayload, RosterParser, RosterSerializer> R RosterFileStorage::RosterFileStorage(const boost::filesystem::path& path) : path(path) { } -boost::shared_ptr<RosterPayload> RosterFileStorage::getRoster() const { +std::shared_ptr<RosterPayload> RosterFileStorage::getRoster() const { return RosterPersister().loadPayloadGeneric(path); } -void RosterFileStorage::setRoster(boost::shared_ptr<RosterPayload> roster) { +void RosterFileStorage::setRoster(std::shared_ptr<RosterPayload> roster) { RosterPersister().savePayload(roster, path); } diff --git a/Swift/Controllers/Storages/RosterFileStorage.h b/Swift/Controllers/Storages/RosterFileStorage.h index dd1a6c9..38e26c9 100644 --- a/Swift/Controllers/Storages/RosterFileStorage.h +++ b/Swift/Controllers/Storages/RosterFileStorage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 Isode Limited. + * Copyright (c) 2011-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -15,8 +15,8 @@ namespace Swift { public: RosterFileStorage(const boost::filesystem::path& path); - virtual boost::shared_ptr<RosterPayload> getRoster() const; - virtual void setRoster(boost::shared_ptr<RosterPayload>); + virtual std::shared_ptr<RosterPayload> getRoster() const; + virtual void setRoster(std::shared_ptr<RosterPayload>); private: boost::filesystem::path path; diff --git a/Swift/Controllers/Storages/VCardFileStorage.cpp b/Swift/Controllers/Storages/VCardFileStorage.cpp index 720165a..dbb6799 100644 --- a/Swift/Controllers/Storages/VCardFileStorage.cpp +++ b/Swift/Controllers/Storages/VCardFileStorage.cpp @@ -53,8 +53,8 @@ VCardFileStorage::VCardFileStorage(boost::filesystem::path dir, CryptoProvider* } } -boost::shared_ptr<VCard> VCardFileStorage::getVCard(const JID& jid) const { - boost::shared_ptr<VCard> result = VCardPersister().loadPayloadGeneric(getVCardPath(jid)); +std::shared_ptr<VCard> VCardFileStorage::getVCard(const JID& jid) const { + std::shared_ptr<VCard> result = VCardPersister().loadPayloadGeneric(getVCardPath(jid)); getAndUpdatePhotoHash(jid, result); return result; } diff --git a/Swift/Controllers/Storages/VCardFileStorage.h b/Swift/Controllers/Storages/VCardFileStorage.h index 971a3f9..a91e914 100644 --- a/Swift/Controllers/Storages/VCardFileStorage.h +++ b/Swift/Controllers/Storages/VCardFileStorage.h @@ -7,10 +7,10 @@ #pragma once #include <map> +#include <memory> #include <string> #include <boost/filesystem/path.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/VCards/VCardStorage.h> diff --git a/Swift/Controllers/SystemTrayController.cpp b/Swift/Controllers/SystemTrayController.cpp index 72d3403..28dbf5e 100644 --- a/Swift/Controllers/SystemTrayController.cpp +++ b/Swift/Controllers/SystemTrayController.cpp @@ -23,7 +23,7 @@ void SystemTrayController::handleEventQueueLengthChange(int /*length*/) { EventList events = eventController_->getEvents(); bool found = false; for (EventList::iterator it = events.begin(); it != events.end(); ++it) { - if (boost::dynamic_pointer_cast<MessageEvent>(*it)) { + if (std::dynamic_pointer_cast<MessageEvent>(*it)) { found = true; break; } diff --git a/Swift/Controllers/UIEvents/AcceptWhiteboardSessionUIEvent.h b/Swift/Controllers/UIEvents/AcceptWhiteboardSessionUIEvent.h index b46774c..ac76ec4 100644 --- a/Swift/Controllers/UIEvents/AcceptWhiteboardSessionUIEvent.h +++ b/Swift/Controllers/UIEvents/AcceptWhiteboardSessionUIEvent.h @@ -4,9 +4,15 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/JID/JID.h> @@ -14,7 +20,7 @@ namespace Swift { class AcceptWhiteboardSessionUIEvent : public UIEvent { - typedef boost::shared_ptr<AcceptWhiteboardSessionUIEvent> ref; + typedef std::shared_ptr<AcceptWhiteboardSessionUIEvent> ref; public: AcceptWhiteboardSessionUIEvent(const JID& jid) : jid_(jid) {} const JID& getContact() const {return jid_;} diff --git a/Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h b/Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h index 526fc0d..e1d6744 100644 --- a/Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h +++ b/Swift/Controllers/UIEvents/AddMUCBookmarkUIEvent.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/MUC/MUCBookmark.h> diff --git a/Swift/Controllers/UIEvents/CancelWhiteboardSessionUIEvent.h b/Swift/Controllers/UIEvents/CancelWhiteboardSessionUIEvent.h index 62751b6..1e9491f 100644 --- a/Swift/Controllers/UIEvents/CancelWhiteboardSessionUIEvent.h +++ b/Swift/Controllers/UIEvents/CancelWhiteboardSessionUIEvent.h @@ -4,9 +4,15 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/JID/JID.h> @@ -14,7 +20,7 @@ namespace Swift { class CancelWhiteboardSessionUIEvent : public UIEvent { - typedef boost::shared_ptr<CancelWhiteboardSessionUIEvent> ref; + typedef std::shared_ptr<CancelWhiteboardSessionUIEvent> ref; public: CancelWhiteboardSessionUIEvent(const JID& jid) : jid_(jid) {} const JID& getContact() const {return jid_;} diff --git a/Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h b/Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h index b3d3118..33f38f2 100644 --- a/Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h +++ b/Swift/Controllers/UIEvents/EditMUCBookmarkUIEvent.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/MUC/MUCBookmark.h> diff --git a/Swift/Controllers/UIEvents/InviteToMUCUIEvent.h b/Swift/Controllers/UIEvents/InviteToMUCUIEvent.h index e1416de..414582d 100644 --- a/Swift/Controllers/UIEvents/InviteToMUCUIEvent.h +++ b/Swift/Controllers/UIEvents/InviteToMUCUIEvent.h @@ -12,10 +12,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/JID/JID.h> #include <Swift/Controllers/UIEvents/UIEvent.h> @@ -23,7 +22,7 @@ namespace Swift { class InviteToMUCUIEvent : public UIEvent { public: - typedef boost::shared_ptr<InviteToMUCUIEvent> ref; + typedef std::shared_ptr<InviteToMUCUIEvent> ref; InviteToMUCUIEvent(const JID& room, const std::vector<JID>& JIDsToInvite, const std::string& reason) : room_(room), invite_(JIDsToInvite), reason_(reason) { } diff --git a/Swift/Controllers/UIEvents/JoinMUCUIEvent.h b/Swift/Controllers/UIEvents/JoinMUCUIEvent.h index 076b5b6..5d6df55 100644 --- a/Swift/Controllers/UIEvents/JoinMUCUIEvent.h +++ b/Swift/Controllers/UIEvents/JoinMUCUIEvent.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/JID/JID.h> @@ -18,7 +18,7 @@ namespace Swift { class JoinMUCUIEvent : public UIEvent { public: - typedef boost::shared_ptr<JoinMUCUIEvent> ref; + typedef std::shared_ptr<JoinMUCUIEvent> ref; JoinMUCUIEvent(const JID& jid, const boost::optional<std::string>& password = boost::optional<std::string>(), const boost::optional<std::string>& nick = boost::optional<std::string>(), bool joinAutomaticallyInFuture = false, bool createAsReservedRoomIfNew = false, bool isImpromptu = false, bool isContinuation = false) : jid_(jid), nick_(nick), joinAutomatically_(joinAutomaticallyInFuture), createAsReservedRoomIfNew_(createAsReservedRoomIfNew), password_(password), isImpromptuMUC_(isImpromptu), isContinuation_(isContinuation) {} const boost::optional<std::string>& getNick() const {return nick_;} const JID& getJID() const {return jid_;} diff --git a/Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h b/Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h index 2803197..b73eda5 100644 --- a/Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h +++ b/Swift/Controllers/UIEvents/RemoveMUCBookmarkUIEvent.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/MUC/MUCBookmark.h> diff --git a/Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h b/Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h index 7d370e2..1a71cb4 100644 --- a/Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h +++ b/Swift/Controllers/UIEvents/RenameRosterItemUIEvent.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/MUC/MUCBookmark.h> diff --git a/Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h b/Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h index 5693ab1..25a5e42 100644 --- a/Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h +++ b/Swift/Controllers/UIEvents/RequestContactEditorUIEvent.h @@ -13,7 +13,7 @@ namespace Swift { class RequestContactEditorUIEvent : public UIEvent { public: - typedef boost::shared_ptr<RequestContactEditorUIEvent> ref; + typedef std::shared_ptr<RequestContactEditorUIEvent> ref; RequestContactEditorUIEvent(const JID& jid) : jid(jid) { } diff --git a/Swift/Controllers/UIEvents/RequestInviteToMUCUIEvent.h b/Swift/Controllers/UIEvents/RequestInviteToMUCUIEvent.h index 9a1abb1..dac499f 100644 --- a/Swift/Controllers/UIEvents/RequestInviteToMUCUIEvent.h +++ b/Swift/Controllers/UIEvents/RequestInviteToMUCUIEvent.h @@ -12,10 +12,9 @@ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/JID/JID.h> #include <Swift/Controllers/UIEvents/UIEvent.h> @@ -23,7 +22,7 @@ namespace Swift { class RequestInviteToMUCUIEvent : public UIEvent { public: - typedef boost::shared_ptr<RequestInviteToMUCUIEvent> ref; + typedef std::shared_ptr<RequestInviteToMUCUIEvent> ref; enum ImpromptuMode { Impromptu, diff --git a/Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h b/Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h index a2a4183..5e94290 100644 --- a/Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h +++ b/Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/JID/JID.h> #include <Swift/Controllers/UIEvents/UIEvent.h> @@ -17,7 +16,7 @@ namespace Swift { class RequestJoinMUCUIEvent : public UIEvent { public: - typedef boost::shared_ptr<RequestJoinMUCUIEvent> ref; + typedef std::shared_ptr<RequestJoinMUCUIEvent> ref; RequestJoinMUCUIEvent(const JID& room = JID()) : room(room) { } diff --git a/Swift/Controllers/UIEvents/SendFileUIEvent.h b/Swift/Controllers/UIEvents/SendFileUIEvent.h index 72452df..26e4940 100644 --- a/Swift/Controllers/UIEvents/SendFileUIEvent.h +++ b/Swift/Controllers/UIEvents/SendFileUIEvent.h @@ -21,7 +21,7 @@ namespace Swift { class SendFileUIEvent : public UIEvent { public: - typedef boost::shared_ptr<SendFileUIEvent> ref; + typedef std::shared_ptr<SendFileUIEvent> ref; SendFileUIEvent(const JID& jid, const std::string& filename) : jid(jid), filename(filename) { } diff --git a/Swift/Controllers/UIEvents/ShowProfileForRosterItemUIEvent.h b/Swift/Controllers/UIEvents/ShowProfileForRosterItemUIEvent.h index 88528d7..9b2f60f 100644 --- a/Swift/Controllers/UIEvents/ShowProfileForRosterItemUIEvent.h +++ b/Swift/Controllers/UIEvents/ShowProfileForRosterItemUIEvent.h @@ -20,7 +20,7 @@ namespace Swift { class ShowProfileForRosterItemUIEvent : public UIEvent { public: - typedef boost::shared_ptr<ShowProfileForRosterItemUIEvent> ref; + typedef std::shared_ptr<ShowProfileForRosterItemUIEvent> ref; public: ShowProfileForRosterItemUIEvent(const JID& jid) : jid_(jid) {} virtual ~ShowProfileForRosterItemUIEvent() {} diff --git a/Swift/Controllers/UIEvents/UIEvent.h b/Swift/Controllers/UIEvents/UIEvent.h index 333582d..5363a49 100644 --- a/Swift/Controllers/UIEvents/UIEvent.h +++ b/Swift/Controllers/UIEvents/UIEvent.h @@ -1,17 +1,17 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> namespace Swift { class UIEvent { public: - typedef boost::shared_ptr<UIEvent> ref; + typedef std::shared_ptr<UIEvent> ref; virtual ~UIEvent(); }; diff --git a/Swift/Controllers/UIEvents/UIEventStream.h b/Swift/Controllers/UIEvents/UIEventStream.h index 7ff1b54..977f1d3 100644 --- a/Swift/Controllers/UIEvents/UIEventStream.h +++ b/Swift/Controllers/UIEvents/UIEventStream.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/boost_bsignals.h> @@ -15,9 +15,9 @@ namespace Swift { class UIEventStream { public: - boost::signal<void (boost::shared_ptr<UIEvent>)> onUIEvent; + boost::signal<void (std::shared_ptr<UIEvent>)> onUIEvent; - void send(boost::shared_ptr<UIEvent> event) { + void send(std::shared_ptr<UIEvent> event) { onUIEvent(event); } }; diff --git a/Swift/Controllers/UIInterfaces/AdHocCommandWindowFactory.h b/Swift/Controllers/UIInterfaces/AdHocCommandWindowFactory.h index d3003f7..7b9b6f7 100644 --- a/Swift/Controllers/UIInterfaces/AdHocCommandWindowFactory.h +++ b/Swift/Controllers/UIInterfaces/AdHocCommandWindowFactory.h @@ -15,6 +15,6 @@ class AdHocCommandWindow; class AdHocCommandWindowFactory { public: virtual ~AdHocCommandWindowFactory() {} - virtual AdHocCommandWindow* createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) = 0; + virtual AdHocCommandWindow* createAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command) = 0; }; } diff --git a/Swift/Controllers/UIInterfaces/ChatListWindow.h b/Swift/Controllers/UIInterfaces/ChatListWindow.h index a94e14e..5d470cc 100644 --- a/Swift/Controllers/UIInterfaces/ChatListWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatListWindow.h @@ -8,10 +8,10 @@ #include <list> #include <map> +#include <memory> #include <set> #include <boost/filesystem/path.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Base/foreach.h> diff --git a/Swift/Controllers/UIInterfaces/ChatWindow.h b/Swift/Controllers/UIInterfaces/ChatWindow.h index 310c967..28bf543 100644 --- a/Swift/Controllers/UIInterfaces/ChatWindow.h +++ b/Swift/Controllers/UIInterfaces/ChatWindow.h @@ -6,14 +6,13 @@ #pragma once +#include <memory> #include <string> #include <vector> #include <boost/algorithm/string.hpp> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/make_shared.hpp> #include <boost/optional.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/Tristate.h> #include <Swiften/Base/boost_bsignals.h> @@ -47,13 +46,13 @@ namespace Swift { public: ChatMessage() {} ChatMessage(const std::string& text) { - append(boost::make_shared<ChatTextMessagePart>(text)); + append(std::make_shared<ChatTextMessagePart>(text)); } - void append(const boost::shared_ptr<ChatMessagePart>& part) { + void append(const std::shared_ptr<ChatMessagePart>& part) { parts_.push_back(part); } - const std::vector<boost::shared_ptr<ChatMessagePart> >& getParts() const { + const std::vector<std::shared_ptr<ChatMessagePart> >& getParts() const { return parts_; } @@ -68,7 +67,7 @@ namespace Swift { bool isMeCommand() const { bool isMeCommand = false; if (!parts_.empty()) { - boost::shared_ptr<ChatTextMessagePart> textPart = boost::dynamic_pointer_cast<ChatTextMessagePart>(parts_[0]); + std::shared_ptr<ChatTextMessagePart> textPart = std::dynamic_pointer_cast<ChatTextMessagePart>(parts_[0]); if (textPart) { if (boost::starts_with(textPart->text, "/me ")) { isMeCommand = true; @@ -79,7 +78,7 @@ namespace Swift { } private: - std::vector<boost::shared_ptr<ChatMessagePart> > parts_; + std::vector<std::shared_ptr<ChatMessagePart> > parts_; HighlightAction fullMessageHighlightAction_; }; @@ -134,11 +133,11 @@ namespace Swift { /** Add message to window. * @return id of added message (for acks). */ - virtual std::string addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual std::string addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; /** Adds action to window. * @return id of added message (for acks); */ - virtual std::string addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual std::string addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; /** Adds system message to window * @return id of added message (for replacement) diff --git a/Swift/Controllers/UIInterfaces/ContactEditWindow.h b/Swift/Controllers/UIInterfaces/ContactEditWindow.h index 055c0f0..9aa2dcb 100644 --- a/Swift/Controllers/UIInterfaces/ContactEditWindow.h +++ b/Swift/Controllers/UIInterfaces/ContactEditWindow.h @@ -6,12 +6,11 @@ #pragma once +#include <memory> #include <set> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> namespace Swift { diff --git a/Swift/Controllers/UIInterfaces/EventWindow.h b/Swift/Controllers/UIInterfaces/EventWindow.h index 1d254f4..c05976b 100644 --- a/Swift/Controllers/UIInterfaces/EventWindow.h +++ b/Swift/Controllers/UIInterfaces/EventWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swift/Controllers/XMPPEvents/StanzaEvent.h> @@ -20,8 +20,8 @@ namespace Swift { } virtual ~EventWindow() {} - virtual void addEvent(boost::shared_ptr<StanzaEvent> event, bool active) = 0; - virtual void removeEvent(boost::shared_ptr<StanzaEvent> event) = 0; + virtual void addEvent(std::shared_ptr<StanzaEvent> event, bool active) = 0; + virtual void removeEvent(std::shared_ptr<StanzaEvent> event) = 0; private: bool canDelete_; diff --git a/Swift/Controllers/UIInterfaces/LoginWindow.h b/Swift/Controllers/UIInterfaces/LoginWindow.h index cedc549..4518469 100644 --- a/Swift/Controllers/UIInterfaces/LoginWindow.h +++ b/Swift/Controllers/UIInterfaces/LoginWindow.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Client/ClientOptions.h> #include <Swiften/TLS/Certificate.h> diff --git a/Swift/Controllers/UIInterfaces/MainWindow.h b/Swift/Controllers/UIInterfaces/MainWindow.h index d8bcb58..ed225d8 100644 --- a/Swift/Controllers/UIInterfaces/MainWindow.h +++ b/Swift/Controllers/UIInterfaces/MainWindow.h @@ -6,10 +6,9 @@ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/DiscoItems.h> #include <Swiften/Elements/StatusShow.h> @@ -35,7 +34,7 @@ namespace Swift { virtual void setMyAvatarPath(const std::string& path) = 0; virtual void setMyStatusText(const std::string& status) = 0; virtual void setMyStatusType(StatusShow::Type type) = 0; - virtual void setMyContactRosterItem(boost::shared_ptr<ContactRosterItem> contact) = 0; + virtual void setMyContactRosterItem(std::shared_ptr<ContactRosterItem> contact) = 0; /** Must be able to cope with NULL to clear the roster */ virtual void setRosterModel(Roster* roster) = 0; virtual void setConnecting() = 0; diff --git a/Swift/Controllers/UIInterfaces/ProfileWindow.h b/Swift/Controllers/UIInterfaces/ProfileWindow.h index 8aa620c..27b0d1a 100644 --- a/Swift/Controllers/UIInterfaces/ProfileWindow.h +++ b/Swift/Controllers/UIInterfaces/ProfileWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/boost_bsignals.h> #include <Swiften/Elements/VCard.h> diff --git a/Swift/Controllers/UIInterfaces/UserSearchWindow.h b/Swift/Controllers/UIInterfaces/UserSearchWindow.h index 4ddc29b..55bd117 100644 --- a/Swift/Controllers/UIInterfaces/UserSearchWindow.h +++ b/Swift/Controllers/UIInterfaces/UserSearchWindow.h @@ -29,7 +29,7 @@ namespace Swift { virtual void setSelectedService(const JID& service) = 0; virtual void setServerSupportsSearch(bool support) = 0; virtual void setSearchError(bool support) = 0; - virtual void setSearchFields(boost::shared_ptr<SearchPayload> fields) = 0; + virtual void setSearchFields(std::shared_ptr<SearchPayload> fields) = 0; virtual void setNameSuggestions(const std::vector<std::string>& suggestions) = 0; virtual void prepopulateJIDAndName(const JID& jid, const std::string& name) = 0; virtual void setContactSuggestions(const std::vector<Contact::ref>& suggestions) = 0; @@ -46,7 +46,7 @@ namespace Swift { virtual void show() = 0; boost::signal<void (const JID&)> onFormRequested; - boost::signal<void (boost::shared_ptr<SearchPayload>, const JID&)> onSearchRequested; + boost::signal<void (std::shared_ptr<SearchPayload>, const JID&)> onSearchRequested; boost::signal<void (const JID&)> onNameSuggestionRequested; boost::signal<void (const std::string&)> onContactSuggestionsRequested; boost::signal<void (const std::vector<JID>&)> onJIDUpdateRequested; diff --git a/Swift/Controllers/UIInterfaces/WhiteboardWindow.h b/Swift/Controllers/UIInterfaces/WhiteboardWindow.h index f3b35db..28348df 100644 --- a/Swift/Controllers/UIInterfaces/WhiteboardWindow.h +++ b/Swift/Controllers/UIInterfaces/WhiteboardWindow.h @@ -25,7 +25,7 @@ namespace Swift { virtual ~WhiteboardWindow() {} virtual void show() = 0; - virtual void setSession(boost::shared_ptr<WhiteboardSession> session) = 0; + virtual void setSession(std::shared_ptr<WhiteboardSession> session) = 0; virtual void activateWindow() = 0; virtual void setName(const std::string& name) = 0; }; diff --git a/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h b/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h index 163368b..0153a5a 100644 --- a/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h +++ b/Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h @@ -4,6 +4,12 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #pragma once namespace Swift { @@ -14,6 +20,6 @@ namespace Swift { public : virtual ~WhiteboardWindowFactory() {} - virtual WhiteboardWindow* createWhiteboardWindow(boost::shared_ptr<WhiteboardSession> whiteboardSession) = 0; + virtual WhiteboardWindow* createWhiteboardWindow(std::shared_ptr<WhiteboardSession> whiteboardSession) = 0; }; } diff --git a/Swift/Controllers/UnitTest/ContactSuggesterTest.cpp b/Swift/Controllers/UnitTest/ContactSuggesterTest.cpp index 2bfca4b..217a2f0 100644 --- a/Swift/Controllers/UnitTest/ContactSuggesterTest.cpp +++ b/Swift/Controllers/UnitTest/ContactSuggesterTest.cpp @@ -4,9 +4,10 @@ * See the COPYING file for more information. */ +#include <memory> + #include <boost/bind.hpp> #include <boost/function.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> @@ -57,7 +58,7 @@ public: foreach (const std::string& name, words) { foreach (const std::string& jid, words) { foreach (const StatusShow::Type& status, statuses) { - contacts.push_back(boost::make_shared<Contact>(name, jid, status, "")); + contacts.push_back(std::make_shared<Contact>(name, jid, status, "")); } } } diff --git a/Swift/Controllers/UnitTest/MockChatWindow.h b/Swift/Controllers/UnitTest/MockChatWindow.h index e535eca..9a97994 100644 --- a/Swift/Controllers/UnitTest/MockChatWindow.h +++ b/Swift/Controllers/UnitTest/MockChatWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/foreach.h> @@ -18,12 +18,12 @@ namespace Swift { MockChatWindow() : labelsEnabled_(false), impromptuMUCSupported_(false) {} virtual ~MockChatWindow(); - virtual std::string addMessage(const ChatMessage& message, const std::string& /*senderName*/, bool /*senderIsSelf*/, boost::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/) { + virtual std::string addMessage(const ChatMessage& message, const std::string& /*senderName*/, bool /*senderIsSelf*/, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/) { lastMessageBody_ = bodyFromMessage(message); return "id"; } - virtual std::string addAction(const ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, boost::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/) {return "id";} + virtual std::string addAction(const ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/) {return "id";} virtual std::string addSystemMessage(const ChatMessage& message, Direction /*direction*/) { lastAddedSystemMessage_ = message; @@ -91,9 +91,9 @@ namespace Swift { virtual void setBookmarkState(RoomBookmarkState) {} static std::string bodyFromMessage(const ChatMessage& message) { - boost::shared_ptr<ChatTextMessagePart> text; - foreach (boost::shared_ptr<ChatMessagePart> part, message.getParts()) { - if ((text = boost::dynamic_pointer_cast<ChatTextMessagePart>(part))) { + std::shared_ptr<ChatTextMessagePart> text; + foreach (std::shared_ptr<ChatMessagePart> part, message.getParts()) { + if ((text = std::dynamic_pointer_cast<ChatTextMessagePart>(part))) { return text->text; } } diff --git a/Swift/Controllers/UnitTest/MockMainWindow.h b/Swift/Controllers/UnitTest/MockMainWindow.h index 43522ce..6ae2aa7 100644 --- a/Swift/Controllers/UnitTest/MockMainWindow.h +++ b/Swift/Controllers/UnitTest/MockMainWindow.h @@ -20,7 +20,7 @@ namespace Swift { virtual void setMyAvatarPath(const std::string& /*path*/) {} virtual void setMyStatusText(const std::string& /*status*/) {} virtual void setMyStatusType(StatusShow::Type /*type*/) {} - virtual void setMyContactRosterItem(boost::shared_ptr<ContactRosterItem> /*contact*/) {} + virtual void setMyContactRosterItem(std::shared_ptr<ContactRosterItem> /*contact*/) {} virtual void setAvailableAdHocCommands(const std::vector<DiscoItems::Item>& /*commands*/) {} virtual void setConnecting() {} virtual void setStreamEncryptionStatus(bool /*tlsInPlaceAndValid*/) {} diff --git a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp index b3b364f..1375475 100644 --- a/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp +++ b/Swift/Controllers/UnitTest/PresenceNotifierTest.cpp @@ -74,7 +74,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveFirstPresenceCreatesAvailableNotification() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendPresence(user1, StatusShow::Online); @@ -83,7 +83,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveSecondPresenceCreatesStatusChangeNotification() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendPresence(user1, StatusShow::Away); notifier->notifications.clear(); @@ -94,7 +94,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveUnavailablePresenceAfterAvailablePresenceCreatesUnavailableNotification() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendPresence(user1, StatusShow::Away); notifier->notifications.clear(); @@ -105,7 +105,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveUnavailablePresenceWithoutAvailableDoesNotCreateNotification() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendUnavailablePresence(user1); @@ -113,7 +113,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveAvailablePresenceAfterUnavailableCreatesAvailableNotification() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendPresence(user1, StatusShow::Away); sendUnavailablePresence(user1); notifier->notifications.clear(); @@ -125,7 +125,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveAvailablePresenceAfterReconnectCreatesAvailableNotification() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendPresence(user1, StatusShow::Away); stanzaChannel->setAvailable(false); stanzaChannel->setAvailable(true); @@ -138,7 +138,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveAvailablePresenceFromMUCDoesNotCreateNotification() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); mucRegistry->addMUC(JID("teaparty@wonderland.lit")); sendPresence(JID("teaparty@wonderland.lit/Alice"), StatusShow::Away); @@ -147,7 +147,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testNotificationPicture() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); avatarManager->avatars[user1] = createByteArray("abcdef"); sendPresence(user1, StatusShow::Online); @@ -157,7 +157,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testNotificationActivationEmitsSignal() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendPresence(user1, StatusShow::Online); CPPUNIT_ASSERT(notifier->notifications[0].callback); @@ -168,7 +168,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testNotificationSubjectContainsNameForJIDInRoster() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); roster->addContact(user1.toBare(), "User 1", std::vector<std::string>(), RosterItemPayload::Both); sendPresence(user1, StatusShow::Online); @@ -179,7 +179,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testNotificationSubjectContainsJIDForJIDNotInRoster() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendPresence(user1, StatusShow::Online); @@ -189,7 +189,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testNotificationSubjectContainsStatus() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendPresence(user1, StatusShow::Away); @@ -199,7 +199,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testNotificationMessageContainsStatusMessage() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); sendPresence(user1, StatusShow::Away); @@ -208,7 +208,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveFirstPresenceWithQuietPeriodDoesNotNotify() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); testling->setInitialQuietPeriodMS(10); sendPresence(user1, StatusShow::Online); @@ -217,7 +217,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceivePresenceDuringQuietPeriodDoesNotNotify() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); testling->setInitialQuietPeriodMS(10); sendPresence(user1, StatusShow::Online); @@ -228,7 +228,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceivePresenceDuringQuietPeriodResetsTimer() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); testling->setInitialQuietPeriodMS(10); sendPresence(user1, StatusShow::Online); @@ -241,7 +241,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceivePresenceAfterQuietPeriodNotifies() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); testling->setInitialQuietPeriodMS(10); sendPresence(user1, StatusShow::Online); @@ -252,7 +252,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveFirstPresenceWithQuietPeriodDoesNotCountAsQuietPeriod() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); testling->setInitialQuietPeriodMS(10); timerFactory->setTime(11); @@ -262,7 +262,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void testReceiveFirstPresenceAfterReconnectWithQuietPeriodDoesNotNotify() { - boost::shared_ptr<PresenceNotifier> testling = createNotifier(); + std::shared_ptr<PresenceNotifier> testling = createNotifier(); testling->setInitialQuietPeriodMS(10); sendPresence(user1, StatusShow::Online); timerFactory->setTime(15); @@ -279,15 +279,15 @@ class PresenceNotifierTest : public CppUnit::TestFixture { private: - boost::shared_ptr<PresenceNotifier> createNotifier() { - boost::shared_ptr<PresenceNotifier> result(new PresenceNotifier(stanzaChannel, notifier, mucRegistry, avatarManager, nickResolver, presenceOracle, timerFactory)); + std::shared_ptr<PresenceNotifier> createNotifier() { + std::shared_ptr<PresenceNotifier> result(new PresenceNotifier(stanzaChannel, notifier, mucRegistry, avatarManager, nickResolver, presenceOracle, timerFactory)); result->onNotificationActivated.connect(boost::bind(&PresenceNotifierTest::handleNotificationActivated, this, _1)); result->setInitialQuietPeriodMS(0); return result; } void sendPresence(const JID& jid, StatusShow::Type type) { - boost::shared_ptr<Presence> presence(new Presence()); + std::shared_ptr<Presence> presence(new Presence()); presence->setFrom(jid); presence->setShow(type); presence->setStatus("Status Message"); @@ -295,7 +295,7 @@ class PresenceNotifierTest : public CppUnit::TestFixture { } void sendUnavailablePresence(const JID& jid) { - boost::shared_ptr<Presence> presence(new Presence()); + std::shared_ptr<Presence> presence(new Presence()); presence->setType(Presence::Unavailable); presence->setFrom(jid); stanzaChannel->onPresenceReceived(presence); diff --git a/Swift/Controllers/WhiteboardManager.cpp b/Swift/Controllers/WhiteboardManager.cpp index 9594be4..fab5380 100644 --- a/Swift/Controllers/WhiteboardManager.cpp +++ b/Swift/Controllers/WhiteboardManager.cpp @@ -55,20 +55,20 @@ namespace Swift { return whiteboardWindows_[contact.toBare()]; } - void WhiteboardManager::handleUIEvent(boost::shared_ptr<UIEvent> event) { - boost::shared_ptr<RequestWhiteboardUIEvent> requestWhiteboardEvent = boost::dynamic_pointer_cast<RequestWhiteboardUIEvent>(event); + void WhiteboardManager::handleUIEvent(std::shared_ptr<UIEvent> event) { + std::shared_ptr<RequestWhiteboardUIEvent> requestWhiteboardEvent = std::dynamic_pointer_cast<RequestWhiteboardUIEvent>(event); if (requestWhiteboardEvent) { requestSession(requestWhiteboardEvent->getContact()); } - boost::shared_ptr<AcceptWhiteboardSessionUIEvent> sessionAcceptEvent = boost::dynamic_pointer_cast<AcceptWhiteboardSessionUIEvent>(event); + std::shared_ptr<AcceptWhiteboardSessionUIEvent> sessionAcceptEvent = std::dynamic_pointer_cast<AcceptWhiteboardSessionUIEvent>(event); if (sessionAcceptEvent) { acceptSession(sessionAcceptEvent->getContact()); } - boost::shared_ptr<CancelWhiteboardSessionUIEvent> sessionCancelEvent = boost::dynamic_pointer_cast<CancelWhiteboardSessionUIEvent>(event); + std::shared_ptr<CancelWhiteboardSessionUIEvent> sessionCancelEvent = std::dynamic_pointer_cast<CancelWhiteboardSessionUIEvent>(event); if (sessionCancelEvent) { cancelSession(sessionCancelEvent->getContact()); } - boost::shared_ptr<ShowWhiteboardUIEvent> showWindowEvent = boost::dynamic_pointer_cast<ShowWhiteboardUIEvent>(event); + std::shared_ptr<ShowWhiteboardUIEvent> showWindowEvent = std::dynamic_pointer_cast<ShowWhiteboardUIEvent>(event); if (showWindowEvent) { WhiteboardWindow* window = findWhiteboardWindow(showWindowEvent->getContact()); if (window != nullptr) { @@ -78,7 +78,7 @@ namespace Swift { } void WhiteboardManager::acceptSession(const JID& from) { - IncomingWhiteboardSession::ref session = boost::dynamic_pointer_cast<IncomingWhiteboardSession>(whiteboardSessionManager_->getSession(from)); + IncomingWhiteboardSession::ref session = std::dynamic_pointer_cast<IncomingWhiteboardSession>(whiteboardSessionManager_->getSession(from)); WhiteboardWindow* window = findWhiteboardWindow(from); if (session && window) { session->accept(); diff --git a/Swift/Controllers/WhiteboardManager.h b/Swift/Controllers/WhiteboardManager.h index 35ed9bd..a5ca933 100644 --- a/Swift/Controllers/WhiteboardManager.h +++ b/Swift/Controllers/WhiteboardManager.h @@ -14,8 +14,7 @@ #pragma once #include <map> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/JID/JID.h> #include <Swiften/Whiteboard/IncomingWhiteboardSession.h> @@ -43,7 +42,7 @@ namespace Swift { boost::signal< void (const JID&)> onRequestRejected; private: - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleUIEvent(std::shared_ptr<UIEvent> event); void handleSessionTerminate(const JID& contact); void handleSessionCancel(const JID& contact); void handleSessionAccept(const JID& contact); diff --git a/Swift/Controllers/XMLConsoleController.cpp b/Swift/Controllers/XMLConsoleController.cpp index 2d4ca0a..b72fde3 100644 --- a/Swift/Controllers/XMLConsoleController.cpp +++ b/Swift/Controllers/XMLConsoleController.cpp @@ -19,8 +19,8 @@ XMLConsoleController::~XMLConsoleController() { delete xmlConsoleWidget; } -void XMLConsoleController::handleUIEvent(boost::shared_ptr<UIEvent> rawEvent) { - boost::shared_ptr<RequestXMLConsoleUIEvent> event = boost::dynamic_pointer_cast<RequestXMLConsoleUIEvent>(rawEvent); +void XMLConsoleController::handleUIEvent(std::shared_ptr<UIEvent> rawEvent) { + std::shared_ptr<RequestXMLConsoleUIEvent> event = std::dynamic_pointer_cast<RequestXMLConsoleUIEvent>(rawEvent); if (event != nullptr) { if (xmlConsoleWidget == nullptr) { xmlConsoleWidget = xmlConsoleWidgetFactory->createXMLConsoleWidget(); diff --git a/Swift/Controllers/XMLConsoleController.h b/Swift/Controllers/XMLConsoleController.h index eac27d3..16278a3 100644 --- a/Swift/Controllers/XMLConsoleController.h +++ b/Swift/Controllers/XMLConsoleController.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/bind.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/SafeByteArray.h> #include <Swiften/Base/boost_bsignals.h> @@ -29,7 +30,7 @@ namespace Swift { void handleDataWritten(const SafeByteArray& data); private: - void handleUIEvent(boost::shared_ptr<UIEvent> event); + void handleUIEvent(std::shared_ptr<UIEvent> event); private: XMLConsoleWidgetFactory* xmlConsoleWidgetFactory; diff --git a/Swift/Controllers/XMPPEvents/ErrorEvent.h b/Swift/Controllers/XMPPEvents/ErrorEvent.h index 959f210..f3888cb 100644 --- a/Swift/Controllers/XMPPEvents/ErrorEvent.h +++ b/Swift/Controllers/XMPPEvents/ErrorEvent.h @@ -7,10 +7,9 @@ #pragma once #include <cassert> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/JID/JID.h> diff --git a/Swift/Controllers/XMPPEvents/EventController.cpp b/Swift/Controllers/XMPPEvents/EventController.cpp index 4c6b3bc..f0debb9 100644 --- a/Swift/Controllers/XMPPEvents/EventController.cpp +++ b/Swift/Controllers/XMPPEvents/EventController.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. */ @@ -25,23 +25,23 @@ EventController::EventController() { } EventController::~EventController() { - foreach(boost::shared_ptr<StanzaEvent> event, events_) { + foreach(std::shared_ptr<StanzaEvent> event, events_) { event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event)); } } -void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent) { - boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(sourceEvent); - boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(sourceEvent); - boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(sourceEvent); - boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(sourceEvent); - boost::shared_ptr<IncomingFileTransferEvent> incomingFileTransferEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(sourceEvent); +void EventController::handleIncomingEvent(std::shared_ptr<StanzaEvent> sourceEvent) { + std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(sourceEvent); + std::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(sourceEvent); + std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(sourceEvent); + std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(sourceEvent); + std::shared_ptr<IncomingFileTransferEvent> incomingFileTransferEvent = std::dynamic_pointer_cast<IncomingFileTransferEvent>(sourceEvent); /* If it's a duplicate subscription request, remove the previous request first */ if (subscriptionEvent) { EventList existingEvents(events_); - foreach(boost::shared_ptr<StanzaEvent> existingEvent, existingEvents) { - boost::shared_ptr<SubscriptionRequestEvent> existingSubscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(existingEvent); + foreach(std::shared_ptr<StanzaEvent> existingEvent, existingEvents) { + std::shared_ptr<SubscriptionRequestEvent> existingSubscriptionEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(existingEvent); if (existingSubscriptionEvent) { if (existingSubscriptionEvent->getJID() == subscriptionEvent->getJID()) { existingEvent->conclude(); @@ -61,7 +61,7 @@ void EventController::handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceE } } -void EventController::handleEventConcluded(boost::shared_ptr<StanzaEvent> event) { +void EventController::handleEventConcluded(std::shared_ptr<StanzaEvent> event) { event->onConclusion.disconnect(boost::bind(&EventController::handleEventConcluded, this, event)); events_.erase(std::remove(events_.begin(), events_.end(), event), events_.end()); onEventQueueLengthChange(boost::numeric_cast<int>(events_.size())); diff --git a/Swift/Controllers/XMPPEvents/EventController.h b/Swift/Controllers/XMPPEvents/EventController.h index 3081449..1e198cb 100644 --- a/Swift/Controllers/XMPPEvents/EventController.h +++ b/Swift/Controllers/XMPPEvents/EventController.h @@ -1,36 +1,35 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <vector> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swift/Controllers/XMPPEvents/MessageEvent.h> #include <Swift/Controllers/XMPPEvents/StanzaEvent.h> namespace Swift { - typedef std::vector<boost::shared_ptr<StanzaEvent> > EventList; + typedef std::vector<std::shared_ptr<StanzaEvent> > EventList; class EventController { public: EventController(); ~EventController(); - void handleIncomingEvent(boost::shared_ptr<StanzaEvent> sourceEvent); + void handleIncomingEvent(std::shared_ptr<StanzaEvent> sourceEvent); boost::signal<void (int)> onEventQueueLengthChange; - boost::signal<void (boost::shared_ptr<StanzaEvent>)> onEventQueueEventAdded; + boost::signal<void (std::shared_ptr<StanzaEvent>)> onEventQueueEventAdded; const EventList& getEvents() const {return events_;} void disconnectAll(); void clear(); private: - void handleEventConcluded(boost::shared_ptr<StanzaEvent> event); + void handleEventConcluded(std::shared_ptr<StanzaEvent> event); EventList events_; }; } diff --git a/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h b/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h index 4c128e8..3d4303d 100644 --- a/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h +++ b/Swift/Controllers/XMPPEvents/IncomingFileTransferEvent.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/JID/JID.h> @@ -15,7 +15,7 @@ namespace Swift { class IncomingFileTransferEvent : public StanzaEvent { public: - typedef boost::shared_ptr<IncomingFileTransferEvent> ref; + typedef std::shared_ptr<IncomingFileTransferEvent> ref; IncomingFileTransferEvent(const JID& sender) : sender_(sender) {} diff --git a/Swift/Controllers/XMPPEvents/MUCInviteEvent.h b/Swift/Controllers/XMPPEvents/MUCInviteEvent.h index 7d333fb..4cdbbff 100644 --- a/Swift/Controllers/XMPPEvents/MUCInviteEvent.h +++ b/Swift/Controllers/XMPPEvents/MUCInviteEvent.h @@ -5,17 +5,16 @@ */ /* - * Copyright (c) 2015 Isode Limited. + * Copyright (c) 2015-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #pragma once +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/JID/JID.h> #include <Swift/Controllers/XMPPEvents/StanzaEvent.h> @@ -24,7 +23,7 @@ namespace Swift { class MUCInviteEvent : public StanzaEvent { public: - typedef boost::shared_ptr<MUCInviteEvent> ref; + typedef std::shared_ptr<MUCInviteEvent> ref; public: MUCInviteEvent(const JID& inviter, const JID& roomJID, const std::string& reason, const std::string& password, bool direct, bool impromptu) : inviter_(inviter), roomJID_(roomJID), reason_(reason), password_(password), direct_(direct), impromptu_(impromptu) {} diff --git a/Swift/Controllers/XMPPEvents/MessageEvent.h b/Swift/Controllers/XMPPEvents/MessageEvent.h index 4ec0406..7af2be6 100644 --- a/Swift/Controllers/XMPPEvents/MessageEvent.h +++ b/Swift/Controllers/XMPPEvents/MessageEvent.h @@ -7,8 +7,7 @@ #pragma once #include <cassert> - -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Elements/Message.h> @@ -17,11 +16,11 @@ namespace Swift { class MessageEvent : public StanzaEvent { public: - typedef boost::shared_ptr<MessageEvent> ref; + typedef std::shared_ptr<MessageEvent> ref; - MessageEvent(boost::shared_ptr<Message> stanza) : stanza_(stanza), targetsMe_(true) {} + MessageEvent(std::shared_ptr<Message> stanza) : stanza_(stanza), targetsMe_(true) {} - boost::shared_ptr<Message> getStanza() {return stanza_;} + std::shared_ptr<Message> getStanza() {return stanza_;} bool isReadable() { return getStanza()->isError() || !getStanza()->getBody().get_value_or("").empty(); @@ -41,7 +40,7 @@ namespace Swift { } private: - boost::shared_ptr<Message> stanza_; + std::shared_ptr<Message> stanza_; bool targetsMe_; }; } diff --git a/Swift/Controllers/XMPPEvents/StanzaEvent.h b/Swift/Controllers/XMPPEvents/StanzaEvent.h index fe97e23..0ddcdbe 100644 --- a/Swift/Controllers/XMPPEvents/StanzaEvent.h +++ b/Swift/Controllers/XMPPEvents/StanzaEvent.h @@ -6,8 +6,9 @@ #pragma once +#include <memory> + #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/shared_ptr.hpp> #include <Swiften/Base/boost_bsignals.h> diff --git a/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h b/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h index 92922e9..85d3722 100644 --- a/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h +++ b/Swift/Controllers/XMPPEvents/SubscriptionRequestEvent.h @@ -7,10 +7,9 @@ #pragma once #include <cassert> +#include <memory> #include <string> -#include <boost/shared_ptr.hpp> - #include <Swiften/Base/boost_bsignals.h> #include <Swiften/JID/JID.h> diff --git a/Swift/Controllers/XMPPURIController.cpp b/Swift/Controllers/XMPPURIController.cpp index 57c0ca4..aaebd56 100644 --- a/Swift/Controllers/XMPPURIController.cpp +++ b/Swift/Controllers/XMPPURIController.cpp @@ -6,8 +6,9 @@ #include <Swift/Controllers/XMPPURIController.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <Swift/Controllers/UIEvents/RequestChatUIEvent.h> #include <Swift/Controllers/UIEvents/RequestJoinMUCUIEvent.h> @@ -30,10 +31,10 @@ void XMPPURIController::handleURI(const std::string& s) { XMPPURI uri = XMPPURI::fromString(s); if (!uri.isNull()) { if (uri.getQueryType() == "join") { - uiEventStream->send(boost::make_shared<RequestJoinMUCUIEvent>(uri.getPath())); + uiEventStream->send(std::make_shared<RequestJoinMUCUIEvent>(uri.getPath())); } else { - uiEventStream->send(boost::make_shared<RequestChatUIEvent>(uri.getPath())); + uiEventStream->send(std::make_shared<RequestChatUIEvent>(uri.getPath())); } } } diff --git a/Swift/QtUI/ChatList/ChatListMUCItem.h b/Swift/QtUI/ChatList/ChatListMUCItem.h index 4e93600..c77c284 100644 --- a/Swift/QtUI/ChatList/ChatListMUCItem.h +++ b/Swift/QtUI/ChatList/ChatListMUCItem.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QList> diff --git a/Swift/QtUI/ChatList/ChatListRecentItem.h b/Swift/QtUI/ChatList/ChatListRecentItem.h index 4f0a363..3c9635b 100644 --- a/Swift/QtUI/ChatList/ChatListRecentItem.h +++ b/Swift/QtUI/ChatList/ChatListRecentItem.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QIcon> #include <QList> diff --git a/Swift/QtUI/ChatList/ChatListWhiteboardItem.h b/Swift/QtUI/ChatList/ChatListWhiteboardItem.h index 92acb1c..6dbc5f6 100644 --- a/Swift/QtUI/ChatList/ChatListWhiteboardItem.h +++ b/Swift/QtUI/ChatList/ChatListWhiteboardItem.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QIcon> #include <QList> diff --git a/Swift/QtUI/ChatList/QtChatListWindow.cpp b/Swift/QtUI/ChatList/QtChatListWindow.cpp index 1a121aa..3fe462a 100644 --- a/Swift/QtUI/ChatList/QtChatListWindow.cpp +++ b/Swift/QtUI/ChatList/QtChatListWindow.cpp @@ -103,7 +103,7 @@ void QtChatListWindow::handleItemActivated(const QModelIndex& index) { } else if (ChatListWhiteboardItem* whiteboardItem = dynamic_cast<ChatListWhiteboardItem*>(item)) { if (!whiteboardItem->getChat().isMUC || bookmarksEnabled_) { - eventStream_->send(boost::make_shared<ShowWhiteboardUIEvent>(whiteboardItem->getChat().jid)); + eventStream_->send(std::make_shared<ShowWhiteboardUIEvent>(whiteboardItem->getChat().jid)); } } } @@ -143,7 +143,7 @@ void QtChatListWindow::setOnline(bool isOnline) { void QtChatListWindow::handleRemoveBookmark() { const ChatListMUCItem* mucItem = dynamic_cast<const ChatListMUCItem*>(contextMenuItem_); if (!mucItem) return; - eventStream_->send(boost::shared_ptr<UIEvent>(new RemoveMUCBookmarkUIEvent(mucItem->getBookmark()))); + eventStream_->send(std::make_shared<RemoveMUCBookmarkUIEvent>(mucItem->getBookmark())); } void QtChatListWindow::handleAddBookmarkFromRecents() { @@ -153,7 +153,7 @@ void QtChatListWindow::handleAddBookmarkFromRecents() { MUCBookmark bookmark(chat.jid, chat.jid.toBare().toString()); bookmark.setNick(chat.nick); bookmark.setPassword(chat.password); - eventStream_->send(boost::shared_ptr<UIEvent>(new AddMUCBookmarkUIEvent(bookmark))); + eventStream_->send(std::make_shared<AddMUCBookmarkUIEvent>(bookmark)); } } diff --git a/Swift/QtUI/ChatSnippet.cpp b/Swift/QtUI/ChatSnippet.cpp index 14e4674..0369d0a 100644 --- a/Swift/QtUI/ChatSnippet.cpp +++ b/Swift/QtUI/ChatSnippet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2013 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -46,10 +46,10 @@ QString ChatSnippet::directionToCSS(Direction direction) { } ChatSnippet::Direction ChatSnippet::getDirection(const ChatWindow::ChatMessage& message) { - boost::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; + std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; std::string text = ""; - foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { - if ((textPart = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { + foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { + if ((textPart = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { text = textPart->text; break; } diff --git a/Swift/QtUI/ChatSnippet.h b/Swift/QtUI/ChatSnippet.h index bf2d6d2..f715cbf 100644 --- a/Swift/QtUI/ChatSnippet.h +++ b/Swift/QtUI/ChatSnippet.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QDateTime> #include <QString> @@ -31,7 +31,7 @@ namespace Swift { virtual const QString& getContent() const = 0; virtual QString getContinuationElementID() const { return ""; } - boost::shared_ptr<ChatSnippet> getContinuationFallbackSnippet() const {return continuationFallback_;} + std::shared_ptr<ChatSnippet> getContinuationFallbackSnippet() const {return continuationFallback_;} bool getAppendToPrevious() const { return appendToPrevious_; @@ -61,12 +61,12 @@ namespace Swift { static QString directionToCSS(Direction direction); QString wrapResizable(const QString& text); - void setContinuationFallbackSnippet(boost::shared_ptr<ChatSnippet> continuationFallback) { + void setContinuationFallbackSnippet(std::shared_ptr<ChatSnippet> continuationFallback) { continuationFallback_ = continuationFallback; } private: bool appendToPrevious_; - boost::shared_ptr<ChatSnippet> continuationFallback_; + std::shared_ptr<ChatSnippet> continuationFallback_; }; } diff --git a/Swift/QtUI/CocoaUIHelpers.mm b/Swift/QtUI/CocoaUIHelpers.mm index 06a74aa..c876312 100644 --- a/Swift/QtUI/CocoaUIHelpers.mm +++ b/Swift/QtUI/CocoaUIHelpers.mm @@ -12,7 +12,7 @@ #include "CocoaUIHelpers.h" -#include <boost/shared_ptr.hpp> +#include <memory> #include <boost/type_traits.hpp> #include <Cocoa/Cocoa.h> @@ -32,8 +32,8 @@ void CocoaUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std:: foreach(Certificate::ref cert, chain) { // convert chain to SecCertificateRef ByteArray certAsDER = cert->toDER(); - boost::shared_ptr<boost::remove_pointer<CFDataRef>::type> certData(CFDataCreate(nullptr, certAsDER.data(), certAsDER.size()), CFRelease); - boost::shared_ptr<OpaqueSecCertificateRef> macCert(SecCertificateCreateWithData(nullptr, certData.get()), CFRelease); + std::shared_ptr<boost::remove_pointer<CFDataRef>::type> certData(CFDataCreate(nullptr, certAsDER.data(), certAsDER.size()), CFRelease); + std::shared_ptr<OpaqueSecCertificateRef> macCert(SecCertificateCreateWithData(nullptr, certData.get()), CFRelease); // add to NSMutable array [certificates addObject: (id)macCert.get()]; diff --git a/Swift/QtUI/EventViewer/EventDelegate.cpp b/Swift/QtUI/EventViewer/EventDelegate.cpp index eff9a7b..1c3ed7f 100644 --- a/Swift/QtUI/EventViewer/EventDelegate.cpp +++ b/Swift/QtUI/EventViewer/EventDelegate.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. */ @@ -56,24 +56,24 @@ void EventDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, } } -EventType EventDelegate::getEventType(boost::shared_ptr<StanzaEvent> event) const { - boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event); +EventType EventDelegate::getEventType(std::shared_ptr<StanzaEvent> event) const { + std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(event); if (messageEvent) { return MessageEventType; } - boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event); + std::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(event); if (subscriptionEvent) { return SubscriptionEventType; } - boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event); + std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(event); if (errorEvent) { return ErrorEventType; } - boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event); + std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(event); if (mucInviteEvent) { return MUCInviteEventType; } - boost::shared_ptr<IncomingFileTransferEvent> incomingFileTransferEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event); + std::shared_ptr<IncomingFileTransferEvent> incomingFileTransferEvent = std::dynamic_pointer_cast<IncomingFileTransferEvent>(event); if (incomingFileTransferEvent) { return IncomingFileTransferEventType; } diff --git a/Swift/QtUI/EventViewer/EventDelegate.h b/Swift/QtUI/EventViewer/EventDelegate.h index 0804589..79ee8ed 100644 --- a/Swift/QtUI/EventViewer/EventDelegate.h +++ b/Swift/QtUI/EventViewer/EventDelegate.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. */ @@ -20,7 +20,7 @@ namespace Swift { QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; private: - EventType getEventType(boost::shared_ptr<StanzaEvent> event) const; + EventType getEventType(std::shared_ptr<StanzaEvent> event) const; DelegateCommons common_; TwoLineDelegate messageDelegate_; TwoLineDelegate subscriptionDelegate_; diff --git a/Swift/QtUI/EventViewer/EventModel.cpp b/Swift/QtUI/EventViewer/EventModel.cpp index d830db9..e242003 100644 --- a/Swift/QtUI/EventViewer/EventModel.cpp +++ b/Swift/QtUI/EventViewer/EventModel.cpp @@ -74,7 +74,7 @@ int EventModel::rowCount(const QModelIndex& parent) const { return count; } -void EventModel::addEvent(boost::shared_ptr<StanzaEvent> event, bool active) { +void EventModel::addEvent(std::shared_ptr<StanzaEvent> event, bool active) { beginResetModel(); if (active) { activeEvents_.push_front(new QtEvent(event, active)); @@ -87,7 +87,7 @@ void EventModel::addEvent(boost::shared_ptr<StanzaEvent> event, bool active) { endResetModel(); } -void EventModel::removeEvent(boost::shared_ptr<StanzaEvent> event) { +void EventModel::removeEvent(std::shared_ptr<StanzaEvent> event) { beginResetModel(); for (int i = inactiveEvents_.size() - 1; i >= 0; i--) { if (event == inactiveEvents_[i]->getEvent()) { diff --git a/Swift/QtUI/EventViewer/EventModel.h b/Swift/QtUI/EventViewer/EventModel.h index 5cd5028..de72c1b 100644 --- a/Swift/QtUI/EventViewer/EventModel.h +++ b/Swift/QtUI/EventViewer/EventModel.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QAbstractListModel> #include <QList> @@ -21,8 +21,8 @@ class EventModel : public QAbstractListModel { public: EventModel(); virtual ~EventModel(); - void addEvent(boost::shared_ptr<StanzaEvent> event, bool active); - void removeEvent(boost::shared_ptr<StanzaEvent> event); + void addEvent(std::shared_ptr<StanzaEvent> event, bool active); + void removeEvent(std::shared_ptr<StanzaEvent> event); QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; int rowCount(const QModelIndex& parent = QModelIndex()) const; QtEvent* getItem(int row) const; diff --git a/Swift/QtUI/EventViewer/QtEvent.cpp b/Swift/QtUI/EventViewer/QtEvent.cpp index c287c66..5bd0fad 100644 --- a/Swift/QtUI/EventViewer/QtEvent.cpp +++ b/Swift/QtUI/EventViewer/QtEvent.cpp @@ -19,7 +19,7 @@ namespace Swift { -QtEvent::QtEvent(boost::shared_ptr<StanzaEvent> event, bool active) : event_(event) { +QtEvent::QtEvent(std::shared_ptr<StanzaEvent> event, bool active) : event_(event) { active_ = active; } @@ -38,23 +38,23 @@ QVariant QtEvent::data(int role) { } QString QtEvent::sender() { - boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event_); + std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(event_); if (messageEvent) { return P2QSTRING(messageEvent->getStanza()->getFrom().toString()); } - boost::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); + std::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); if (subscriptionRequestEvent) { return P2QSTRING(subscriptionRequestEvent->getJID().toBare().toString()); } - boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event_); + std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(event_); if (errorEvent) { return P2QSTRING(errorEvent->getJID().toBare().toString()); } - boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event_); + std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(event_); if (mucInviteEvent) { return P2QSTRING(mucInviteEvent->getInviter().toString()); } - boost::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event_); + std::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = std::dynamic_pointer_cast<IncomingFileTransferEvent>(event_); if (incomingFTEvent) { return P2QSTRING(incomingFTEvent->getSender().toString()); } @@ -62,11 +62,11 @@ QString QtEvent::sender() { } QString QtEvent::text() { - boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event_); + std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(event_); if (messageEvent) { return P2QSTRING(messageEvent->getStanza()->getBody().get_value_or("")); } - boost::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); + std::shared_ptr<SubscriptionRequestEvent> subscriptionRequestEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(event_); if (subscriptionRequestEvent) { std::string reason = subscriptionRequestEvent->getReason(); QString message; @@ -78,16 +78,16 @@ QString QtEvent::text() { } return message; } - boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event_); + std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(event_); if (errorEvent) { return P2QSTRING(errorEvent->getText()); } - boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event_); + std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(event_); if (mucInviteEvent) { QString message = QString(QObject::tr("%1 has invited you to enter the %2 room.")).arg(P2QSTRING(mucInviteEvent->getInviter().toBare().toString())).arg(P2QSTRING(mucInviteEvent->getRoomJID().toString())); return message; } - boost::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event_); + std::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = std::dynamic_pointer_cast<IncomingFileTransferEvent>(event_); if (incomingFTEvent) { QString message = QString(QObject::tr("%1 would like to send a file to you.")).arg(P2QSTRING(incomingFTEvent->getSender().toBare().toString())); return message; diff --git a/Swift/QtUI/EventViewer/QtEvent.h b/Swift/QtUI/EventViewer/QtEvent.h index d369255..cb78b00 100644 --- a/Swift/QtUI/EventViewer/QtEvent.h +++ b/Swift/QtUI/EventViewer/QtEvent.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QVariant> @@ -15,9 +15,9 @@ namespace Swift { class QtEvent { public: - QtEvent(boost::shared_ptr<StanzaEvent> event, bool active); + QtEvent(std::shared_ptr<StanzaEvent> event, bool active); QVariant data(int role); - boost::shared_ptr<StanzaEvent> getEvent() { return event_; } + std::shared_ptr<StanzaEvent> getEvent() { return event_; } enum EventRoles { SenderRole = Qt::UserRole @@ -26,7 +26,7 @@ namespace Swift { private: QString text(); QString sender(); - boost::shared_ptr<StanzaEvent> event_; + std::shared_ptr<StanzaEvent> event_; bool active_; }; } diff --git a/Swift/QtUI/EventViewer/QtEventWindow.cpp b/Swift/QtUI/EventViewer/QtEventWindow.cpp index 8395a6c..e77699b 100644 --- a/Swift/QtUI/EventViewer/QtEventWindow.cpp +++ b/Swift/QtUI/EventViewer/QtEventWindow.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. */ @@ -73,26 +73,26 @@ void QtEventWindow::handleReadClicked() { void QtEventWindow::handleItemActivated(const QModelIndex& item) { QtEvent* event = model_->getItem(item.row()); - boost::shared_ptr<MessageEvent> messageEvent = boost::dynamic_pointer_cast<MessageEvent>(event->getEvent()); - boost::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = boost::dynamic_pointer_cast<SubscriptionRequestEvent>(event->getEvent()); - boost::shared_ptr<MUCInviteEvent> mucInviteEvent = boost::dynamic_pointer_cast<MUCInviteEvent>(event->getEvent()); - boost::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = boost::dynamic_pointer_cast<IncomingFileTransferEvent>(event->getEvent()); - boost::shared_ptr<ErrorEvent> errorEvent = boost::dynamic_pointer_cast<ErrorEvent>(event->getEvent()); + std::shared_ptr<MessageEvent> messageEvent = std::dynamic_pointer_cast<MessageEvent>(event->getEvent()); + std::shared_ptr<SubscriptionRequestEvent> subscriptionEvent = std::dynamic_pointer_cast<SubscriptionRequestEvent>(event->getEvent()); + std::shared_ptr<MUCInviteEvent> mucInviteEvent = std::dynamic_pointer_cast<MUCInviteEvent>(event->getEvent()); + std::shared_ptr<IncomingFileTransferEvent> incomingFTEvent = std::dynamic_pointer_cast<IncomingFileTransferEvent>(event->getEvent()); + std::shared_ptr<ErrorEvent> errorEvent = std::dynamic_pointer_cast<ErrorEvent>(event->getEvent()); if (messageEvent) { if (messageEvent->getStanza()->getType() == Message::Groupchat) { - eventStream_->send(boost::shared_ptr<UIEvent>(new JoinMUCUIEvent(messageEvent->getStanza()->getFrom().toBare(), messageEvent->getStanza()->getTo().getResource()))); + eventStream_->send(std::make_shared<JoinMUCUIEvent>(messageEvent->getStanza()->getFrom().toBare(), messageEvent->getStanza()->getTo().getResource())); } else { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(messageEvent->getStanza()->getFrom()))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(messageEvent->getStanza()->getFrom())); } } else if (subscriptionEvent) { QtSubscriptionRequestWindow* window = QtSubscriptionRequestWindow::getWindow(subscriptionEvent, this); window->show(); } else if (mucInviteEvent) { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(mucInviteEvent->getInviter()))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(mucInviteEvent->getInviter())); mucInviteEvent->conclude(); } else if (incomingFTEvent) { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(incomingFTEvent->getSender()))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(incomingFTEvent->getSender())); incomingFTEvent->conclude(); } else { if (errorEvent) { @@ -105,14 +105,14 @@ void QtEventWindow::handleItemActivated(const QModelIndex& item) { } -void QtEventWindow::addEvent(boost::shared_ptr<StanzaEvent> event, bool active) { +void QtEventWindow::addEvent(std::shared_ptr<StanzaEvent> event, bool active) { view_->clearSelection(); model_->addEvent(event, active); emit onNewEventCountUpdated(model_->getNewEventCount()); readButton_->setEnabled(model_->rowCount() > 0); } -void QtEventWindow::removeEvent(boost::shared_ptr<StanzaEvent> event) { +void QtEventWindow::removeEvent(std::shared_ptr<StanzaEvent> event) { view_->clearSelection(); model_->removeEvent(event); emit onNewEventCountUpdated(model_->getNewEventCount()); diff --git a/Swift/QtUI/EventViewer/QtEventWindow.h b/Swift/QtUI/EventViewer/QtEventWindow.h index 92f8de0..bad20e4 100644 --- a/Swift/QtUI/EventViewer/QtEventWindow.h +++ b/Swift/QtUI/EventViewer/QtEventWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QTreeView> @@ -25,8 +25,8 @@ namespace Swift { public: QtEventWindow(UIEventStream* eventStream); ~QtEventWindow(); - void addEvent(boost::shared_ptr<StanzaEvent> event, bool active); - void removeEvent(boost::shared_ptr<StanzaEvent> event); + void addEvent(std::shared_ptr<StanzaEvent> event, bool active); + void removeEvent(std::shared_ptr<StanzaEvent> event); signals: void onNewEventCountUpdated(int count); private slots: diff --git a/Swift/QtUI/EventViewer/main.cpp b/Swift/QtUI/EventViewer/main.cpp index 5eddd90..492599e 100644 --- a/Swift/QtUI/EventViewer/main.cpp +++ b/Swift/QtUI/EventViewer/main.cpp @@ -21,13 +21,13 @@ int main(int argc, char *argv[]) Swift::UIEventStream eventStream; Swift::QtEventWindow* viewer = new Swift::QtEventWindow(&eventStream); viewer->show(); - boost::shared_ptr<Swift::Message> message1(new Swift::Message()); + std::shared_ptr<Swift::Message> message1(new Swift::Message()); message1->setBody("Oooh, shiny"); - boost::shared_ptr<Swift::MessageEvent> event1(new Swift::MessageEvent(message1)); - viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(event1), true); + std::shared_ptr<Swift::MessageEvent> event1(new Swift::MessageEvent(message1)); + viewer->addEvent(std::dynamic_pointer_cast<Swift::StanzaEvent>(event1), true); for (int i = 0; i < 100; i++) { - viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(event1), false); + viewer->addEvent(std::dynamic_pointer_cast<Swift::StanzaEvent>(event1), false); } - viewer->addEvent(boost::dynamic_pointer_cast<Swift::StanzaEvent>(boost::make_shared<Swift::ErrorEvent>(Swift::JID("me@example.com"), "Something bad did happen to you.")), true); + viewer->addEvent(std::dynamic_pointer_cast<Swift::StanzaEvent>(std::make_shared<Swift::ErrorEvent>(Swift::JID("me@example.com"), "Something bad did happen to you.")), true); return app.exec(); } diff --git a/Swift/QtUI/MUCSearch/MUCSearchModel.h b/Swift/QtUI/MUCSearch/MUCSearchModel.h index d6a24f3..2922ca6 100644 --- a/Swift/QtUI/MUCSearch/MUCSearchModel.h +++ b/Swift/QtUI/MUCSearch/MUCSearchModel.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QAbstractItemModel> #include <QList> diff --git a/Swift/QtUI/MessageSnippet.cpp b/Swift/QtUI/MessageSnippet.cpp index 85cbdb9..4682365 100644 --- a/Swift/QtUI/MessageSnippet.cpp +++ b/Swift/QtUI/MessageSnippet.cpp @@ -12,7 +12,7 @@ namespace Swift { MessageSnippet::MessageSnippet(const QString& message, const QString& sender, const QDateTime& time, const QString& iconURI, bool isIncoming, bool appendToPrevious, QtChatTheme* theme, const QString& id, Direction direction) : ChatSnippet(appendToPrevious) { if (appendToPrevious) { - setContinuationFallbackSnippet(boost::shared_ptr<ChatSnippet>(new MessageSnippet(message, sender, time, iconURI, isIncoming, false, theme, id, direction))); + setContinuationFallbackSnippet(std::make_shared<MessageSnippet>(message, sender, time, iconURI, isIncoming, false, theme, id, direction)); } if (isIncoming) { if (appendToPrevious) { diff --git a/Swift/QtUI/QtAdHocCommandWindow.cpp b/Swift/QtUI/QtAdHocCommandWindow.cpp index e638523..6b982b1 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWindow.cpp @@ -19,7 +19,7 @@ const int FormLayoutIndex = 1; namespace Swift { -QtAdHocCommandWindow::QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) : command_(command) { +QtAdHocCommandWindow::QtAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command) : command_(command) { formWidget_ = nullptr; setAttribute(Qt::WA_DeleteOnClose); diff --git a/Swift/QtUI/QtAdHocCommandWindow.h b/Swift/QtUI/QtAdHocCommandWindow.h index 61cd5be..1135ef9 100644 --- a/Swift/QtUI/QtAdHocCommandWindow.h +++ b/Swift/QtUI/QtAdHocCommandWindow.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. */ @@ -22,7 +22,7 @@ namespace Swift { class QtAdHocCommandWindow : public QWidget, public AdHocCommandWindow { Q_OBJECT public: - QtAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command); + QtAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command); virtual ~QtAdHocCommandWindow(); virtual void setOnline(bool online); @@ -41,7 +41,7 @@ namespace Swift { void handleCompleteClicked(); private: - boost::shared_ptr<OutgoingAdHocCommandSession> command_; + std::shared_ptr<OutgoingAdHocCommandSession> command_; QtFormWidget* formWidget_; Form::ref form_; QLabel* label_; diff --git a/Swift/QtUI/QtAdHocCommandWithJIDWindow.cpp b/Swift/QtUI/QtAdHocCommandWithJIDWindow.cpp index 69e1d68..1b114d9 100644 --- a/Swift/QtUI/QtAdHocCommandWithJIDWindow.cpp +++ b/Swift/QtUI/QtAdHocCommandWithJIDWindow.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. */ @@ -52,7 +52,7 @@ QtAdHocCommandWithJIDWindow::~QtAdHocCommandWithJIDWindow() { void QtAdHocCommandWithJIDWindow::handleAcceptClick() { const JID jid = JID(Q2PSTRING(jid_->text())); const std::string node = Q2PSTRING(node_->text()); - boost::shared_ptr<UIEvent> event(new RequestAdHocWithJIDUIEvent(jid, node)); + std::shared_ptr<UIEvent> event(new RequestAdHocWithJIDUIEvent(jid, node)); uiEventStream_->send(event); accept(); } diff --git a/Swift/QtUI/QtAddBookmarkWindow.cpp b/Swift/QtUI/QtAddBookmarkWindow.cpp index 500b298..8c5d662 100644 --- a/Swift/QtUI/QtAddBookmarkWindow.cpp +++ b/Swift/QtUI/QtAddBookmarkWindow.cpp @@ -19,7 +19,7 @@ QtAddBookmarkWindow::QtAddBookmarkWindow(UIEventStream* eventStream, const MUCBo bool QtAddBookmarkWindow::commit() { boost::optional<MUCBookmark> bookmark = createBookmarkFromForm(); if (bookmark) { - eventStream_->send(boost::shared_ptr<UIEvent>(new AddMUCBookmarkUIEvent(*bookmark))); + eventStream_->send(std::make_shared<AddMUCBookmarkUIEvent>(*bookmark)); return true; } else { diff --git a/Swift/QtUI/QtChatView.h b/Swift/QtUI/QtChatView.h index cca3bdf..fd13cc2 100644 --- a/Swift/QtUI/QtChatView.h +++ b/Swift/QtUI/QtChatView.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/shared_ptr.hpp> #include <QWidget> @@ -28,11 +28,11 @@ namespace Swift { /** Add message to window. * @return id of added message (for acks). */ - virtual std::string addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual std::string addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; /** Adds action to window. * @return id of added message (for acks); */ - virtual std::string addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; + virtual std::string addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) = 0; virtual std::string addSystemMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) = 0; virtual void addPresenceMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) = 0; diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 6cb2292..a828210 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -6,9 +6,10 @@ #include <Swift/QtUI/QtChatWindow.h> +#include <memory> + #include <boost/cstdint.hpp> #include <boost/lexical_cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QApplication> #include <QBoxLayout> @@ -630,7 +631,7 @@ void QtChatWindow::dropEvent(QDropEvent *event) { else { std::string messageText(Q2PSTRING(tr("Sending of multiple files at once isn't supported at this time."))); ChatMessage message; - message.append(boost::make_shared<ChatTextMessagePart>(messageText)); + message.append(std::make_shared<ChatTextMessagePart>(messageText)); addSystemMessage(message, DefaultDirection); } } @@ -866,12 +867,12 @@ void QtChatWindow::addMUCInvitation(const std::string& senderName, const JID& ji messageLog_->addMUCInvitation(senderName, jid, reason, password, direct, isImpromptu, isContinuation); } -std::string QtChatWindow::addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addMessage(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { handleAppendedToLog(); return messageLog_->addMessage(message, senderName, senderIsSelf, label, avatarPath, time); } -std::string QtChatWindow::addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { +std::string QtChatWindow::addAction(const ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { handleAppendedToLog(); return messageLog_->addAction(message, senderName, senderIsSelf, label, avatarPath, time); } diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 00693d2..25a1948 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -55,7 +55,7 @@ namespace Swift { if (!index.isValid()) { return QVariant(); } - boost::shared_ptr<SecurityLabel> label = availableLabels_[index.row()].getLabel(); + std::shared_ptr<SecurityLabel> label = availableLabels_[index.row()].getLabel(); if (label && role == Qt::TextColorRole) { return P2QSTRING(label->getForegroundColor()); } @@ -80,8 +80,8 @@ namespace Swift { public: QtChatWindow(const QString& contact, QtChatTheme* theme, UIEventStream* eventStream, SettingsProvider* settings, const std::map<std::string, std::string>& emoticons); virtual ~QtChatWindow(); - std::string addMessage(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time); - std::string addAction(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time); + std::string addMessage(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time); + std::string addAction(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time); std::string addSystemMessage(const ChatMessage& message, Direction direction); void addPresenceMessage(const ChatMessage& message, Direction direction); diff --git a/Swift/QtUI/QtContactEditWidget.h b/Swift/QtUI/QtContactEditWidget.h index 5c081e9..d4ea609 100644 --- a/Swift/QtUI/QtContactEditWidget.h +++ b/Swift/QtUI/QtContactEditWidget.h @@ -7,12 +7,11 @@ #pragma once #include <map> +#include <memory> #include <set> #include <string> #include <vector> -#include <boost/shared_ptr.hpp> - #include <QWidget> class QLabel; diff --git a/Swift/QtUI/QtEditBookmarkWindow.cpp b/Swift/QtUI/QtEditBookmarkWindow.cpp index a17b1aa..1d6b467 100644 --- a/Swift/QtUI/QtEditBookmarkWindow.cpp +++ b/Swift/QtUI/QtEditBookmarkWindow.cpp @@ -22,7 +22,7 @@ bool QtEditBookmarkWindow::commit() { if (!bookmark) { return false; } - eventStream_->send(boost::shared_ptr<UIEvent>(new EditMUCBookmarkUIEvent(bookmark_, *bookmark))); + eventStream_->send(std::make_shared<EditMUCBookmarkUIEvent>(bookmark_, *bookmark)); return true; } diff --git a/Swift/QtUI/QtFormWidget.cpp b/Swift/QtUI/QtFormWidget.cpp index 31f9a10..1d26815 100644 --- a/Swift/QtUI/QtFormWidget.cpp +++ b/Swift/QtUI/QtFormWidget.cpp @@ -6,8 +6,9 @@ #include <Swift/QtUI/QtFormWidget.h> +#include <memory> + #include <boost/algorithm/string/join.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QCheckBox> #include <QGridLayout> @@ -156,8 +157,8 @@ QWidget* QtFormWidget::createWidget(FormField::ref field, const FormField::Type Form::ref QtFormWidget::getCompletedForm() { Form::ref result(new Form(Form::SubmitType)); - foreach (boost::shared_ptr<FormField> field, form_->getFields()) { - boost::shared_ptr<FormField> resultField = boost::make_shared<FormField>(field->getType()); + foreach (std::shared_ptr<FormField> field, form_->getFields()) { + std::shared_ptr<FormField> resultField = std::make_shared<FormField>(field->getType()); if (field->getType() == FormField::BooleanType) { resultField->setBoolValue(qobject_cast<QCheckBox*>(fields_[field->getName()])->checkState() == Qt::Checked); } @@ -225,7 +226,7 @@ void QtFormWidget::setEditable(bool editable) { if (!form_) { return; } - foreach (boost::shared_ptr<FormField> field, form_->getFields()) { + foreach (std::shared_ptr<FormField> field, form_->getFields()) { QWidget* widget = nullptr; if (field) { widget = fields_[field->getName()]; diff --git a/Swift/QtUI/QtHistoryWindow.cpp b/Swift/QtUI/QtHistoryWindow.cpp index 035e73f..53e7ffe 100644 --- a/Swift/QtUI/QtHistoryWindow.cpp +++ b/Swift/QtUI/QtHistoryWindow.cpp @@ -12,12 +12,11 @@ #include <Swift/QtUI/QtHistoryWindow.h> +#include <memory> #include <string> #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/numeric/conversion/cast.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QDateTime> #include <QLineEdit> @@ -138,14 +137,14 @@ void QtHistoryWindow::addMessage(const std::string &message, const std::string & if (addAtTheTop) { bool appendToPrevious = ((senderIsSelf && previousTopMessageWasSelf_) || (!senderIsSelf && !previousTopMessageWasSelf_&& previousTopSenderName_ == P2QSTRING(senderName))); - conversation_->addMessageTop(boost::shared_ptr<ChatSnippet>(new MessageSnippet(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(message)))); + conversation_->addMessageTop(std::make_shared<MessageSnippet>(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(message))); previousTopMessageWasSelf_ = senderIsSelf; previousTopSenderName_ = P2QSTRING(senderName); } else { bool appendToPrevious = ((senderIsSelf && previousBottomMessageWasSelf_) || (!senderIsSelf && !previousBottomMessageWasSelf_&& previousBottomSenderName_ == P2QSTRING(senderName))); - conversation_->addMessageBottom(boost::make_shared<MessageSnippet>(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(message))); + conversation_->addMessageBottom(std::make_shared<MessageSnippet>(messageHTML, QtUtilities::htmlEscape(P2QSTRING(senderName)), qTime, qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(message))); previousBottomMessageWasSelf_ = senderIsSelf; previousBottomSenderName_ = P2QSTRING(senderName); } diff --git a/Swift/QtUI/QtJoinMUCWindow.cpp b/Swift/QtUI/QtJoinMUCWindow.cpp index 7225b06..ec2028c 100644 --- a/Swift/QtUI/QtJoinMUCWindow.cpp +++ b/Swift/QtUI/QtJoinMUCWindow.cpp @@ -1,12 +1,12 @@ /* - * Copyright (c) 2010-2015 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swift/QtUI/QtJoinMUCWindow.h> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <QToolTip> @@ -49,7 +49,7 @@ void QtJoinMUCWindow::handleJoin() { lastSetNick = Q2PSTRING(ui.nickName->text()); std::string password = Q2PSTRING(ui.password->text()); JID room(Q2PSTRING(ui.room->text())); - uiEventStream->send(boost::make_shared<JoinMUCUIEvent>(room, password, lastSetNick, ui.joinAutomatically->isChecked(), !ui.instantRoom->isChecked())); + uiEventStream->send(std::make_shared<JoinMUCUIEvent>(room, password, lastSetNick, ui.joinAutomatically->isChecked(), !ui.instantRoom->isChecked())); hide(); } diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 11458f0..b2778a1 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -10,7 +10,7 @@ #include <cassert> #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <QApplication> #include <QBoxLayout> @@ -399,12 +399,12 @@ void QtLoginWindow::loginClicked() { if (!certificateString.empty()) { #if defined(HAVE_SCHANNEL) if (isCAPIURI(certificateString)) { - certificate = boost::make_shared<CAPICertificate>(certificateString, timerFactory_); + certificate = std::make_shared<CAPICertificate>(certificateString, timerFactory_); } else { - certificate = boost::make_shared<PKCS12Certificate>(certificateString, createSafeByteArray(Q2PSTRING(password_->text()))); + certificate = std::make_shared<PKCS12Certificate>(certificateString, createSafeByteArray(Q2PSTRING(password_->text()))); } #else - certificate = boost::make_shared<PKCS12Certificate>(certificateString, createSafeByteArray(Q2PSTRING(password_->text()))); + certificate = std::make_shared<PKCS12Certificate>(certificateString, createSafeByteArray(Q2PSTRING(password_->text()))); #endif } @@ -454,15 +454,15 @@ void QtLoginWindow::handleAbout() { } void QtLoginWindow::handleShowXMLConsole() { - uiEventStream_->send(boost::make_shared<RequestXMLConsoleUIEvent>()); + uiEventStream_->send(std::make_shared<RequestXMLConsoleUIEvent>()); } void QtLoginWindow::handleShowFileTransferOverview() { - uiEventStream_->send(boost::make_shared<RequestFileTransferListUIEvent>()); + uiEventStream_->send(std::make_shared<RequestFileTransferListUIEvent>()); } void QtLoginWindow::handleShowHighlightEditor() { - uiEventStream_->send(boost::make_shared<RequestHighlightEditorUIEvent>()); + uiEventStream_->send(std::make_shared<RequestHighlightEditorUIEvent>()); } void QtLoginWindow::handleToggleSounds(bool enabled) { diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp index e351bd3..611fc80 100644 --- a/Swift/QtUI/QtMainWindow.cpp +++ b/Swift/QtUI/QtMainWindow.cpp @@ -8,7 +8,7 @@ #include <boost/bind.hpp> #include <boost/optional.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <QAction> #include <QBoxLayout> @@ -225,7 +225,7 @@ void QtMainWindow::handleShowCertificateInfo() { } void QtMainWindow::handleEditBlockingList() { - uiEventStream_->send(boost::make_shared<RequestBlockListDialogUIEvent>()); + uiEventStream_->send(std::make_shared<RequestBlockListDialogUIEvent>()); } void QtMainWindow::handleSomethingSelectedChanged(bool itemSelected) { @@ -246,7 +246,7 @@ void QtMainWindow::setRosterModel(Roster* roster) { } void QtMainWindow::handleEditProfileRequest() { - uiEventStream_->send(boost::make_shared<RequestProfileEditorUIEvent>()); + uiEventStream_->send(std::make_shared<RequestProfileEditorUIEvent>()); } void QtMainWindow::handleEventCountUpdated(int count) { @@ -272,12 +272,12 @@ void QtMainWindow::handleChatCountUpdated(int count) { } void QtMainWindow::handleAddUserActionTriggered(bool /*checked*/) { - boost::shared_ptr<UIEvent> event(new RequestAddUserDialogUIEvent()); + std::shared_ptr<UIEvent> event(new RequestAddUserDialogUIEvent()); uiEventStream_->send(event); } void QtMainWindow::handleChatUserActionTriggered(bool /*checked*/) { - boost::shared_ptr<UIEvent> event(new RequestChatWithUserDialogUIEvent()); + std::shared_ptr<UIEvent> event(new RequestChatWithUserDialogUIEvent()); uiEventStream_->send(event); } @@ -291,15 +291,15 @@ void QtMainWindow::handleSignOutAction() { } void QtMainWindow::handleEditProfileAction() { - uiEventStream_->send(boost::make_shared<RequestProfileEditorUIEvent>()); + uiEventStream_->send(std::make_shared<RequestProfileEditorUIEvent>()); } void QtMainWindow::handleJoinMUCAction() { - uiEventStream_->send(boost::make_shared<RequestJoinMUCUIEvent>()); + uiEventStream_->send(std::make_shared<RequestJoinMUCUIEvent>()); } void QtMainWindow::handleViewLogsAction() { - uiEventStream_->send(boost::make_shared<RequestHistoryUIEvent>()); + uiEventStream_->send(std::make_shared<RequestHistoryUIEvent>()); } void QtMainWindow::handleStatusChanged(StatusShow::Type showType, const QString &statusMessage) { @@ -363,7 +363,7 @@ void QtMainWindow::setMyStatusType(StatusShow::Type type) { serverAdHocMenu_->setEnabled(online); } -void QtMainWindow::setMyContactRosterItem(boost::shared_ptr<ContactRosterItem> contact) { +void QtMainWindow::setMyContactRosterItem(std::shared_ptr<ContactRosterItem> contact) { meView_->setContactRosterItem(contact); } @@ -393,7 +393,7 @@ void QtMainWindow::handleAdHocActionTriggered(bool /*checked*/) { QAction* action = qobject_cast<QAction*>(sender()); assert(action); DiscoItems::Item command = serverAdHocCommands_[serverAdHocCommandActions_.indexOf(action)]; - uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestAdHocUIEvent(command))); + uiEventStream_->send(std::make_shared<RequestAdHocUIEvent>(command)); } void QtMainWindow::setAvailableAdHocCommands(const std::vector<DiscoItems::Item>& commands) { diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h index d90dade..c46fdfc 100644 --- a/Swift/QtUI/QtMainWindow.h +++ b/Swift/QtUI/QtMainWindow.h @@ -47,7 +47,7 @@ namespace Swift { void setMyAvatarPath(const std::string& path); void setMyStatusText(const std::string& status); void setMyStatusType(StatusShow::Type type); - void setMyContactRosterItem(boost::shared_ptr<ContactRosterItem> contact); + void setMyContactRosterItem(std::shared_ptr<ContactRosterItem> contact); void setConnecting(); void setStreamEncryptionStatus(bool tlsInPlaceAndValid); void openCertificateDialog(const std::vector<Certificate::ref>& chain); diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp index fc53666..d682cfa 100644 --- a/Swift/QtUI/QtPlainChatView.cpp +++ b/Swift/QtUI/QtPlainChatView.cpp @@ -45,28 +45,28 @@ QtPlainChatView::~QtPlainChatView() { QString chatMessageToString(const ChatWindow::ChatMessage& message) { QString result; - foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { - boost::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; - boost::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart; - boost::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart; - boost::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart; + foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { + std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; + std::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart; + std::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart; + std::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart; - if ((textPart = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { + if ((textPart = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { QString text = QtUtilities::htmlEscape(P2QSTRING(textPart->text)); text.replace("\n","<br/>"); result += text; continue; } - if ((uriPart = boost::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(part))) { + if ((uriPart = std::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(part))) { QString uri = QtUtilities::htmlEscape(P2QSTRING(uriPart->target)); result += "<a href='" + uri + "' >" + uri + "</a>"; continue; } - if ((emoticonPart = boost::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(part))) { + if ((emoticonPart = std::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(part))) { result += P2QSTRING(emoticonPart->alternativeText); continue; } - if ((highlightPart = boost::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part))) { + if ((highlightPart = std::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part))) { //FIXME: Maybe do something here. Anything, really. continue; } @@ -74,7 +74,7 @@ QString chatMessageToString(const ChatWindow::ChatMessage& message) { return result; } -std::string QtPlainChatView::addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& /*avatarPath*/, const boost::posix_time::ptime& time) { +std::string QtPlainChatView::addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& /*avatarPath*/, const boost::posix_time::ptime& time) { QString text = "<p>"; if (label) { text += P2QSTRING(label->getLabel()) + "<br/>"; @@ -89,7 +89,7 @@ std::string QtPlainChatView::addMessage(const ChatWindow::ChatMessage& message, return idx; } -std::string QtPlainChatView::addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& /*avatarPath*/, const boost::posix_time::ptime& time) { +std::string QtPlainChatView::addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& /*avatarPath*/, const boost::posix_time::ptime& time) { QString text = "<p>"; if (label) { text += P2QSTRING(label->getLabel()) + "<br/>"; @@ -328,7 +328,7 @@ void QtPlainChatView::acceptMUCInvite() { AcceptMUCInviteAction *action = dynamic_cast<AcceptMUCInviteAction*>(sender()); if (action) { - eventStream_->send(boost::make_shared<JoinMUCUIEvent>(action->jid_.toString(), action->password_, boost::optional<std::string>(), false, false, action->isImpromptu_, action->isContinuation_)); + eventStream_->send(std::make_shared<JoinMUCUIEvent>(action->jid_.toString(), action->password_, boost::optional<std::string>(), false, false, action->isImpromptu_, action->isContinuation_)); delete action->parent_; } } diff --git a/Swift/QtUI/QtPlainChatView.h b/Swift/QtUI/QtPlainChatView.h index cd6ab7e..2a9b3e1 100644 --- a/Swift/QtUI/QtPlainChatView.h +++ b/Swift/QtUI/QtPlainChatView.h @@ -6,10 +6,10 @@ #pragma once +#include <memory> #include <string> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/shared_ptr.hpp> #include <QTextEdit> #include <QWidget> @@ -35,11 +35,11 @@ namespace Swift { /** Add message to window. * @return id of added message (for acks). */ - virtual std::string addMessage(const ChatWindow::ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, boost::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/); + virtual std::string addMessage(const ChatWindow::ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/); /** Adds action to window. * @return id of added message (for acks); */ - virtual std::string addAction(const ChatWindow::ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, boost::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/); + virtual std::string addAction(const ChatWindow::ChatMessage& /*message*/, const std::string& /*senderName*/, bool /*senderIsSelf*/, std::shared_ptr<SecurityLabel> /*label*/, const std::string& /*avatarPath*/, const boost::posix_time::ptime& /*time*/); virtual std::string addSystemMessage(const ChatWindow::ChatMessage& /*message*/, ChatWindow::Direction /*direction*/); virtual void addPresenceMessage(const ChatWindow::ChatMessage& /*message*/, ChatWindow::Direction /*direction*/); @@ -127,7 +127,7 @@ namespace Swift { UIEventStream* eventStream_; LogTextEdit* log_; FileTransferMap fileTransfers_; - std::map<std::string, boost::shared_ptr<SecurityLabel> > lastMessageLabel_; + std::map<std::string, std::shared_ptr<SecurityLabel> > lastMessageLabel_; int idGenerator_; }; diff --git a/Swift/QtUI/QtRosterHeader.cpp b/Swift/QtUI/QtRosterHeader.cpp index 56c3104..11dacb0 100644 --- a/Swift/QtUI/QtRosterHeader.cpp +++ b/Swift/QtUI/QtRosterHeader.cpp @@ -128,7 +128,7 @@ void QtRosterHeader::setNick(const QString& nick) { nameWidget_->setNick(nick); } -void QtRosterHeader::setContactRosterItem(boost::shared_ptr<ContactRosterItem> contact) { +void QtRosterHeader::setContactRosterItem(std::shared_ptr<ContactRosterItem> contact) { contact_ = contact; } diff --git a/Swift/QtUI/QtRosterHeader.h b/Swift/QtUI/QtRosterHeader.h index 7447c88..8370eb5 100644 --- a/Swift/QtUI/QtRosterHeader.h +++ b/Swift/QtUI/QtRosterHeader.h @@ -38,7 +38,7 @@ namespace Swift { void setJID(const QString& jid); void setNick(const QString& nick); - void setContactRosterItem(boost::shared_ptr<ContactRosterItem> contact); + void setContactRosterItem(std::shared_ptr<ContactRosterItem> contact); void setStatusText(const QString& statusMessage); void setStatusType(StatusShow::Type type); @@ -61,6 +61,6 @@ namespace Swift { QtStatusWidget* statusWidget_; QToolButton* securityInfoButton_; static const int avatarSize_; - boost::shared_ptr<ContactRosterItem> contact_; + std::shared_ptr<ContactRosterItem> contact_; }; } diff --git a/Swift/QtUI/QtSubscriptionRequestWindow.cpp b/Swift/QtUI/QtSubscriptionRequestWindow.cpp index 9e1fc37..eea13f2 100644 --- a/Swift/QtUI/QtSubscriptionRequestWindow.cpp +++ b/Swift/QtUI/QtSubscriptionRequestWindow.cpp @@ -14,7 +14,7 @@ #include <Swift/QtUI/QtSwiftUtil.h> namespace Swift { -QtSubscriptionRequestWindow::QtSubscriptionRequestWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) : QDialog(parent), event_(event) { +QtSubscriptionRequestWindow::QtSubscriptionRequestWindow(std::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) : QDialog(parent), event_(event) { QString text = QString(tr("%1 would like to add you to their contact list.")).arg(P2QSTRING(event->getJID().toString())); QVBoxLayout* layout = new QVBoxLayout(); QLabel* label = new QLabel(text, this); @@ -72,7 +72,7 @@ QtSubscriptionRequestWindow::~QtSubscriptionRequestWindow() { windows_.removeOne(this); } -QtSubscriptionRequestWindow* QtSubscriptionRequestWindow::getWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) { +QtSubscriptionRequestWindow* QtSubscriptionRequestWindow::getWindow(std::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent) { foreach (QtSubscriptionRequestWindow* window, windows_) { if (window->getEvent() == event) { return window; @@ -83,7 +83,7 @@ QtSubscriptionRequestWindow* QtSubscriptionRequestWindow::getWindow(boost::share return window; } -boost::shared_ptr<SubscriptionRequestEvent> QtSubscriptionRequestWindow::getEvent() { +std::shared_ptr<SubscriptionRequestEvent> QtSubscriptionRequestWindow::getEvent() { return event_; } diff --git a/Swift/QtUI/QtSubscriptionRequestWindow.h b/Swift/QtUI/QtSubscriptionRequestWindow.h index 83c6333..3f1e816 100644 --- a/Swift/QtUI/QtSubscriptionRequestWindow.h +++ b/Swift/QtUI/QtSubscriptionRequestWindow.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QDialog> @@ -16,17 +16,17 @@ namespace Swift { class QtSubscriptionRequestWindow : public QDialog { Q_OBJECT public: - static QtSubscriptionRequestWindow* getWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); + static QtSubscriptionRequestWindow* getWindow(std::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); ~QtSubscriptionRequestWindow(); - boost::shared_ptr<SubscriptionRequestEvent> getEvent(); + std::shared_ptr<SubscriptionRequestEvent> getEvent(); private slots: void handleYes(); void handleNo(); void handleDefer(); private: - QtSubscriptionRequestWindow(boost::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); + QtSubscriptionRequestWindow(std::shared_ptr<SubscriptionRequestEvent> event, QWidget* parent = nullptr); static QList<QtSubscriptionRequestWindow*> windows_; - boost::shared_ptr<SubscriptionRequestEvent> event_; + std::shared_ptr<SubscriptionRequestEvent> event_; /*QPushButton* yesButton_; QPushButton* noButton_; QPushButton* deferButton_;*/ diff --git a/Swift/QtUI/QtUIFactory.cpp b/Swift/QtUI/QtUIFactory.cpp index 3318c21..a9e0e8f 100644 --- a/Swift/QtUI/QtUIFactory.cpp +++ b/Swift/QtUI/QtUIFactory.cpp @@ -159,7 +159,7 @@ ContactEditWindow* QtUIFactory::createContactEditWindow() { return new QtContactEditWindow(); } -WhiteboardWindow* QtUIFactory::createWhiteboardWindow(boost::shared_ptr<WhiteboardSession> whiteboardSession) { +WhiteboardWindow* QtUIFactory::createWhiteboardWindow(std::shared_ptr<WhiteboardSession> whiteboardSession) { return new QtWhiteboardWindow(whiteboardSession); } @@ -171,7 +171,7 @@ BlockListEditorWidget *QtUIFactory::createBlockListEditorWidget() { return new QtBlockListEditorWindow(); } -AdHocCommandWindow* QtUIFactory::createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command) { +AdHocCommandWindow* QtUIFactory::createAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command) { return new QtAdHocCommandWindow(command); } diff --git a/Swift/QtUI/QtUIFactory.h b/Swift/QtUI/QtUIFactory.h index c72bf63..a57d509 100644 --- a/Swift/QtUI/QtUIFactory.h +++ b/Swift/QtUI/QtUIFactory.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. */ @@ -48,10 +48,10 @@ namespace Swift { virtual ProfileWindow* createProfileWindow(); virtual ContactEditWindow* createContactEditWindow(); virtual FileTransferListWidget* createFileTransferListWidget(); - virtual WhiteboardWindow* createWhiteboardWindow(boost::shared_ptr<WhiteboardSession> whiteboardSession); + virtual WhiteboardWindow* createWhiteboardWindow(std::shared_ptr<WhiteboardSession> whiteboardSession); virtual HighlightEditorWindow* createHighlightEditorWindow(); virtual BlockListEditorWidget* createBlockListEditorWidget(); - virtual AdHocCommandWindow* createAdHocCommandWindow(boost::shared_ptr<OutgoingAdHocCommandSession> command); + virtual AdHocCommandWindow* createAdHocCommandWindow(std::shared_ptr<OutgoingAdHocCommandSession> command); private slots: void handleLoginWindowGeometryChanged(); diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp index fffd4b3..c5f99f0 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp @@ -52,17 +52,17 @@ QtVCardWidget::QtVCardWidget(QWidget* parent) : toolButton->hide(); toolButton->setMenu(menu); - addFieldType(menu, boost::make_shared<QtVCardInternetEMailField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardTelephoneField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardAddressField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardAddressLabelField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardBirthdayField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardJIDField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardDescriptionField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardRoleField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardTitleField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardOrganizationField::FieldInfo>()); - addFieldType(menu, boost::make_shared<QtVCardURLField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardInternetEMailField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardTelephoneField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardAddressField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardAddressLabelField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardBirthdayField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardJIDField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardDescriptionField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardRoleField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardTitleField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardOrganizationField::FieldInfo>()); + addFieldType(menu, std::make_shared<QtVCardURLField::FieldInfo>()); setEditable(false); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); @@ -111,7 +111,7 @@ void QtVCardWidget::setEditable(bool editable) { void QtVCardWidget::setVCard(VCard::ref vcard) { clearFields(); - this->vcard = boost::make_shared<VCard>(*vcard); + this->vcard = std::make_shared<VCard>(*vcard); ui->photoAndName->setFormattedName(P2QSTRING(vcard->getFullName())); ui->photoAndName->setNickname(P2QSTRING(vcard->getNickname())); ui->photoAndName->setPrefix(P2QSTRING(vcard->getPrefix())); @@ -312,7 +312,7 @@ VCard::ref QtVCardWidget::getVCard() { void QtVCardWidget::addField() { QAction* action = nullptr; if ((action = dynamic_cast<QAction*>(sender()))) { - boost::shared_ptr<QtVCardFieldInfo> fieldInfo = actionFieldInfo[action]; + std::shared_ptr<QtVCardFieldInfo> fieldInfo = actionFieldInfo[action]; QWidget* newField = fieldInfo->createFieldInstance(this, ui->cardFields, true); QtVCardGeneralField* newGeneralField = dynamic_cast<QtVCardGeneralField*>(newField); if (newGeneralField) { @@ -341,7 +341,7 @@ void QtVCardWidget::removeField(QtVCardGeneralField *field) { delete field; } -void QtVCardWidget::addFieldType(QMenu* menu, boost::shared_ptr<QtVCardFieldInfo> fieldType) { +void QtVCardWidget::addFieldType(QMenu* menu, std::shared_ptr<QtVCardFieldInfo> fieldType) { if (!fieldType->getMenuName().isEmpty()) { QAction* action = new QAction(tr("Add %1").arg(fieldType->getMenuName()), this); actionFieldInfo[action] = fieldType; @@ -350,7 +350,7 @@ void QtVCardWidget::addFieldType(QMenu* menu, boost::shared_ptr<QtVCardFieldInfo } } -int QtVCardWidget::fieldTypeInstances(boost::shared_ptr<QtVCardFieldInfo> fieldType) { +int QtVCardWidget::fieldTypeInstances(std::shared_ptr<QtVCardFieldInfo> fieldType) { int instances = 0; for (int n = 0; n < ui->cardFields->count(); n++) { if (fieldType->testInstance(ui->cardFields->itemAt(n)->widget())) instances++; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h index 76fc46c..5334016 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.h @@ -12,7 +12,7 @@ #pragma once -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> #include <QToolButton> #include <QWidget> @@ -53,8 +53,8 @@ namespace Swift { void removeField(QtVCardGeneralField* field); private: - void addFieldType(QMenu*, boost::shared_ptr<QtVCardFieldInfo>); - int fieldTypeInstances(boost::shared_ptr<QtVCardFieldInfo>); + void addFieldType(QMenu*, std::shared_ptr<QtVCardFieldInfo>); + int fieldTypeInstances(std::shared_ptr<QtVCardFieldInfo>); void clearFields(); void clearEmptyFields(); void appendField(QtVCardGeneralField* field); @@ -67,7 +67,7 @@ namespace Swift { bool editable; QMenu* menu; std::list<QtVCardGeneralField*> fields; - std::map<QAction*, boost::shared_ptr<QtVCardFieldInfo> > actionFieldInfo; + std::map<QAction*, std::shared_ptr<QtVCardFieldInfo> > actionFieldInfo; }; } diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index 4193921..a40d0b3 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp @@ -118,7 +118,7 @@ void QtWebKitChatView::handleKeyPressEvent(QKeyEvent* event) { webView_->keyPressEvent(event); } -void QtWebKitChatView::addMessageBottom(boost::shared_ptr<ChatSnippet> snippet) { +void QtWebKitChatView::addMessageBottom(std::shared_ptr<ChatSnippet> snippet) { if (viewReady_) { addToDOM(snippet); } else { @@ -127,12 +127,12 @@ void QtWebKitChatView::addMessageBottom(boost::shared_ptr<ChatSnippet> snippet) } } -void QtWebKitChatView::addMessageTop(boost::shared_ptr<ChatSnippet> /* snippet */) { +void QtWebKitChatView::addMessageTop(std::shared_ptr<ChatSnippet> /* snippet */) { // TODO: Implement this in a sensible manner later. assert(false); } -void QtWebKitChatView::addToDOM(boost::shared_ptr<ChatSnippet> snippet) { +void QtWebKitChatView::addToDOM(std::shared_ptr<ChatSnippet> snippet) { //qDebug() << snippet->getContent(); rememberScrolledToBottom(); @@ -475,7 +475,7 @@ std::string QtWebKitChatView::addMessage( const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, - boost::shared_ptr<SecurityLabel> label, + std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { return addMessage(chatMessageToHTML(message), senderName, senderIsSelf, label, avatarPath, "", time, message.getFullMessageHighlightAction(), ChatSnippet::getDirection(message)); @@ -499,30 +499,30 @@ QString QtWebKitChatView::getHighlightSpanStart(const HighlightAction& highlight QString QtWebKitChatView::chatMessageToHTML(const ChatWindow::ChatMessage& message) { QString result; - foreach (boost::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { - boost::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; - boost::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart; - boost::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart; - boost::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart; + foreach (std::shared_ptr<ChatWindow::ChatMessagePart> part, message.getParts()) { + std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; + std::shared_ptr<ChatWindow::ChatURIMessagePart> uriPart; + std::shared_ptr<ChatWindow::ChatEmoticonMessagePart> emoticonPart; + std::shared_ptr<ChatWindow::ChatHighlightingMessagePart> highlightPart; - if ((textPart = boost::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { + if ((textPart = std::dynamic_pointer_cast<ChatWindow::ChatTextMessagePart>(part))) { QString text = QtUtilities::htmlEscape(P2QSTRING(textPart->text)); text.replace("\n","<br/>"); result += text; continue; } - if ((uriPart = boost::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(part))) { + if ((uriPart = std::dynamic_pointer_cast<ChatWindow::ChatURIMessagePart>(part))) { QString uri = QtUtilities::htmlEscape(P2QSTRING(uriPart->target)); result += "<a href='" + uri + "' >" + uri + "</a>"; continue; } - if ((emoticonPart = boost::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(part))) { + if ((emoticonPart = std::dynamic_pointer_cast<ChatWindow::ChatEmoticonMessagePart>(part))) { QString textStyle = showEmoticons_ ? "style='display:none'" : ""; QString imageStyle = showEmoticons_ ? "" : "style='display:none'"; result += "<span class='swift_emoticon_image' " + imageStyle + "><img src='" + P2QSTRING(emoticonPart->imagePath) + "'/></span><span class='swift_emoticon_text' " + textStyle + ">" + QtUtilities::htmlEscape(P2QSTRING(emoticonPart->alternativeText)) + "</span>"; continue; } - if ((highlightPart = boost::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part))) { + if ((highlightPart = std::dynamic_pointer_cast<ChatWindow::ChatHighlightingMessagePart>(part))) { QString spanStart = getHighlightSpanStart(highlightPart->action.getTextColor(), highlightPart->action.getTextBackground()); result += spanStart + QtUtilities::htmlEscape(P2QSTRING(highlightPart->text)) + "</span>"; continue; @@ -536,7 +536,7 @@ std::string QtWebKitChatView::addMessage( const QString& message, const std::string& senderName, bool senderIsSelf, - boost::shared_ptr<SecurityLabel> label, + std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time, @@ -563,7 +563,7 @@ std::string QtWebKitChatView::addMessage( QString qAvatarPath = scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), direction)); + addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(time), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), direction)); previousMessageWasSelf_ = senderIsSelf; previousSenderName_ = P2QSTRING(senderName); @@ -571,7 +571,7 @@ std::string QtWebKitChatView::addMessage( return id; } -std::string QtWebKitChatView::addAction(const ChatWindow::ChatMessage& message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { +std::string QtWebKitChatView::addAction(const ChatWindow::ChatMessage& message, const std::string &senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) { return addMessage(" *" + chatMessageToHTML(message) + "*", senderName, senderIsSelf, label, avatarPath, "font-style:italic ", time, message.getFullMessageHighlightAction(), ChatSnippet::getDirection(message)); } @@ -622,13 +622,13 @@ std::string QtWebKitChatView::addFileTransfer(const std::string& senderName, boo "</div>"; } - //addMessage(message, senderName, senderIsSelf, boost::shared_ptr<SecurityLabel>(), "", boost::posix_time::second_clock::local_time()); + //addMessage(message, senderName, senderIsSelf, std::shared_ptr<SecurityLabel>(), "", boost::posix_time::second_clock::local_time()); bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasFileTransfer, senderName, senderIsSelf); QString qAvatarPath = "qrc:/icons/avatar.png"; std::string id = "ftmessage" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); + addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, senderIsSelf, appendToPrevious, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); previousMessageWasSelf_ = senderIsSelf; previousSenderName_ = P2QSTRING(senderName); @@ -662,7 +662,7 @@ std::string QtWebKitChatView::addWhiteboardRequest(const QString& contact, bool } QString qAvatarPath = "qrc:/icons/avatar.png"; std::string id = "wbmessage" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(contact), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, false, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); + addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(contact), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, false, theme_, P2QSTRING(id), ChatSnippet::getDirection(actionText))); previousMessageWasSelf_ = false; previousSenderName_ = contact; return Q2PSTRING(wb_id); @@ -780,7 +780,7 @@ void QtWebKitChatView::handleHTMLButtonClicked(QString id, QString encodedArgume QString elementID = arg3; QString isImpromptu = arg4; QString isContinuation = arg5; - eventStream_->send(boost::make_shared<JoinMUCUIEvent>(Q2PSTRING(roomJID), Q2PSTRING(password), boost::optional<std::string>(), false, false, isImpromptu.contains("true"), isContinuation.contains("true"))); + eventStream_->send(std::make_shared<JoinMUCUIEvent>(Q2PSTRING(roomJID), Q2PSTRING(password), boost::optional<std::string>(), false, false, isImpromptu.contains("true"), isContinuation.contains("true"))); setMUCInvitationJoined(elementID); } else { @@ -795,7 +795,7 @@ void QtWebKitChatView::addErrorMessage(const ChatWindow::ChatMessage& errorMessa QString errorMessageHTML(chatMessageToHTML(errorMessage)); std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<SystemMessageSnippet>("<span class=\"error\">" + errorMessageHTML + "</span>", QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), ChatSnippet::getDirection(errorMessage))); + addMessageBottom(std::make_shared<SystemMessageSnippet>("<span class=\"error\">" + errorMessageHTML + "</span>", QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), ChatSnippet::getDirection(errorMessage))); previousMessageWasSelf_ = false; previousMessageKind_ = PreviousMessageWasSystem; @@ -808,7 +808,7 @@ std::string QtWebKitChatView::addSystemMessage(const ChatWindow::ChatMessage& me QString messageHTML = chatMessageToHTML(message); std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); + addMessageBottom(std::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); previousMessageKind_ = PreviousMessageWasSystem; return id; @@ -874,7 +874,7 @@ void QtWebKitChatView::addPresenceMessage(const ChatWindow::ChatMessage& message QString messageHTML = chatMessageToHTML(message); std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); - addMessageBottom(boost::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); + addMessageBottom(std::make_shared<SystemMessageSnippet>(messageHTML, QDateTime::currentDateTime(), false, theme_, P2QSTRING(id), getActualDirection(message, direction))); previousMessageKind_ = PreviousMessageWasPresence; } @@ -913,7 +913,7 @@ void QtWebKitChatView::addMUCInvitation(const std::string& senderName, const JID QString qAvatarPath = "qrc:/icons/avatar.png"; - addMessageBottom(boost::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, appendToPrevious, theme_, id, ChatSnippet::getDirection(message))); + addMessageBottom(std::make_shared<MessageSnippet>(htmlString, QtUtilities::htmlEscape(P2QSTRING(senderName)), B2QDATE(boost::posix_time::second_clock::universal_time()), qAvatarPath, false, appendToPrevious, theme_, id, ChatSnippet::getDirection(message))); previousMessageWasSelf_ = false; previousSenderName_ = P2QSTRING(senderName); previousMessageKind_ = PreviousMessageWasMUCInvite; diff --git a/Swift/QtUI/QtWebKitChatView.h b/Swift/QtUI/QtWebKitChatView.h index e3fb967..31bf8a5 100644 --- a/Swift/QtUI/QtWebKitChatView.h +++ b/Swift/QtUI/QtWebKitChatView.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QList> #include <QString> @@ -50,11 +50,11 @@ namespace Swift { /** Add message to window. * @return id of added message (for acks). */ - virtual std::string addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; + virtual std::string addMessage(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; /** Adds action to window. * @return id of added message (for acks); */ - virtual std::string addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; + virtual std::string addAction(const ChatWindow::ChatMessage& message, const std::string& senderName, bool senderIsSelf, std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time) SWIFTEN_OVERRIDE; virtual std::string addSystemMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) SWIFTEN_OVERRIDE; virtual void addPresenceMessage(const ChatWindow::ChatMessage& message, ChatWindow::Direction direction) SWIFTEN_OVERRIDE; @@ -75,8 +75,8 @@ namespace Swift { virtual void setMessageReceiptState(const std::string& id, ChatWindow::ReceiptState state) SWIFTEN_OVERRIDE; virtual void showEmoticons(bool show) SWIFTEN_OVERRIDE; - void addMessageTop(boost::shared_ptr<ChatSnippet> snippet); - void addMessageBottom(boost::shared_ptr<ChatSnippet> snippet); + void addMessageTop(std::shared_ptr<ChatSnippet> snippet); + void addMessageBottom(std::shared_ptr<ChatSnippet> snippet); int getSnippetPositionByDate(const QDate& date); // FIXME : This probably shouldn't have been public virtual void addLastSeenLine() SWIFTEN_OVERRIDE; @@ -140,7 +140,7 @@ namespace Swift { const QString& message, const std::string& senderName, bool senderIsSelf, - boost::shared_ptr<SecurityLabel> label, + std::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time, @@ -162,7 +162,7 @@ namespace Swift { private: void headerEncode(); void messageEncode(); - void addToDOM(boost::shared_ptr<ChatSnippet> snippet); + void addToDOM(std::shared_ptr<ChatSnippet> snippet); QtChatWindow* window_; UIEventStream* eventStream_; diff --git a/Swift/QtUI/Roster/QtFilterWidget.cpp b/Swift/QtUI/Roster/QtFilterWidget.cpp index 3ed23b6..d2e4d09 100644 --- a/Swift/QtUI/Roster/QtFilterWidget.cpp +++ b/Swift/QtUI/Roster/QtFilterWidget.cpp @@ -77,7 +77,7 @@ bool QtFilterWidget::eventFilter(QObject*, QEvent* event) { } else if (keyEvent->key() == Qt::Key_Return) { JID target = treeView_->selectedJID(); if (target.isValid()) { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(target))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(target)); } filterLineEdit_->setText(""); updateRosterFilters(); diff --git a/Swift/QtUI/Roster/QtRosterWidget.cpp b/Swift/QtUI/Roster/QtRosterWidget.cpp index 92fed86..935d6f6 100644 --- a/Swift/QtUI/Roster/QtRosterWidget.cpp +++ b/Swift/QtUI/Roster/QtRosterWidget.cpp @@ -48,7 +48,7 @@ void QtRosterWidget::handleEditUserActionTriggered(bool /*checked*/) { } RosterItem* item = static_cast<RosterItem*>(index.internalPointer()); if (ContactRosterItem* contact = dynamic_cast<ContactRosterItem*>(item)) { - eventStream_->send(boost::make_shared<RequestContactEditorUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<RequestContactEditorUIEvent>(contact->getJID())); } } @@ -95,15 +95,15 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { #endif QAction* result = contextMenu.exec(event->globalPos()); if (result == editContact) { - eventStream_->send(boost::make_shared<RequestContactEditorUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<RequestContactEditorUIEvent>(contact->getJID())); } else if (result == removeContact) { if (QtContactEditWindow::confirmContactDeletion(contact->getJID())) { - eventStream_->send(boost::make_shared<RemoveRosterItemUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<RemoveRosterItemUIEvent>(contact->getJID())); } } else if (result == showProfileForContact) { - eventStream_->send(boost::make_shared<ShowProfileForRosterItemUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<ShowProfileForRosterItemUIEvent>(contact->getJID())); } else if (unblockContact && result == unblockContact) { if (contact->blockState() == ContactRosterItem::IsDomainBlocked) { @@ -113,26 +113,26 @@ void QtRosterWidget::contextMenuEvent(QContextMenuEvent* event) { messageBox.exec(); if (messageBox.clickedButton() == unblockDomainButton) { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, contact->getJID().getDomain())); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, contact->getJID().getDomain())); } } else { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, contact->getJID())); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Unblocked, contact->getJID())); } } else if (blockContact && result == blockContact) { - eventStream_->send(boost::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Blocked, contact->getJID())); + eventStream_->send(std::make_shared<RequestChangeBlockStateUIEvent>(RequestChangeBlockStateUIEvent::Blocked, contact->getJID())); } #ifdef SWIFT_EXPERIMENTAL_FT else if (sendFile && result == sendFile) { QString fileName = QFileDialog::getOpenFileName(this, tr("Send File"), "", tr("All Files (*);;")); if (!fileName.isEmpty()) { - eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(fileName))); + eventStream_->send(std::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(fileName))); } } #endif #ifdef SWIFT_EXPERIMENTAL_WB else if (startWhiteboardChat && result == startWhiteboardChat) { - eventStream_->send(boost::make_shared<RequestWhiteboardUIEvent>(contact->getJID())); + eventStream_->send(std::make_shared<RequestWhiteboardUIEvent>(contact->getJID())); } #endif } @@ -155,7 +155,7 @@ void QtRosterWidget::renameGroup(GroupRosterItem* group) { bool ok; QString newName = QInputDialog::getText(nullptr, tr("Rename group"), tr("Enter a new name for group '%1':").arg(P2QSTRING(group->getDisplayName())), QLineEdit::Normal, P2QSTRING(group->getDisplayName()), &ok); if (ok) { - eventStream_->send(boost::make_shared<RenameGroupUIEvent>(group->getDisplayName(), Q2PSTRING(newName))); + eventStream_->send(std::make_shared<RenameGroupUIEvent>(group->getDisplayName(), Q2PSTRING(newName))); } } diff --git a/Swift/QtUI/Roster/QtTreeWidget.cpp b/Swift/QtUI/Roster/QtTreeWidget.cpp index 16a186e..249523c 100644 --- a/Swift/QtUI/Roster/QtTreeWidget.cpp +++ b/Swift/QtUI/Roster/QtTreeWidget.cpp @@ -6,8 +6,9 @@ #include <Swift/QtUI/Roster/QtTreeWidget.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QLabel> #include <QMimeData> @@ -140,7 +141,7 @@ void QtTreeWidget::currentChanged(const QModelIndex& current, const QModelIndex& void QtTreeWidget::handleItemActivated(const QModelIndex& index) { JID target = jidFromIndex(index); if (target.isValid()) { - eventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(target))); + eventStream_->send(std::make_shared<RequestChatUIEvent>(target)); } } @@ -158,7 +159,7 @@ void QtTreeWidget::dropEvent(QDropEvent *event) { if (contact->supportsFeature(ContactRosterItem::FileTransferFeature)) { QString filename = event->mimeData()->urls().at(0).toLocalFile(); if (!filename.isEmpty()) { - eventStream_->send(boost::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(filename))); + eventStream_->send(std::make_shared<SendFileUIEvent>(contact->getJID(), Q2PSTRING(filename))); } } } diff --git a/Swift/QtUI/SystemMessageSnippet.cpp b/Swift/QtUI/SystemMessageSnippet.cpp index fbf8810..eeb6b9a 100644 --- a/Swift/QtUI/SystemMessageSnippet.cpp +++ b/Swift/QtUI/SystemMessageSnippet.cpp @@ -12,7 +12,7 @@ namespace Swift { SystemMessageSnippet::SystemMessageSnippet(const QString& message, const QDateTime& time, bool appendToPrevious, QtChatTheme* theme, const QString& id, Direction direction) : ChatSnippet(appendToPrevious) { if (appendToPrevious) { - setContinuationFallbackSnippet(boost::shared_ptr<ChatSnippet>(new SystemMessageSnippet(message, time, false, theme, id, direction))); + setContinuationFallbackSnippet(std::make_shared<SystemMessageSnippet>(message, time, false, theme, id, direction)); } content_ = theme->getStatus(); diff --git a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp index 4e8f4e1..e9a26ea 100644 --- a/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp +++ b/Swift/QtUI/UserSearch/QtSuggestingJIDInput.cpp @@ -74,13 +74,13 @@ Contact::ref QtSuggestingJIDInput::getContact() { if (!text().isEmpty()) { JID jid(Q2PSTRING(text())); if (jid.isValid()) { - Contact::ref manualContact = boost::make_shared<Contact>(); + Contact::ref manualContact = std::make_shared<Contact>(); manualContact->name = jid.toString(); manualContact->jid = jid; return manualContact; } } - return boost::shared_ptr<Contact>(); + return std::shared_ptr<Contact>(); } void QtSuggestingJIDInput::setSuggestions(const std::vector<Contact::ref>& suggestions) { diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp index 09943c5..83b8df6 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.cpp @@ -6,8 +6,9 @@ #include <Swift/QtUI/UserSearch/QtUserSearchWindow.h> +#include <memory> + #include <boost/bind.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QItemDelegate> #include <QModelIndex> @@ -132,11 +133,11 @@ void QtUserSearchWindow::handleAccepted() { switch(type_) { case AddContact: jid = getContactJID(); - eventStream_->send(boost::make_shared<AddContactUIEvent>(jid, detailsPage_->getName(), detailsPage_->getSelectedGroups())); + eventStream_->send(std::make_shared<AddContactUIEvent>(jid, detailsPage_->getName(), detailsPage_->getSelectedGroups())); break; case ChatToContact: if (contactVector_.size() == 1) { - boost::shared_ptr<UIEvent> event(new RequestChatUIEvent(contactVector_[0]->jid)); + std::shared_ptr<UIEvent> event(new RequestChatUIEvent(contactVector_[0]->jid)); eventStream_->send(event); break; } @@ -145,13 +146,13 @@ void QtUserSearchWindow::handleAccepted() { jids.push_back(contact->jid); } - eventStream_->send(boost::make_shared<CreateImpromptuMUCUIEvent>(jids, JID(), Q2PSTRING(firstMultiJIDPage_->reason_->text()))); + eventStream_->send(std::make_shared<CreateImpromptuMUCUIEvent>(jids, JID(), Q2PSTRING(firstMultiJIDPage_->reason_->text()))); break; case InviteToChat: foreach(Contact::ref contact, contactVector_) { jids.push_back(contact->jid); } - eventStream_->send(boost::make_shared<InviteToMUCUIEvent>(roomJID_, jids, Q2PSTRING(firstMultiJIDPage_->reason_->text()))); + eventStream_->send(std::make_shared<InviteToMUCUIEvent>(roomJID_, jids, Q2PSTRING(firstMultiJIDPage_->reason_->text()))); break; } } @@ -229,7 +230,7 @@ void QtUserSearchWindow::handleFirstPageRadioChange() { } void QtUserSearchWindow::handleSearch() { - boost::shared_ptr<SearchPayload> search(new SearchPayload()); + std::shared_ptr<SearchPayload> search(new SearchPayload()); if (fieldsPage_->getFormWidget()) { search->setForm(fieldsPage_->getFormWidget()->getCompletedForm()); search->getForm()->clearEmptyTextFields(); @@ -292,7 +293,7 @@ JID QtUserSearchWindow::getContactJID() const { } Contact::ref QtUserSearchWindow::getContact() const { - return boost::make_shared<Contact>("", getContactJID(), StatusShow::None, ""); + return std::make_shared<Contact>("", getContactJID(), StatusShow::None, ""); } void QtUserSearchWindow::addSearchedJIDToList(const Contact::ref& contact) { @@ -330,7 +331,7 @@ void QtUserSearchWindow::addSavedServices(const std::vector<JID>& services) { } } -void QtUserSearchWindow::setSearchFields(boost::shared_ptr<SearchPayload> fields) { +void QtUserSearchWindow::setSearchFields(std::shared_ptr<SearchPayload> fields) { fieldsPage_->fetchingThrobber_->hide(); fieldsPage_->fetchingThrobber_->movie()->stop(); fieldsPage_->fetchingLabel_->hide(); @@ -375,7 +376,7 @@ void QtUserSearchWindow::setContactSuggestions(const std::vector<Contact::ref>& void QtUserSearchWindow::setJIDs(const std::vector<JID> &jids) { foreach(JID jid, jids) { - addSearchedJIDToList(boost::make_shared<Contact>("", jid, StatusShow::None, "")); + addSearchedJIDToList(std::make_shared<Contact>("", jid, StatusShow::None, "")); } onJIDUpdateRequested(jids); } diff --git a/Swift/QtUI/UserSearch/QtUserSearchWindow.h b/Swift/QtUI/UserSearch/QtUserSearchWindow.h index bcef0b9..5d8b755 100644 --- a/Swift/QtUI/UserSearch/QtUserSearchWindow.h +++ b/Swift/QtUI/UserSearch/QtUserSearchWindow.h @@ -42,7 +42,7 @@ namespace Swift { virtual void setSelectedService(const JID& jid); virtual void setServerSupportsSearch(bool error); virtual void setSearchError(bool error); - virtual void setSearchFields(boost::shared_ptr<SearchPayload> fields); + virtual void setSearchFields(std::shared_ptr<SearchPayload> fields); virtual void setNameSuggestions(const std::vector<std::string>& suggestions); virtual void prepopulateJIDAndName(const JID& jid, const std::string& name); virtual void setContactSuggestions(const std::vector<Contact::ref>& suggestions); diff --git a/Swift/QtUI/UserSearch/UserSearchModel.h b/Swift/QtUI/UserSearch/UserSearchModel.h index 0a57b28..a3940da 100644 --- a/Swift/QtUI/UserSearch/UserSearchModel.h +++ b/Swift/QtUI/UserSearch/UserSearchModel.h @@ -6,7 +6,7 @@ #pragma once -#include <boost/shared_ptr.hpp> +#include <memory> #include <QAbstractItemModel> #include <QList> diff --git a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp index 2eae84d..62f5b89 100644 --- a/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp +++ b/Swift/QtUI/Whiteboard/QtWhiteboardWindow.cpp @@ -13,10 +13,10 @@ #include <Swift/QtUI/Whiteboard/QtWhiteboardWindow.h> #include <iostream> +#include <memory> #include <boost/bind.hpp> #include <boost/numeric/conversion/cast.hpp> -#include <boost/smart_ptr/make_shared.hpp> #include <QLabel> #include <QMessageBox> @@ -154,13 +154,13 @@ namespace Swift { } void QtWhiteboardWindow::handleWhiteboardOperationReceive(const WhiteboardOperation::ref operation) { - WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); + WhiteboardInsertOperation::ref insertOp = std::dynamic_pointer_cast<WhiteboardInsertOperation>(operation); if (insertOp) { WhiteboardElementDrawingVisitor visitor(graphicsView, operation->getPos(), GView::New); insertOp->getElement()->accept(visitor); } - WhiteboardUpdateOperation::ref updateOp = boost::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); + WhiteboardUpdateOperation::ref updateOp = std::dynamic_pointer_cast<WhiteboardUpdateOperation>(operation); if (updateOp) { WhiteboardElementDrawingVisitor visitor(graphicsView, operation->getPos(), GView::Update); updateOp->getElement()->accept(visitor); @@ -169,7 +169,7 @@ namespace Swift { } } - WhiteboardDeleteOperation::ref deleteOp = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); + WhiteboardDeleteOperation::ref deleteOp = std::dynamic_pointer_cast<WhiteboardDeleteOperation>(operation); if (deleteOp) { graphicsView->deleteItem(P2QSTRING(deleteOp->getElementID())); } @@ -261,7 +261,7 @@ namespace Swift { if (lineItem != nullptr) { QLine line = lineItem->line().toLine(); QColor color = lineItem->pen().color(); - WhiteboardLineElement::ref element = boost::make_shared<WhiteboardLineElement>(line.x1()+lineItem->pos().x(), line.y1()+lineItem->pos().y(), line.x2()+lineItem->pos().x(), line.y2()+lineItem->pos().y()); + WhiteboardLineElement::ref element = std::make_shared<WhiteboardLineElement>(line.x1()+lineItem->pos().x(), line.y1()+lineItem->pos().y(), line.x2()+lineItem->pos().x(), line.y2()+lineItem->pos().y()); element->setColor(WhiteboardColor(color.red(), color.green(), color.blue(), color.alpha())); element->setPenWidth(lineItem->pen().width()); @@ -271,7 +271,7 @@ namespace Swift { FreehandLineItem* freehandLineItem = qgraphicsitem_cast<FreehandLineItem*>(item); if (freehandLineItem != nullptr) { - WhiteboardFreehandPathElement::ref element = boost::make_shared<WhiteboardFreehandPathElement>(); + WhiteboardFreehandPathElement::ref element = std::make_shared<WhiteboardFreehandPathElement>(); QColor color = freehandLineItem->pen().color(); std::vector<std::pair<int, int> > points; QVector<QPointF>::const_iterator it = freehandLineItem->points().constBegin(); @@ -292,7 +292,7 @@ namespace Swift { QGraphicsRectItem* rectItem = qgraphicsitem_cast<QGraphicsRectItem*>(item); if (rectItem != nullptr) { QRectF rect = rectItem->rect(); - WhiteboardRectElement::ref element = boost::make_shared<WhiteboardRectElement>(rect.x()+item->pos().x(), rect.y()+item->pos().y(), rect.width(), rect.height()); + WhiteboardRectElement::ref element = std::make_shared<WhiteboardRectElement>(rect.x()+item->pos().x(), rect.y()+item->pos().y(), rect.width(), rect.height()); QColor penColor = rectItem->pen().color(); QColor brushColor = rectItem->brush().color(); @@ -307,7 +307,7 @@ namespace Swift { QGraphicsTextItem* textItem = qgraphicsitem_cast<QGraphicsTextItem*>(item); if (textItem != nullptr) { QPointF point = textItem->pos(); - WhiteboardTextElement::ref element = boost::make_shared<WhiteboardTextElement>(point.x(), point.y()); + WhiteboardTextElement::ref element = std::make_shared<WhiteboardTextElement>(point.x(), point.y()); element->setText(textItem->toPlainText().toStdString()); element->setSize(textItem->font().pointSize()); QColor color = textItem->defaultTextColor(); @@ -319,7 +319,7 @@ namespace Swift { QGraphicsPolygonItem* polygonItem = qgraphicsitem_cast<QGraphicsPolygonItem*>(item); if (polygonItem) { - WhiteboardPolygonElement::ref element = boost::make_shared<WhiteboardPolygonElement>(); + WhiteboardPolygonElement::ref element = std::make_shared<WhiteboardPolygonElement>(); QPolygonF polygon = polygonItem->polygon(); std::vector<std::pair<int, int> > points; QVector<QPointF>::const_iterator it = polygon.begin(); @@ -348,7 +348,7 @@ namespace Swift { int cy = boost::numeric_cast<int>(rect.y()+rect.height()/2 + item->pos().y()); int rx = boost::numeric_cast<int>(rect.width()/2); int ry = boost::numeric_cast<int>(rect.height()/2); - WhiteboardEllipseElement::ref element = boost::make_shared<WhiteboardEllipseElement>(cx, cy, rx, ry); + WhiteboardEllipseElement::ref element = std::make_shared<WhiteboardEllipseElement>(cx, cy, rx, ry); QColor penColor = ellipseItem->pen().color(); QColor brushColor = ellipseItem->brush().color(); @@ -361,12 +361,12 @@ namespace Swift { } if (type == GView::New) { - WhiteboardInsertOperation::ref insertOp = boost::make_shared<WhiteboardInsertOperation>(); + WhiteboardInsertOperation::ref insertOp = std::make_shared<WhiteboardInsertOperation>(); insertOp->setPos(pos); insertOp->setElement(el); whiteboardSession_->sendOperation(insertOp); } else { - WhiteboardUpdateOperation::ref updateOp = boost::make_shared<WhiteboardUpdateOperation>(); + WhiteboardUpdateOperation::ref updateOp = std::make_shared<WhiteboardUpdateOperation>(); updateOp->setPos(pos); if (type == GView::Update) { updateOp->setNewPos(pos); @@ -381,7 +381,7 @@ namespace Swift { } void QtWhiteboardWindow::handleItemDeleted(QString id, int pos) { - WhiteboardDeleteOperation::ref deleteOp = boost::make_shared<WhiteboardDeleteOperation>(); + WhiteboardDeleteOperation::ref deleteOp = std::make_shared<WhiteboardDeleteOperation>(); deleteOp->setElementID(Q2PSTRING(id)); deleteOp->setPos(pos); whiteboardSession_->sendOperation(deleteOp); diff --git a/Swift/QtUI/WinUIHelpers.cpp b/Swift/QtUI/WinUIHelpers.cpp index 30f18a6..4898916 100644 --- a/Swift/QtUI/WinUIHelpers.cpp +++ b/Swift/QtUI/WinUIHelpers.cpp @@ -17,7 +17,7 @@ #include <cryptuiapi.h> #pragma comment(lib, "cryptui.lib") -#include <boost/shared_ptr.hpp> +#include <memory> #include <Swiften/Base/foreach.h> @@ -35,7 +35,7 @@ void WinUIHelpers::displayCertificateChainAsSheet(QWidget* parent, const std::ve } ByteArray certAsDER = chain[0]->toDER(); - boost::shared_ptr<const CERT_CONTEXT> certificate_chain; + std::shared_ptr<const CERT_CONTEXT> certificate_chain; { PCCERT_CONTEXT certChain; BOOL ok = CertAddCertificateContextToStore(chainStore, CertCreateCertificateContext(X509_ASN_ENCODING, vecptr(certAsDER), certAsDER.size()), CERT_STORE_ADD_ALWAYS, &certChain); |