summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterimnearbychathandler.cpp5
-rw-r--r--indra/newview/llimview.cpp68
2 files changed, 45 insertions, 28 deletions
diff --git a/indra/newview/llfloaterimnearbychathandler.cpp b/indra/newview/llfloaterimnearbychathandler.cpp
index 903c903381..f64cfd0245 100644
--- a/indra/newview/llfloaterimnearbychathandler.cpp
+++ b/indra/newview/llfloaterimnearbychathandler.cpp
@@ -557,7 +557,10 @@ void LLFloaterIMNearbyChatHandler::processChat(const LLChat& chat_msg,
// Send event on to LLEventStream
sChatWatcher->post(chat);
- if( nearby_chat->isInVisibleChain()
+ LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+
+ if( nearby_chat->hasFocus()
+ || im_box->hasFocus()
|| ( chat_msg.mSourceType == CHAT_SOURCE_AGENT
&& gSavedSettings.getBOOL("UseChatBubbles") )
|| mChannel.isDead()
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index ea123d3f15..ab2f275711 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -156,57 +156,71 @@ void on_new_message(const LLSD& msg)
// execution of the action
+ LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
+
+ //session floater not focused (visible or not)
+ bool sessionFloaterNotFocused = session_floater && !session_floater->hasFocus();
+
+ //conversation floater not focused (visible or not)
+ bool conversationFloaterNotFocused = im_box && !im_box->hasFocus();
+
if ("toast" == action)
{
// Skip toasting if we have open window of IM with this session id
- LLFloaterIMSession* open_im_floater = LLFloaterIMSession::findInstance(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())
+ session_floater
+ && session_floater->isInVisibleChain()
+ && session_floater->hasFocus()
+ && !session_floater->isMinimized()
+ && !(session_floater->getHost()
+ && session_floater->getHost()->isMinimized())
)
{
return;
}
// Skip toasting for system messages and for nearby chat
- if (participant_id.isNull() || session_id.isNull())
+ if (participant_id.isNull())
{
return;
}
- //Show toast
- LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
+ //User is not focused on conversation containing the message
+ if(sessionFloaterNotFocused)
+ {
+ im_box->flashConversationItemWidget(session_id, true);
+
+ //The conversation floater isn't focused/open
+ if(conversationFloaterNotFocused)
+ {
+ gToolBarView->flashCommand(LLCommandId("chat"), true);
+
+ //Show IM toasts (upper right toasts)
+ 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)
+ //User is not focused on conversation containing the message
+ if(sessionFloaterNotFocused && conversationFloaterNotFocused)
+ {
+ gToolBarView->flashCommand(LLCommandId("chat"), true);
+ }
+ //conversation floater is open but a different conversation is focused
+ else if(sessionFloaterNotFocused)
{
- im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item
+ im_box->flashConversationItemWidget(session_id, true);
}
- gToolBarView->flashCommand(LLCommandId("chat"), true); // flashing of the FUI button "Chat"
}
else if("openconversations" == action)
{
- LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
-
- //Don't flash and show conversation floater when conversation already active (has focus)
- if(session_floater
- && (!session_floater->isInVisibleChain()) //conversation floater not displayed
- ||
- (session_floater->isInVisibleChain() && session_floater->hasFocus() == false)) //conversation floater is displayed but doesn't have focus
-
+ //User is not focused on conversation containing the message
+ if(sessionFloaterNotFocused)
{
//Flash line item
- if (im_box)
- {
- im_box->flashConversationItemWidget(session_id, true); // flashing of the conversation's item
- }
+ im_box->flashConversationItemWidget(session_id, true);
//Surface conversations floater
LLFloaterReg::showInstance("im_container");