diff options
| author | Kevin Smith <git@kismith.co.uk> | 2013-06-01 08:26:46 (GMT) | 
|---|---|---|
| committer | Kevin Smith <git@kismith.co.uk> | 2013-08-01 09:22:45 (GMT) | 
| commit | db698bbb6d8c7e878e2cb997e18e572f3646e11d (patch) | |
| tree | 61aa3ff72c64dd8f309a2fe4b31b5b2d3f22f04b /Swift/Controllers/Chat/ChatsManager.cpp | |
| parent | b45602bcd36fb9d2e7a22998434e31014f072d33 (diff) | |
| download | swift-db698bbb6d8c7e878e2cb997e18e572f3646e11d.zip swift-db698bbb6d8c7e878e2cb997e18e572f3646e11d.tar.bz2 | |
Refactor chat messages so parsing of links/emoticons happens in controllers.
Change-Id: I07256f23ffbb6520f5063bdfbed9111946c46746
Diffstat (limited to 'Swift/Controllers/Chat/ChatsManager.cpp')
| -rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 41 | 
1 files changed, 22 insertions, 19 deletions
| diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index d6010e9..5dd53c1 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -1,16 +1,30 @@  /* - * Copyright (c) 2010-2011 Kevin Smith + * Copyright (c) 2010-2013 Kevin Smith   * Licensed under the GNU General Public License v3.   * See Documentation/Licenses/GPLv3.txt for more information.   */ -#include "Swift/Controllers/Chat/ChatsManager.h" +#include <Swift/Controllers/Chat/ChatsManager.h>  #include <boost/bind.hpp>  #include <boost/algorithm/string.hpp>  #include <boost/smart_ptr/make_shared.hpp>  #include <Swiften/Base/foreach.h> +#include <Swiften/Presence/PresenceSender.h> +#include <Swiften/Client/NickResolver.h> +#include <Swiften/MUC/MUCManager.h> +#include <Swiften/Elements/ChatState.h> +#include <Swiften/Elements/MUCUserPayload.h> +#include <Swiften/Elements/DeliveryReceipt.h> +#include <Swiften/Elements/DeliveryReceiptRequest.h> +#include <Swiften/MUC/MUCBookmarkManager.h> +#include <Swiften/Avatars/AvatarManager.h> +#include <Swiften/Elements/MUCInvitationPayload.h> +#include <Swiften/Roster/XMPPRoster.h> +#include <Swiften/Client/ClientBlockListManager.h> +#include <Swiften/Client/StanzaChannel.h> +  #include <Swift/Controllers/Chat/ChatController.h>  #include <Swift/Controllers/Chat/ChatControllerBase.h>  #include <Swift/Controllers/Chat/MUCSearchController.h> @@ -25,25 +39,12 @@  #include <Swift/Controllers/UIInterfaces/ChatListWindowFactory.h>  #include <Swift/Controllers/UIInterfaces/JoinMUCWindow.h>  #include <Swift/Controllers/UIInterfaces/JoinMUCWindowFactory.h> -#include <Swiften/Presence/PresenceSender.h> -#include <Swiften/Client/NickResolver.h> -#include <Swiften/MUC/MUCManager.h> -#include <Swiften/Elements/ChatState.h> -#include <Swiften/Elements/MUCUserPayload.h> -#include <Swiften/Elements/DeliveryReceipt.h> -#include <Swiften/Elements/DeliveryReceiptRequest.h> -#include <Swiften/MUC/MUCBookmarkManager.h>  #include <Swift/Controllers/FileTransfer/FileTransferController.h>  #include <Swift/Controllers/FileTransfer/FileTransferOverview.h>  #include <Swift/Controllers/ProfileSettingsProvider.h> -#include <Swiften/Avatars/AvatarManager.h> -#include <Swiften/Elements/MUCInvitationPayload.h> -#include <Swiften/Roster/XMPPRoster.h>  #include <Swift/Controllers/Settings/SettingsProvider.h>  #include <Swift/Controllers/SettingConstants.h> -#include <Swiften/Client/StanzaChannel.h>  #include <Swift/Controllers/WhiteboardManager.h> -#include <Swiften/Client/ClientBlockListManager.h>  namespace Swift { @@ -77,7 +78,8 @@ ChatsManager::ChatsManager(  		HistoryController* historyController,  		WhiteboardManager* whiteboardManager,  		HighlightManager* highlightManager, -		ClientBlockListManager* clientBlockListManager) : +		ClientBlockListManager* clientBlockListManager, +		std::map<std::string, std::string>* emoticons) :  			jid_(jid),   			joinMUCWindowFactory_(joinMUCWindowFactory),   			useDelayForLatency_(useDelayForLatency),  @@ -91,7 +93,8 @@ ChatsManager::ChatsManager(  			historyController_(historyController),  			whiteboardManager_(whiteboardManager),  			highlightManager_(highlightManager), -			clientBlockListManager_(clientBlockListManager) { +			clientBlockListManager_(clientBlockListManager), +			emoticons_(emoticons) {  	timerFactory_ = timerFactory;  	eventController_ = eventController;  	stanzaChannel_ = stanzaChannel; @@ -526,7 +529,7 @@ ChatController* ChatsManager::getChatControllerOrFindAnother(const JID &contact)  ChatController* ChatsManager::createNewChatController(const JID& contact) {  	assert(chatControllers_.find(contact) == chatControllers_.end()); -	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_); +	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_, emoticons_);  	chatControllers_[contact] = controller;  	controller->setAvailableServerFeatures(serverDiscoInfo_);  	controller->onActivity.connect(boost::bind(&ChatsManager::handleChatActivity, this, contact, _1, false)); @@ -599,7 +602,7 @@ void ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::optional  		if (createAsReservedIfNew) {  			muc->setCreateAsReservedIfNew();  		} -		MUCController* controller = new MUCController(jid_, muc, password, nick, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory_, eventController_, entityCapsProvider_, roster_, historyController_, mucRegistry_, highlightManager_); +		MUCController* controller = new MUCController(jid_, muc, password, nick, stanzaChannel_, iqRouter_, chatWindowFactory_, presenceOracle_, avatarManager_, uiEventStream_, false, timerFactory_, eventController_, entityCapsProvider_, roster_, historyController_, mucRegistry_, highlightManager_, emoticons_);  		mucControllers_[mucJID] = controller;  		controller->setAvailableServerFeatures(serverDiscoInfo_);  		controller->onUserLeft.connect(boost::bind(&ChatsManager::handleUserLeftMUC, this, controller)); | 
 Swift
 Swift