diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-07-04 18:23:10 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-07-04 18:23:10 (GMT) |
commit | e2fd68762f2bca98e415da2a287c523042ed36a8 (patch) | |
tree | ad7b999a0f08dca631c07ee1cfe89b2cce90f151 /Swift/Controllers/Chat | |
parent | c78424678261c59bcbf924b53e1ebe12b6cc1201 (diff) | |
download | swift-contrib-e2fd68762f2bca98e415da2a287c523042ed36a8.zip swift-contrib-e2fd68762f2bca98e415da2a287c523042ed36a8.tar.bz2 |
Moving some ChatList logic to Controllers.
Diffstat (limited to 'Swift/Controllers/Chat')
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 12 | ||||
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.h | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index ef85107..31764f7 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -76,7 +76,11 @@ ChatsManager::ChatsManager( profileSettings_ = settings; presenceOracle_->onPresenceChange.connect(boost::bind(&ChatsManager::handlePresenceChange, this, _1)); uiEventConnection_ = uiEventStream_->onUIEvent.connect(boost::bind(&ChatsManager::handleUIEvent, this, _1)); + chatListWindow_ = chatListWindowFactory->createChatListWindow(uiEventStream_); + chatListWindow_->onMUCBookmarkActivated.connect(boost::bind(&ChatsManager::handleMUCBookmarkActivated, this, _1)); + chatListWindow_->onRecentActivated.connect(boost::bind(&ChatsManager::handleRecentActivated, this, _1)); + joinMUCWindow_ = NULL; mucSearchController_ = new MUCSearchController(jid_, mucSearchWindowFactory, iqRouter, settings); mucSearchController_->onMUCSelected.connect(boost::bind(&ChatsManager::handleMUCSelectedAfterSearch, this, _1)); @@ -404,5 +408,13 @@ void ChatsManager::handleMUCSelectedAfterSearch(const JID& muc) { } } +void ChatsManager::handleMUCBookmarkActivated(const MUCBookmark& mucBookmark) { + uiEventStream_->send(boost::make_shared<JoinMUCUIEvent>(mucBookmark.getRoom(), mucBookmark.getNick())); +} + +void ChatsManager::handleRecentActivated(const ChatListWindow::Chat& chat) { + uiEventStream_->send(boost::make_shared<RequestChatUIEvent>(chat.jid)); +} + } diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h index 170e87c..936f5a8 100644 --- a/Swift/Controllers/Chat/ChatsManager.h +++ b/Swift/Controllers/Chat/ChatsManager.h @@ -51,6 +51,7 @@ namespace Swift { void setOnline(bool enabled); void setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info); void handleIncomingMessage(boost::shared_ptr<Message> message); + private: void handleChatRequest(const std::string& contact); void handleJoinMUCRequest(const JID& muc, const boost::optional<std::string>& nick, bool autoJoin); @@ -70,10 +71,15 @@ namespace Swift { void loadRecents(); void saveRecents(); void handleChatMadeRecent(); + void handleMUCBookmarkActivated(const MUCBookmark&); + void handleRecentActivated(const ChatListWindow::Chat&); + ChatController* getChatControllerOrFindAnother(const JID &contact); ChatController* createNewChatController(const JID &contact); ChatController* getChatControllerOrCreate(const JID &contact); ChatController* getChatControllerIfExists(const JID &contact); + + private: std::map<JID, MUCController*> mucControllers_; std::map<JID, ChatController*> chatControllers_; EventController* eventController_; |