summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2017-05-18 14:31:36 (GMT)
committerTobias Markmann <tm@ayena.de>2017-05-19 11:49:14 (GMT)
commita986b2a4cef30a83df385e616503c9029b039610 (patch)
tree61df7b33c227baf247fed09648591ce481af4716 /Swift/Controllers/Chat/ChatsManager.cpp
parent7b53dc308feeef2da9d826c6bbfe215222af8639 (diff)
downloadswift-a986b2a4cef30a83df385e616503c9029b039610.zip
swift-a986b2a4cef30a83df385e616503c9029b039610.tar.bz2
Only apply impromptu chat title style to impromptu chats
Fixes regression of 1cb2bb7, that would show the full bare JID as chat title for normal MUCs. Test-Information: Added unit test for having the classic title style for normal MUCS. Joined basic MUC room and verified it only shows the node part of the MUC JID as chat title. Verified that for impromptu chats, it shows the list of participants as chat title. Tested on macOS 10.12.5 with Qt 5.4.2. Change-Id: I3685172378c0b6303524c89876b044eac1aa1422
Diffstat (limited to 'Swift/Controllers/Chat/ChatsManager.cpp')
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 190ca8b..b7087fd 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -435,6 +435,15 @@ void ChatsManager::handleChatActivity(const JID& jid, const std::string& activit
appendRecent(chat);
handleUnreadCountChanged(nullptr);
saveRecents();
+
+ // Look up potential MUC controller and update title accordingly as people
+ // join impromptu chats.
+ if (mucControllers_.find(jid) != mucControllers_.end()) {
+ auto chatListWindowIter = std::find_if(recentChats_.begin(), recentChats_.end(), [&](const ChatListWindow::Chat& chatListWindow) { return jid == (chatListWindow.jid); });
+ if (chatListWindowIter != recentChats_.end() && (mucControllers_[jid]->isImpromptu() || !chatListWindowIter->impromptuJIDs.empty())) {
+ mucControllers_[jid]->setChatWindowTitle(chatListWindowIter->getTitle());
+ }
+ }
}
void ChatsManager::handleChatClosed(const JID& /*jid*/) {
@@ -875,8 +884,9 @@ MUC::ref ChatsManager::handleJoinMUCRequest(const JID &mucJID, const boost::opti
}
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()) {
+ if (chatListWindowIter != recentChats_.end() && (mucControllers_[mucJID]->isImpromptu() || !chatListWindowIter->impromptuJIDs.empty())) {
mucControllers_[mucJID]->setChatWindowTitle(chatListWindowIter->getTitle());
}