diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index 9795df78ae8bfbd4f2739c35bc875b26313352a6..a21ee07d47754d7799c9cf6486713e0ccfd5fc21 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -335,14 +335,6 @@ void LLFloaterIMSessionTab::appendMessage(const LLChat& chat, const LLSD &args)
 	if (im_box)
 	{
 		im_box->setTimeNow(mSessionID,chat.mFromID);
-
-		// TODO: Warning! The next two lines of code are included below only temporarily
-		// to demonstrate the correct format call the appropriate functions.
-		// They should be moved to the right places when working on CHUI-486. ~Alex ProductEngine.
-		// ---- start demo ----
-        //    im_box->flashConversationItemWidget(mSessionID, true); // flashing of the conversation's item
-        //    gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat"
-        // ---- end demo -----
 	}
 	
 
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index a4e356f6a9a5140267c287dc0108d8a91487f011..f0e2f45db3c228b58368a953b310b480568b90f0 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -114,76 +114,84 @@ static void on_avatar_name_cache_toast(const LLUUID& agent_id,
 	LLNotificationsUtil::add("IMToast", args, LLSD(), boost::bind(&LLFloaterIMContainer::showConversation, LLFloaterIMContainer::getInstance(), msg["session_id"].asUUID()));
 }
 
-void toast_callback(const LLSD& msg){
-	// do not show toast in do not disturb mode or it goes from agent
-	if (gAgent.isDoNotDisturb() || gAgent.getID() == msg["from_id"])
-	{
-		return;
-	}
+void on_new_message(const LLSD& msg)
+{
+	std::string action;
+	LLUUID participant_id = msg["from_id"].asUUID();
+	LLUUID session_id = msg["session_id"];
+    LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
 
-    // Skip toasting if we have open window of IM with this session id
-    LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(msg["session_id"]);
-    if (
-           open_im_floater
-           && open_im_floater->isInVisibleChain()
-           && open_im_floater->hasFocus()
-           && !open_im_floater->isMinimized()
-           && !(open_im_floater->getHost()
-                   && open_im_floater->getHost()->isMinimized())
-       )
+    // determine action for this session
+    if (session_id.isNull())
     {
-        return;
+    	action = gSavedSettings.getString("NotificationNearbyChatOptions");
     }
-
-	// Skip toasting for system messages
-	if (msg["from_id"].asUUID() == LLUUID::null)
-	{
-		return;
-	}
-
-    // *NOTE Skip toasting if the user disable it in preferences/debug settings ~Alexandrea
-    LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
-        msg["session_id"]);
-
-
-    //Ignore P2P Friend/Non-Friend toasts
-    if(session->isP2PSessionType())
+    else if(session->isP2PSessionType())
     {
-        //Ignores non-friends
-        if((LLAvatarTracker::instance().getBuddyInfo(msg["from_id"]) == NULL) 
-            && (gSavedSettings.getString("NotificationNonFriendIMOptions") != "toast"))
+        if (LLAvatarTracker::instance().isBuddy(msg["from_id"].asUUID()))
         {
-            return;
+        	action = gSavedSettings.getString("NotificationFriendIMOptions");
         }
-        //Ignores friends
-        else if(gSavedSettings.getString("NotificationFriendIMOptions") != "toast")
+        else
         {
-            return;
+        	action = gSavedSettings.getString("NotificationNonFriendIMOptions");
         }
     }
-    //Ignore Ad Hoc Toasts
-    else if(session->isAdHocSessionType() 
-            && (gSavedSettings.getString("NotificationConferenceIMOptions") != "toast"))
+    else if(session->isAdHocSessionType())
     {
-        return;
+    	action = gSavedSettings.getString("NotificationConferenceIMOptions");
     }
-    //Ignore Group Toasts
-    else if(session->isGroupSessionType() 
-            && (gSavedSettings.getString("NotificationGroupChatOptions") != "toast"))
+    else if(session->isGroupSessionType())
     {
-        return;
+    	action = gSavedSettings.getString("NotificationGroupChatOptions");
     }
 
-    //Show toast
-	LLAvatarNameCache::get(msg["from_id"].asUUID(),
-		boost::bind(&on_avatar_name_cache_toast,
-			_1, _2, msg));
+	// do not show notification in "do not disturb" mode or it goes from agent
+	if (gAgent.isDoNotDisturb() || gAgent.getID() == participant_id)
+	{
+		return;
+	}
+
+	if ("toast" == action)
+	{
+	    // Skip toasting if we have open window of IM with this session id
+        LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(msg["session_id"]);
+        if (
+             open_im_floater
+             && open_im_floater->isInVisibleChain()
+             && open_im_floater->hasFocus()
+             && !open_im_floater->isMinimized()
+             && !(open_im_floater->getHost()
+                   && open_im_floater->getHost()->isMinimized())
+           )
+        {
+            return;
+        }
+
+	    // Skip toasting for system messages
+	    if (participant_id.isNull())
+	    {
+		    return;
+	    }
+
+        //Show toast
+	    LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
+	}
+	else if ("flash" == action)
+	{
+		LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+		if (im_box)
+        {
+			im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item
+        }
+        gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat"
+	}
 }
 
 LLIMModel::LLIMModel() 
 {
 	addNewMsgCallback(boost::bind(&LLFloaterIMSession::newIMCallback, _1));
-	addNewMsgCallback(boost::bind(&toast_callback, _1));
+	addNewMsgCallback(boost::bind(&on_new_message, _1));
 }
 
 LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice, bool has_offline_msg)