From 120fc58d759630824d2e4107bf3c4f5a822999f5 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sat, 9 Jul 2011 20:31:47 +0100
Subject: Get the avatar right in the chats list more often


diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 4c43a89..12fec4f 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -347,16 +347,21 @@ void ChatsManager::setAvatarManager(AvatarManager* avatarManager) {
 		avatarManager_->onAvatarChanged.disconnect(boost::bind(&ChatsManager::handleAvatarChanged, this, _1));
 	}
 	avatarManager_ = avatarManager;
+	foreach (ChatListWindow::Chat& chat, recentChats_) {
+		if (!chat.isMUC) {
+			chat.setAvatarPath(avatarManager_->getAvatarPath(chat.jid));
+		}
+	}
 	avatarManager_->onAvatarChanged.connect(boost::bind(&ChatsManager::handleAvatarChanged, this, _1));
 }
 
 void ChatsManager::handleAvatarChanged(const JID& jid) {
 	foreach (ChatListWindow::Chat& chat, recentChats_) {
-			if (!chat.isMUC && jid.toBare() == chat.jid.toBare()) {
-				chat.setAvatarPath(avatarManager_->getAvatarPath(jid));
-				break;
-			}
+		if (!chat.isMUC && jid.toBare() == chat.jid.toBare()) {
+			chat.setAvatarPath(avatarManager_->getAvatarPath(jid));
+			break;
 		}
+	}
 }
 
 void ChatsManager::setServerDiscoInfo(boost::shared_ptr<DiscoInfo> info) {
-- 
cgit v0.10.2-6-g49f6