diff options
-rwxr-xr-x | indra/newview/llfloaterpreference.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llimview.cpp | 59 |
2 files changed, 43 insertions, 27 deletions
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 9c836489f3..4c74d3a8ef 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1626,12 +1626,11 @@ void LLFloaterPreference::selectChatPanel() S32 LLFloaterPreference::getHighestNotificationIndex() //change this name { - static const S32 comboBoxNamesLength = 5; - static std::string comboBoxNames[comboBoxNamesLength] = {"NearbyChatOptions", - "FriendIMOptions", - "NonFriendIMOptions", - "ConferenceIMOptions", - "GroupChatOptions"}; + static const S32 comboBoxNamesLength = 4; + static std::string comboBoxNames[comboBoxNamesLength] = {"FriendIMOptions", + "NonFriendIMOptions", + "ConferenceIMOptions", + "GroupChatOptions"}; S32 selectedIndex; S32 priorityindex = 3; LLComboBox * comboBox; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index e513d2e6d1..b29c1484cc 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -134,36 +134,32 @@ void process_dnd_im(const LLSD& notification) void useMostItrusiveIMNotification() { LLFloaterPreference * instance = LLFloaterReg::getTypedInstance<LLFloaterPreference>("preferences"); - if (instance) - { - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container"); + LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container"); - //conv. floater is closed - bool conversation_floater_is_closed = - !( im_box - && im_box->isInVisibleChain() - && !im_box->isMinimized()); + //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(); + //conversation floater not focused (visible or not) + bool conversation_floater_not_focused = + conversation_floater_is_closed || !im_box->hasFocus(); + //Only notify user of stored DND IM messages when conversation floater isn't focused + if (instance && conversation_floater_not_focused) + { switch(instance->getHighestNotificationIndex()) { - //Highest priority to lowest (cases correspond to options in drop down box inside Preferences->Chat) - //open conversation floater case 0: - LLFloaterReg::showInstance("im_container"); + LLFloaterReg::showInstance("im_container"); break; //pop up message case 1: //flash toolbar button case 2: - if(conversation_floater_not_focused) - { - gToolBarView->flashCommand(LLCommandId("chat"), true); - } + gToolBarView->flashCommand(LLCommandId("chat"), true); break; } } @@ -284,13 +280,22 @@ void on_new_message(const LLSD& msg) { if (conversation_floater_not_focused) { - if(session_floater_not_focused) + if(session_floater_not_focused && !gAgent.isDoNotDisturb()) { //User is not focused on conversation containing the message gToolBarView->flashCommand(LLCommandId("chat"), true); } im_box->flashConversationItemWidget(session_id, true); + + //If a DND message, 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()) + { + LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); + } } } @@ -302,8 +307,20 @@ void on_new_message(const LLSD& msg) //Flash line item im_box->flashConversationItemWidget(session_id, true); - //Surface conversations floater - LLFloaterReg::showInstance("im_container"); + if(!gAgent.isDoNotDisturb()) + { + //Surface conversations floater + LLFloaterReg::showInstance("im_container"); + } + + //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()) + { + LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); + } } } } |