From 9ad4cc1f2b5117268348cc5625be782f717ad081 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Fri, 31 Dec 2010 22:12:28 +0000
Subject: Fix the MUC PM routing again.

Resolves: #725

diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp
index 814d87d..722b98f 100644
--- a/Swift/Controllers/Chat/ChatsManager.cpp
+++ b/Swift/Controllers/Chat/ChatsManager.cpp
@@ -213,6 +213,9 @@ ChatController* ChatsManager::getChatControllerOrCreate(const JID &contact) {
 
 ChatController* ChatsManager::getChatControllerIfExists(const JID &contact) {
 	if (chatControllers_.find(contact) == chatControllers_.end()) {
+		if (mucRegistry_->isMUC(contact.toBare())) {
+			return NULL;
+		}
 		//Need to look for an unbound window to bind first
 		JID bare(contact.toBare());
 		if (chatControllers_.find(bare) != chatControllers_.end()) {
diff --git a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
index 042b7c6..6d20f70 100644
--- a/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/Chat/UnitTest/ChatsManagerTest.cpp
@@ -239,14 +239,14 @@ public:
 		uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString1))));
 
 		String messageJIDString2("testling@test.com/2");
-		//ChatWindow* window2 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>();
-		//mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString2), uiEventStream_).Return(window2);
+		ChatWindow* window2 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>();
+		mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString2), uiEventStream_).Return(window2);
 
 		uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString2))));
 
 		String messageJIDString3("testling@test.com/3");
-		//ChatWindow* window3 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>();
-		//mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString3), uiEventStream_).Return(window3);
+		ChatWindow* window3 = new MockChatWindow();//mocks_->InterfaceMock<ChatWindow>();
+		mocks_->ExpectCall(chatWindowFactory_, ChatWindowFactory::createChatWindow).With(JID(messageJIDString3), uiEventStream_).Return(window3);
 
 		uiEventStream_->send(boost::shared_ptr<UIEvent>(new RequestChatUIEvent(JID(messageJIDString3))));
 
-- 
cgit v0.10.2-6-g49f6