From 0e90e94a4d5cbac2d186f0056821a51078e8d1bd Mon Sep 17 00:00:00 2001
From: Gilbert Gonzales <gilbert@lindenlab.com>
Date: Mon, 14 Jan 2013 17:23:06 -0800
Subject: CHUI-668: The user's most intrusive notification is not used anymore
 when coming out of DND mode with IMs. Adjusted code to just open the
 converseation floater (which was changed also in a prior fix by PE).

---
 indra/newview/lldonotdisturbnotificationstorage.cpp | 13 +++++++++++++
 indra/newview/llimview.cpp                          | 19 +++----------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/indra/newview/lldonotdisturbnotificationstorage.cpp b/indra/newview/lldonotdisturbnotificationstorage.cpp
index 5cc0ab2081..12ff308a77 100644
--- a/indra/newview/lldonotdisturbnotificationstorage.cpp
+++ b/indra/newview/lldonotdisturbnotificationstorage.cpp
@@ -33,6 +33,7 @@
 #include "lldir.h"
 #include "llerror.h"
 #include "llfasttimer_class.h"
+#include "llfloaterreg.h"
 #include "llnotifications.h"
 #include "llnotificationhandler.h"
 #include "llnotificationstorage.h"
@@ -103,6 +104,7 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()
 	}
 	
 	LLNotifications& instance = LLNotifications::instance();
+    bool imToastExists = false;
 	
 	for (LLSD::array_const_iterator notification_it = data.beginArray();
 		 notification_it != data.endArray();
@@ -110,8 +112,14 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()
 	{
 		LLSD notification_params = *notification_it;
         const LLUUID& notificationID = notification_params["id"];
+        std::string notificationName = notification_params["name"];
         LLNotificationPtr notification = instance.find(notificationID);
 
+        if(notificationName == "IMToast")
+        {
+            imToastExists = true;
+        }
+
         //Notification already exists in notification pipeline (same instance of app running)
 		if (notification)
 		{
@@ -138,6 +146,11 @@ void LLDoNotDisturbNotificationStorage::loadNotifications()
 		}
 	}
 
+    if(imToastExists)
+    {
+        LLFloaterReg::showInstance("im_container");
+    }
+
 	// Clear the communication channel history and rewrite the save file to empty it as well
 	LLNotificationChannelPtr channelPtr = getCommunicationChannel();
 	LLCommunicationChannel *commChannel = dynamic_cast<LLCommunicationChannel*>(channelPtr.get());
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 32b4afcfef..ff171fc0f8 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -128,18 +128,11 @@ void process_dnd_im(const LLSD& notification)
             false, 
             false); //will need slight refactor to retrieve whether offline message or not (assume online for now)
     }
-
-    // open conversation floater
-	LLFloaterIMContainer* container_floater =
-			LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
-	if (container_floater && !(container_floater->isFrontmost()))
-    {
-		container_floater->openFloater();
-		container_floater->setFrontmost(TRUE);
-    }
 }
 
 
+
+
 static void on_avatar_name_cache_toast(const LLUUID& agent_id,
 									   const LLAvatarName& av_name,
 									   LLSD msg)
@@ -2626,13 +2619,7 @@ void LLIMMgr::addMessage(
 	// Open conversation floater if offline messages are present
 	if (is_offline_msg)
     {
-		LLFloaterIMContainer* container_floater =
-				LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
-		if (container_floater && !(container_floater->isFrontmost()))
-		{
-			container_floater->openFloater();
-			container_floater->setFrontmost(TRUE);
-		}
+        LLFloaterReg::showInstance("im_container");
     }
 
 }
-- 
cgit v1.2.3