summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
authorsimon <none@none>2013-04-11 16:23:36 -0700
committersimon <none@none>2013-04-11 16:23:36 -0700
commit066f2acadf6f1624fcdfc22263a890c370473887 (patch)
treea4e52b29d8074cdc8782ff28b9b0500b32dada50 /indra/newview/llimview.cpp
parent98a82c50d539451e1931826ca75fbc01d611806d (diff)
parent460c81070e5fa1c51ce7e186a9ecb8c5f1c995e1 (diff)
Forgot to commit @#! merge
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp249
1 files changed, 124 insertions, 125 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 8c862548bb..2c20409381 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -160,163 +160,157 @@ static void on_avatar_name_cache_toast(const LLUUID& agent_id,
void on_new_message(const LLSD& msg)
{
- std::string action;
+ std::string user_preferences;
LLUUID participant_id = msg["from_id"].asUUID();
LLUUID session_id = msg["session_id"].asUUID();
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
- // determine action for this session
+ // do not show notification which goes from agent
+ if (gAgent.getID() == participant_id)
+ {
+ return;
+ }
+
+ // determine state of conversations floater
+ enum {CLOSED, NOT_ON_TOP, ON_TOP, ON_TOP_AND_ITEM_IS_SELECTED} conversations_floater_status;
+
+
+
+ LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
+ LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
+
+ if (!LLFloater::isVisible(im_box) || im_box->isMinimized())
+ {
+ conversations_floater_status = CLOSED;
+ }
+ else if (!im_box->hasFocus() &&
+ !(session_floater && LLFloater::isVisible(session_floater)
+ && !session_floater->isMinimized() && session_floater->hasFocus()))
+ {
+ conversations_floater_status = NOT_ON_TOP;
+ }
+ else if (im_box->getSelectedSession() != session_id)
+ {
+ conversations_floater_status = ON_TOP;
+ }
+ else
+ {
+ conversations_floater_status = ON_TOP_AND_ITEM_IS_SELECTED;
+ }
+ // determine user prefs for this session
if (session_id.isNull())
{
- action = gSavedSettings.getString("NotificationNearbyChatOptions");
+ user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions");
}
else if(session->isP2PSessionType())
{
if (LLAvatarTracker::instance().isBuddy(participant_id))
{
- action = gSavedSettings.getString("NotificationFriendIMOptions");
+ user_preferences = gSavedSettings.getString("NotificationFriendIMOptions");
}
else
{
- action = gSavedSettings.getString("NotificationNonFriendIMOptions");
+ user_preferences = gSavedSettings.getString("NotificationNonFriendIMOptions");
}
}
else if(session->isAdHocSessionType())
{
- action = gSavedSettings.getString("NotificationConferenceIMOptions");
+ user_preferences = gSavedSettings.getString("NotificationConferenceIMOptions");
}
else if(session->isGroupSessionType())
{
- action = gSavedSettings.getString("NotificationGroupChatOptions");
+ user_preferences = gSavedSettings.getString("NotificationGroupChatOptions");
}
- // do not show notification which goes from agent
- if (gAgent.getID() == participant_id)
- {
- return;
- }
-
- // execution of the action
-
- LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container");
- LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
-
- if (im_box->isFrontmost() && im_box->getSelectedSession() == session_id
- && !(session_floater->getHost() ? im_box->isMinimized() : session_floater->isMinimized()))
- {
- return;
- }
-
- //session floater not focused (visible or not)
- bool session_floater_not_focused = session_floater && !session_floater->hasFocus();
-
- //conv. floater is closed
- bool conversation_floater_is_closed =
- !( im_box
- && im_box->isInVisibleChain()
- && !im_box->isMinimized());
-
- //conversation floater not focused (visible or not)
- bool conversation_floater_not_focused =
- conversation_floater_is_closed || !im_box->hasFocus();
- // sess. floater is open
- bool session_floater_is_open =
- session_floater
- && session_floater->isInVisibleChain()
- && !session_floater->isMinimized()
- && !(session_floater->getHost() && session_floater->getHost()->isMinimized());
-
- bool conversation_floater_collapsed = !session_floater->isMessagePaneExpanded();
- if (("toast" == action && !session_floater_is_open) || conversation_floater_collapsed)
- {
- //User is not focused on conversation containing the message
- if(session_floater_not_focused || conversation_floater_collapsed)
- {
- if(!LLMuteList::getInstance()->isMuted(participant_id))
- {
- im_box->flashConversationItemWidget(session_id, true);
- }
- //The conversation floater isn't focused/open
- if(conversation_floater_not_focused || conversation_floater_collapsed)
- {
- if(!LLMuteList::getInstance()->isMuted(participant_id)
- && !gAgent.isDoNotDisturb())
- {
- gToolBarView->flashCommand(LLCommandId("chat"), true);
- }
-
- //Show IM toasts (upper right toasts)
- // Skip toasting for system messages and for nearby chat
- if(session_id.notNull() && participant_id.notNull())
- {
- LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
- }
- }
- }
- }
+ // actions:
- else if ("flash" == action)
+ // 0. nothing - exit
+ if (("none" == user_preferences ||
+ ON_TOP_AND_ITEM_IS_SELECTED == conversations_floater_status)
+ && session_floater->isMessagePaneExpanded())
{
- if (!gAgent.isDoNotDisturb())
- {
- im_box->flashConversationItemWidget(session_id, true);
- if(conversation_floater_not_focused)
- {
- //User is not focused on conversation containing the message
- gToolBarView->flashCommand(LLCommandId("chat"), true);
- }
- }
- else if(session_id.notNull() && participant_id.notNull())
- {
- //If a DND message, allow notification to be stored so upon DND exit
- //useMostItrusiveIMNotification will be called to notify user a message exists
- LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
- }
+ return;
}
- else if("openconversations" == action)
+ // 1. open floater and [optional] surface it
+ if ("openconversations" == user_preferences &&
+ (CLOSED == conversations_floater_status
+ || NOT_ON_TOP == conversations_floater_status))
{
- //User is not focused on conversation containing the message
- if(session_floater_not_focused)
+ if(!gAgent.isDoNotDisturb())
{
- //Flash line item
- im_box->flashConversationItemWidget(session_id, true);
-
- if(!gAgent.isDoNotDisturb())
- {
- //Surface conversations floater
- LLFloaterReg::showInstance("im_container");
- im_box->collapseMessagesPane(false);
- if (session_floater)
+ // Open conversations floater
+ LLFloaterReg::showInstance("im_container");
+ im_box->collapseMessagesPane(false);
+ if (session_floater)
+ {
+ if (session_floater->getHost())
{
- if (session_floater->getHost())
+ if (NULL != im_box && im_box->isMinimized())
{
- if (NULL != im_box && im_box->isMinimized())
- {
- LLFloater::onClickMinimize(im_box);
- }
+ LLFloater::onClickMinimize(im_box);
}
- else
+ }
+ else
+ {
+ if (session_floater->isMinimized())
{
- if (session_floater->isMinimized())
- {
- LLFloater::onClickMinimize(session_floater);
- }
+ LLFloater::onClickMinimize(session_floater);
}
}
}
-
- //If in DND mode, allow notification to be stored so upon DND exit
+ }
+ else
+ {
+ //If in DND mode, allow notification to be stored so upon DND exit
//useMostItrusiveIMNotification will be called to notify user a message exists
- if(session_id.notNull()
- && participant_id.notNull()
- && gAgent.isDoNotDisturb()
- && !session_floater_is_open)
+ if(session_id.notNull()
+ && participant_id.notNull()
+ && !session_floater->isShown())
{
LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
- }
- }
+ }
+ }
+ }
+
+ // 2. Flash line item
+ if ("openconversations" == user_preferences
+ || ON_TOP == conversations_floater_status
+ || ("toast" == user_preferences && ON_TOP != conversations_floater_status)
+ || ("flash" == user_preferences && CLOSED == conversations_floater_status))
+ {
+ if(!LLMuteList::getInstance()->isMuted(participant_id))
+ {
+ im_box->flashConversationItemWidget(session_id, true);
+ }
+ }
+
+ // 3. Flash FUI button
+ if (("toast" == user_preferences || "flash" == user_preferences) &&
+ (CLOSED == conversations_floater_status
+ || NOT_ON_TOP == conversations_floater_status))
+ {
+ if(!LLMuteList::getInstance()->isMuted(participant_id)
+ && !gAgent.isDoNotDisturb())
+ {
+ gToolBarView->flashCommand(LLCommandId("chat"), true);
+ }
+ }
+
+ // 4. Toast
+ if ((("toast" == user_preferences) &&
+ (CLOSED == conversations_floater_status
+ || NOT_ON_TOP == conversations_floater_status))
+ || !session_floater->isMessagePaneExpanded())
+
+ {
+ //Show IM toasts (upper right toasts)
+ // Skip toasting for system messages and for nearby chat
+ if(session_id.notNull() && participant_id.notNull())
+ {
+ LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg));
+ }
}
}
@@ -1406,7 +1400,7 @@ public:
mAgents = agents_to_invite;
}
- virtual void error(U32 statusNum, const std::string& reason)
+ virtual void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content)
{
//try an "old school" way.
if ( statusNum == 400 )
@@ -1418,6 +1412,9 @@ public:
mAgents);
}
+ llwarns << "LLStartConferenceChatResponder error [status:"
+ << statusNum << "]: " << content << llendl;
+
//else throw an error back to the client?
//in theory we should have just have these error strings
//etc. set up in this file as opposed to the IMMgr,
@@ -1563,8 +1560,10 @@ public:
}
}
- void error(U32 statusNum, const std::string& reason)
- {
+ void errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content)
+ {
+ llwarns << "LLViewerChatterBoxInvitationAcceptResponder error [status:"
+ << statusNum << "]: " << content << llendl;
//throw something back to the viewer here?
if ( gIMMgr )
{
@@ -2852,6 +2851,8 @@ LLUUID LLIMMgr::addSession(
//we don't need to show notes about online/offline, mute/unmute users' statuses for existing sessions
if (!new_session) return session_id;
+ llinfos << "LLIMMgr::addSession, new session added, name = " << name << ", session id = " << session_id << llendl;
+
//Per Plan's suggestion commented "explicit offline status warning" out to make Dessie happier (see EXT-3609)
//*TODO After February 2010 remove this commented out line if no one will be missing that warning
//noteOfflineUsers(session_id, floater, ids);
@@ -2887,6 +2888,8 @@ void LLIMMgr::removeSession(const LLUUID& session_id)
LLIMModel::getInstance()->clearSession(session_id);
+ llinfos << "LLIMMgr::removeSession, session removed, session id = " << session_id << llendl;
+
notifyObserverSessionRemoved(session_id);
}
@@ -2904,7 +2907,6 @@ void LLIMMgr::inviteToSession(
// voice invite question is different from default only for group call (EXT-7118)
std::string question_type = "VoiceInviteQuestionDefault";
- BOOL ad_hoc_invite = FALSE;
BOOL voice_invite = FALSE;
bool is_linden = LLMuteList::getInstance()->isLinden(caller_name);
@@ -2927,13 +2929,11 @@ void LLIMMgr::inviteToSession(
//else it's an ad-hoc
//and a voice ad-hoc
notify_box_type = "VoiceInviteAdHoc";
- ad_hoc_invite = TRUE;
voice_invite = TRUE;
}
else if ( inv_type == INVITATION_TYPE_IMMEDIATE )
{
notify_box_type = "InviteAdHoc";
- ad_hoc_invite = TRUE;
}
LLSD payload;
@@ -3518,10 +3518,9 @@ public:
}
std::string buffer = saved + message;
- BOOL is_this_agent = FALSE;
if(from_id == gAgentID)
{
- is_this_agent = TRUE;
+ return;
}
gIMMgr->addMessage(
session_id,