diff options
author | Joanna Hulboj <joanna.hulboj@isode.com> | 2017-05-04 14:50:51 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2017-05-10 08:56:38 (GMT) |
commit | 1cb2bb760d6487764a9480c84cf2d2edc65ff564 (patch) | |
tree | aa5d01bb3c0fc74d28c96343571ff934447f059a /Swift/Controllers/Chat/ChatsManager.cpp | |
parent | 473a73c7112e9fbcd441fa1bf5ff7b1f96ee28bd (diff) | |
download | swift-1cb2bb760d6487764a9480c84cf2d2edc65ff564.zip swift-1cb2bb760d6487764a9480c84cf2d2edc65ff564.tar.bz2 |
Fix chat window title being displayed incorrectly
Test-Information:
Open Swift app, from Recent Chat List click on entry that was created
from offline invitees. New chat window will be opened and the title will
be the same as Recent Chat List entry.
Change-Id: Ia8730aaabfd78e7026d15f3162d4fa46b1489397
Diffstat (limited to 'Swift/Controllers/Chat/ChatsManager.cpp')
-rw-r--r-- | Swift/Controllers/Chat/ChatsManager.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 9db343f..d9f80ba 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -848,60 +848,64 @@ MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::opti MUCController* controller = nullptr; SingleChatWindowFactoryAdapter* chatWindowFactoryAdapter = nullptr; if (reuseChatwindow) { chatWindowFactoryAdapter = new SingleChatWindowFactoryAdapter(reuseChatwindow); } std::shared_ptr<ChatMessageParser> chatMessageParser = std::make_shared<ChatMessageParser>(emoticons_, highlightManager_->getConfiguration(), ChatMessageParser::Mode::GroupChat); /* 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_, nickResolver_, 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 * controllers' dtor, which are deleted in ChatManager's dtor. The adapters * are also deleted there.*/ chatWindowFactoryAdapters_[controller] = chatWindowFactoryAdapter; } mucControllers_[mucJID] = controller; controller->setAvailableServerFeatures(serverDiscoInfo_); controller->onUserLeft.connect(boost::bind(&ChatsManager::handleUserLeftMUC, this, controller)); controller->onUserJoined.connect(boost::bind(&ChatsManager::handleChatActivity, this, mucJID.toBare(), "", true)); controller->onUserNicknameChanged.connect(boost::bind(&ChatsManager::handleUserNicknameChanged, this, controller, _1, _2)); controller->onActivity.connect(boost::bind(&ChatsManager::handleChatActivity, this, mucJID.toBare(), _1, true)); controller->onUnreadCountChanged.connect(boost::bind(&ChatsManager::handleUnreadCountChanged, this, controller)); if (!stanzaChannel_->isAvailable()) { /* When online, the MUC is added to the registry in MUCImpl::internalJoin. This method is not * called when Swift is offline, so we add it here as only MUCs in the registry are rejoined * when going back online. */ mucRegistry_->addMUC(mucJID.toBare()); } handleChatActivity(mucJID.toBare(), "", true); } + auto chatListWindowIter = std::find_if(recentChats_.begin(), recentChats_.end(), [&](const ChatListWindow::Chat& chatListWindow) { return mucJID == (chatListWindow.jid); }); + if (chatListWindowIter != recentChats_.end()) { + mucControllers_[mucJID]->setChatWindowTitle(chatListWindowIter->getTitle()); + } mucControllers_[mucJID]->showChatWindow(); return muc; } void ChatsManager::handleSearchMUCRequest() { mucSearchController_->openSearchWindow(); } void ChatsManager::handleUserNicknameChanged(MUCController* mucController, const std::string& oldNickname, const std::string& newNickname) { JID oldMUCChatJID = mucController->getToJID().withResource(oldNickname); JID newMUCChatJID = mucController->getToJID().withResource(newNickname); SWIFT_LOG(debug) << "nickname change in " << mucController->getToJID().toString() << " from " << oldNickname << " to " << newNickname << std::endl; // get current chat controller ChatController *chatController = getChatControllerIfExists(oldMUCChatJID); if (chatController) { // adjust chat controller chatController->setToJID(newMUCChatJID); nickResolver_->onNickChanged(newMUCChatJID, oldNickname); chatControllers_.erase(oldMUCChatJID); chatControllers_[newMUCChatJID] = chatController; chatController->onActivity.disconnect(boost::bind(&ChatsManager::handleChatActivity, this, oldMUCChatJID, _1, false)); chatController->onActivity.connect(boost::bind(&ChatsManager::handleChatActivity, this, newMUCChatJID, _1, false)); } } bool ChatsManager::messageCausesSessionBinding(std::shared_ptr<Message> message) { |