From 69497e645bbefe85d83e85bb353e5fb719263877 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 11 Jan 2013 18:20:29 -0800 Subject: CHUI-668: Not fully complete but as of this commit, have functionality to use the user's most intrusive chat notification upon exiting from DND mode with IM's. Also if in DND mode, clicking on a conversation line item or floater, will flush the DND notifications system of storing that conversation. This way upon existing DND mode already responded conversations won't be notified to the user. --- indra/newview/llimview.cpp | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'indra/newview/llimview.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 067f0d1993..e513d2e6d1 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -52,6 +52,7 @@ #include "llchat.h" #include "llfloaterimsession.h" #include "llfloaterimcontainer.h" +#include "llfloaterpreference.h" #include "llgroupiconctrl.h" #include "llmd5.h" #include "llmutelist.h" @@ -128,11 +129,46 @@ void process_dnd_im(const LLSD& notification) false, false); //will need slight refactor to retrieve whether offline message or not (assume online for now) } - - //Flash toolbar button for now, eventually the user's preference will be taken into account - gToolBarView->flashCommand(LLCommandId("chat"), true); } +void useMostItrusiveIMNotification() +{ + LLFloaterPreference * instance = LLFloaterReg::getTypedInstance("preferences"); + if (instance) + { + LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); + + //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(); + + 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"); + break; + //pop up message + case 1: + //flash toolbar button + case 2: + if(conversation_floater_not_focused) + { + gToolBarView->flashCommand(LLCommandId("chat"), true); + } + break; + } + } + +} static void on_avatar_name_cache_toast(const LLUUID& agent_id, const LLAvatarName& av_name, -- cgit v1.2.3 From e42755dd16195244a6743fc3970f24fec08f03b9 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 11 Jan 2013 19:43:12 -0800 Subject: CHUI-668: Now when exiting DND mode, the user's most intrusive notification will be used to notify that user (if received IM's during DND mode). Nearby chat messages/settings are ignored. --- indra/newview/llimview.cpp | 59 +++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 21 deletions(-) (limited to 'indra/newview/llimview.cpp') 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("preferences"); - if (instance) - { - LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("im_container"); + LLFloaterIMContainer* im_box = LLFloaterReg::getTypedInstance("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)); + } } } } -- cgit v1.2.3 From 0e90e94a4d5cbac2d186f0056821a51078e8d1bd Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales 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/llimview.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'indra/newview/llimview.cpp') 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("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("im_container"); - if (container_floater && !(container_floater->isFrontmost())) - { - container_floater->openFloater(); - container_floater->setFrontmost(TRUE); - } + LLFloaterReg::showInstance("im_container"); } } -- cgit v1.2.3