From c0842339e72b15331a5bbb6bd41324c28916d678 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Tue, 19 Jun 2012 15:05:20 -0700
Subject: [PATCH] CHUI-138 : Suppress chiclets for conversations when using
 tabbed UI; Make sure list is cleaned up on close

---
 indra/newview/llchicletbar.cpp |  9 ++++++++-
 indra/newview/llimfloater.cpp  | 20 ++++++++++----------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/indra/newview/llchicletbar.cpp b/indra/newview/llchicletbar.cpp
index 8701b602ce8..54a49ca49c1 100644
--- a/indra/newview/llchicletbar.cpp
+++ b/indra/newview/llchicletbar.cpp
@@ -102,6 +102,13 @@ void LLChicletBar::sessionAdded(const LLUUID& session_id, const std::string& nam
 	// no need to spawn chiclets for participants in P2P calls called through Avaline
 	if (session->isP2P() && session->isOtherParticipantAvaline()) return;
 
+	// Do not spawn chiclet when using the new multitab conversation UI
+	if (LLIMConversation::isChatMultiTab())
+	{
+		LLIMFloater::addToHost(session_id);
+		return;
+	}
+	
 	if (getChicletPanel()->findChiclet<LLChiclet>(session_id)) return;
 
 	LLIMChiclet* chiclet = createIMChiclet(session_id);
@@ -109,7 +116,7 @@ void LLChicletBar::sessionAdded(const LLUUID& session_id, const std::string& nam
 	{
 		chiclet->setIMSessionName(name);
 		chiclet->setOtherParticipantId(other_participant_id);
-		
+
 		LLIMFloater::onIMChicletCreated(session_id);
 
 	}
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 882637151d9..4b954de7385 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -109,6 +109,16 @@ void LLIMFloater::onFocusReceived()
 // virtual
 void LLIMFloater::onClose(bool app_quitting)
 {
+	// Always suppress the IM from the conversations list on close if present for any reason
+	if (LLIMConversation::isChatMultiTab())
+	{
+		LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance();
+		if (im_box)
+		{
+            im_box->removeConversationListItem(mSessionID);
+        }
+    }
+
 	LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
 				mSessionID);
 
@@ -140,16 +150,6 @@ void LLIMFloater::onClose(bool app_quitting)
 	// Last change:
 	// EXT-3516 X Button should end IM session, _ button should hide
 	gIMMgr->leaveSession(mSessionID);
-    
-	// Suppress the IM from the conversations list
-	if (LLIMConversation::isChatMultiTab())
-	{
-		LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance();
-		if (im_box)
-		{
-            im_box->removeConversationListItem(mSessionID);
-        }
-    }
 }
 
 /* static */
-- 
GitLab