summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-07-08 19:16:47 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-07-08 19:18:13 (GMT)
commit21e1e2d829690a127386071f173ffd8ad2e21db4 (patch)
tree79aa8b1475ca4c083b754a0d71a1ea2f06971b44
parent092d1572c2c8378ca9f48a6b2ecb57bc5f2c2161 (diff)
downloadswift-contrib-21e1e2d829690a127386071f173ffd8ad2e21db4.zip
swift-contrib-21e1e2d829690a127386071f173ffd8ad2e21db4.tar.bz2
Don't rebind chats when chatlistview updated
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp13
-rw-r--r--Swift/Controllers/Chat/ChatsManager.h2
2 files changed, 10 insertions, 5 deletions
diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 632ecd3..a2abbad 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -173,7 +173,7 @@ void ChatsManager::handleMUCBookmarkRemoved(const MUCBookmark& bookmark) {
ChatListWindow::Chat ChatsManager::createChatListChatItem(const JID& jid, const std::string& activity) {
int unreadCount = 0;
- ChatController* controller = getChatControllerIfExists(jid);
+ ChatController* controller = getChatControllerIfExists(jid, false);
if (controller) {
unreadCount = controller->getUnreadCount();
}
@@ -345,7 +345,7 @@ ChatController* ChatsManager::getChatControllerOrCreate(const JID &contact) {
return controller ? controller : createNewChatController(contact);
}
-ChatController* ChatsManager::getChatControllerIfExists(const JID &contact) {
+ChatController* ChatsManager::getChatControllerIfExists(const JID &contact, bool rebindIfNeeded) {
if (chatControllers_.find(contact) == chatControllers_.end()) {
if (mucRegistry_->isMUC(contact.toBare())) {
return NULL;
@@ -357,8 +357,13 @@ ChatController* ChatsManager::getChatControllerIfExists(const JID &contact) {
} else {
foreach (JIDChatControllerPair pair, chatControllers_) {
if (pair.first.toBare() == contact.toBare()) {
- rebindControllerJID(pair.first, contact);
- return chatControllers_[contact];
+ if (rebindIfNeeded) {
+ rebindControllerJID(pair.first, contact);
+ return chatControllers_[contact];
+ } else {
+ return pair.second;
+ }
+
}
}
return NULL;
diff --git a/Swift/Controllers/Chat/ChatsManager.h b/Swift/Controllers/Chat/ChatsManager.h
index ccfdb3a..be6e575 100644
--- a/Swift/Controllers/Chat/ChatsManager.h
+++ b/Swift/Controllers/Chat/ChatsManager.h
@@ -79,7 +79,7 @@ namespace Swift {
ChatController* getChatControllerOrFindAnother(const JID &contact);
ChatController* createNewChatController(const JID &contact);
ChatController* getChatControllerOrCreate(const JID &contact);
- ChatController* getChatControllerIfExists(const JID &contact);
+ ChatController* getChatControllerIfExists(const JID &contact, bool rebindIfNeeded = true);
private:
std::map<JID, MUCController*> mucControllers_;