summaryrefslogtreecommitdiff
path: root/indra/newview/llnotificationhandlerutil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnotificationhandlerutil.cpp')
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp63
1 files changed, 50 insertions, 13 deletions
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index d3ad61128d..6aafa04a17 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -128,7 +128,8 @@ const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"),
FRIEND_ONLINE("FriendOnline"), FRIEND_OFFLINE("FriendOffline"),
SERVER_OBJECT_MESSAGE("ServerObjectMessage"),
TELEPORT_OFFERED("TeleportOffered"),
- TELEPORT_OFFER_SENT("TeleportOfferSent");
+ TELEPORT_OFFER_SENT("TeleportOfferSent"),
+ IM_SYSTEM_MESSAGE_TIP("IMSystemMessageTip");
// static
@@ -147,7 +148,8 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
|| INVENTORY_DECLINED == notification->getName()
|| USER_GIVE_ITEM == notification->getName()
|| TELEPORT_OFFERED == notification->getName()
- || TELEPORT_OFFER_SENT == notification->getName();
+ || TELEPORT_OFFER_SENT == notification->getName()
+ || IM_SYSTEM_MESSAGE_TIP == notification->getName();
}
// static
@@ -157,7 +159,8 @@ bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification)
&& FRIEND_ONLINE != notification->getName()
&& FRIEND_OFFLINE != notification->getName()
&& INVENTORY_ACCEPTED != notification->getName()
- && INVENTORY_DECLINED != notification->getName();
+ && INVENTORY_DECLINED != notification->getName()
+ && IM_SYSTEM_MESSAGE_TIP != notification->getName();
}
// static
@@ -193,10 +196,36 @@ bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notificat
// static
bool LLHandlerUtil::canSpawnToast(const LLNotificationPtr& notification)
{
- bool cannot_spawn = isIMFloaterOpened(notification) && (INVENTORY_DECLINED == notification->getName()
- || INVENTORY_ACCEPTED == notification->getName());
-
- return !cannot_spawn;
+ if(INVENTORY_DECLINED == notification->getName()
+ || INVENTORY_ACCEPTED == notification->getName())
+ {
+ // return false for inventory accepted/declined notifications if respective IM window is open (EXT-5909)
+ return ! isIMFloaterOpened(notification);
+ }
+
+ if(FRIENDSHIP_ACCEPTED == notification->getName())
+ {
+ // don't show FRIENDSHIP_ACCEPTED if IM window is opened and focused - EXT-6441
+ return ! isIMFloaterFocused(notification);
+ }
+
+ if(OFFER_FRIENDSHIP == notification->getName()
+ || USER_GIVE_ITEM == notification->getName()
+ || TELEPORT_OFFERED == notification->getName())
+ {
+ // When ANY offer arrives, show toast, unless IM window is already open - EXT-5904
+ return ! isIMFloaterOpened(notification);
+ }
+
+ return true;
+}
+
+// static
+LLIMFloater* LLHandlerUtil::findIMFloater(const LLNotificationPtr& notification)
+{
+ LLUUID from_id = notification->getPayload()["from_id"];
+ LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
+ return LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", session_id);
}
// static
@@ -204,12 +233,7 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification)
{
bool res = false;
- LLUUID from_id = notification->getPayload()["from_id"];
- LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL,
- from_id);
-
- LLIMFloater* im_floater = LLFloaterReg::findTypedInstance<LLIMFloater>(
- "impanel", session_id);
+ LLIMFloater* im_floater = findIMFloater(notification);
if (im_floater != NULL)
{
res = im_floater->getVisible() == TRUE;
@@ -218,6 +242,19 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification)
return res;
}
+bool LLHandlerUtil::isIMFloaterFocused(const LLNotificationPtr& notification)
+{
+ bool res = false;
+
+ LLIMFloater* im_floater = findIMFloater(notification);
+ if (im_floater != NULL)
+ {
+ res = im_floater->hasFocus() == TRUE;
+ }
+
+ return res;
+}
+
// static
void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
const std::string& session_name, const std::string& from_name,