From 5adcba3ba42a0f7cfde8dfdf6aa6f322077c3744 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sat, 16 Jul 2011 21:24:39 +0100
Subject: Show the correct (unavailable) presence for a MUC in the recents list
 after leaving.

Resolves: #932

diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 5c0475d..05017e7 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -271,6 +271,8 @@ void ChatsManager::handleUserLeftMUC(MUCController* mucController) {
 			foreach (ChatListWindow::Chat& chat, recentChats_) {
 				if (chat.isMUC && chat.jid == (*it).first) {
 					chat.statusType = StatusShow::None;
+					chatListWindow_->setRecents(recentChats_);
+					break;
 				}
 			}
 			mucControllers_.erase(it);
@@ -324,7 +326,7 @@ void ChatsManager::handlePresenceChange(boost::shared_ptr<Presence> newPresence)
 	if (mucRegistry_->isMUC(newPresence->getFrom().toBare())) return;
 
 	foreach (ChatListWindow::Chat& chat, recentChats_) {
-		if (newPresence->getFrom().toBare() == chat.jid.toBare()) {
+		if (newPresence->getFrom().toBare() == chat.jid.toBare() && !chat.isMUC) {
 			Presence::ref presence = presenceOracle_->getHighestPriorityPresence(chat.jid.toBare());
 			chat.setStatusType(presence ? presence->getShow() : StatusShow::None);
 			chatListWindow_->setRecents(recentChats_);
-- 
cgit v0.10.2-6-g49f6