summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2012-10-22 17:31:51 -0700
committerGilbert Gonzales <gilbert@lindenlab.com>2012-10-22 17:31:51 -0700
commit23d58c0c0906bd5434611cc73da9437ec7a5b830 (patch)
treea41e407606bf9a893f8a670c24a93d8c9f879267 /indra/newview
parent520a29962081cb420341d8c40925569c20cadc2a (diff)
CHUI-433: Implemented an alternate solution to the problem. The original solution was ambiguous and incomplete and also preserved an existing hack. The new solution removes a hack/deprecated code (setActiveSession/getActiveSession functions). Basically, a toast message is not displayed if the user already has the conversation in focus. When the conversation floater loses focus toasts message will be displayed for that conversation.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llimconversation.cpp2
-rw-r--r--indra/newview/llimview.cpp30
-rw-r--r--indra/newview/llimview.h7
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp17
4 files changed, 6 insertions, 50 deletions
diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp
index f4b8d39cd0..74bf8cb6fe 100644
--- a/indra/newview/llimconversation.cpp
+++ b/indra/newview/llimconversation.cpp
@@ -204,7 +204,6 @@ void LLIMConversation::onFocusReceived()
if (mSessionID.notNull() && isInVisibleChain())
{
- LLIMModel::getInstance()->setActiveSessionID(mSessionID);
LLIMModel::instance().sendNoUnreadMessages(mSessionID);
}
@@ -213,7 +212,6 @@ void LLIMConversation::onFocusReceived()
void LLIMConversation::onFocusLost()
{
- LLIMModel::getInstance()->resetActiveSessionID();
setBackgroundOpaque(false);
LLTransientDockableFloater::onFocusLost();
}
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 572f36ff7d..4c5631d5e1 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -118,11 +118,12 @@ void toast_callback(const LLSD& msg){
return;
}
- // check whether incoming IM belongs to an active session or not
- if (LLIMModel::getInstance()->getActiveSessionID() == msg["session_id"])
- {
- return;
- }
+ // Skip toasting if we have open window of IM with this session id
+ LLIMFloater* open_im_floater = LLIMFloater::findInstance(msg["session_id"]);
+ if (open_im_floater && open_im_floater->isInVisibleChain() && open_im_floater->hasFocus())
+ {
+ return;
+ }
// Skip toasting for system messages
if (msg["from_id"].asUUID() == LLUUID::null)
@@ -144,30 +145,11 @@ void toast_callback(const LLSD& msg){
return;
}
- // Skip toasting if we have open window of IM with this session id
- LLIMFloater* open_im_floater = LLIMFloater::findInstance(msg["session_id"]);
- if (open_im_floater && open_im_floater->isInVisibleChain() && open_im_floater->hasFocus())
- {
- return;
- }
-
LLAvatarNameCache::get(msg["from_id"].asUUID(),
boost::bind(&on_avatar_name_cache_toast,
_1, _2, msg));
}
-void LLIMModel::setActiveSessionID(const LLUUID& session_id)
-{
- // check if such an ID really exists
- if (!findIMSession(session_id))
- {
- llwarns << "Trying to set as active a non-existent session!" << llendl;
- return;
- }
-
- mActiveSessionID = session_id;
-}
-
LLIMModel::LLIMModel()
{
addNewMsgCallback(boost::bind(&LLIMFloater::newIMCallback, _1));
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 00b67f520c..054388bc6c 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -147,13 +147,6 @@ public:
LLIMModel();
-
- //we should control the currently active session
- LLUUID mActiveSessionID;
- void setActiveSessionID(const LLUUID& session_id);
- void resetActiveSessionID() { mActiveSessionID.setNull(); }
- LLUUID getActiveSessionID() { return mActiveSessionID; }
-
/** Session id to session object */
std::map<LLUUID, LLIMSession*> mId2SessionMap;
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 9fd73746e8..b4e8927879 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -93,13 +93,6 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
}
else
{
- // store active session id
- const LLUUID & active_session_id =
- LLIMModel::instance().getActiveSessionID();
-
- // set searched session as active to avoid IM toast popup
- LLIMModel::instance().setActiveSessionID(session_id);
-
S32 unread = session->mNumUnread;
S32 participant_unread = session->mParticipantUnreadMessageCount;
LLIMModel::instance().addMessageSilently(session_id, from, from_id,
@@ -110,16 +103,6 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
// update IM floater messages
updateIMFLoaterMesages(session_id);
-
- // restore active session id
- if (active_session_id.isNull())
- {
- LLIMModel::instance().resetActiveSessionID();
- }
- else
- {
- LLIMModel::instance().setActiveSessionID(active_session_id);
- }
}
}