From 617aae78858ea50aa82cd9012f41c547057f5707 Mon Sep 17 00:00:00 2001 From: Kevin Smith <git@kismith.co.uk> Date: Fri, 8 Jul 2011 08:57:03 +0100 Subject: Cleaning up the unread chats diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index 66817aa..cf31bde 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -135,7 +135,7 @@ void ChatsManager::loadRecents() { ChatListWindow::Chat chat(jid, nickResolver_->jidToNick(jid), activity, 0, isMUC, nick); prependRecent(chat); } - chatListWindow_->setRecents(recentChats_); + handleUnreadCountChanged(NULL); } void ChatsManager::setupBookmarks() { @@ -186,14 +186,14 @@ void ChatsManager::handleChatActivity(const JID& jid, const std::string& activit /* FIXME: handle nick changes */ appendRecent(chat); - chatListWindow_->setRecents(recentChats_); + handleUnreadCountChanged(NULL); saveRecents(); } void ChatsManager::handleUnreadCountChanged(ChatController* controller) { int unreadTotal = 0; foreach (ChatListWindow::Chat chatItem, recentChats_) { - if (chatItem.jid == controller->getToJID()) { + if (controller && chatItem.jid.toBare() == controller->getToJID().toBare()) { chatItem.setUnreadCount(controller->getUnreadCount()); } unreadTotal += chatItem.unreadCount; -- cgit v0.10.2-6-g49f6