From 3ab788b14f9cdc3f33a06491d65abc985c045fa4 Mon Sep 17 00:00:00 2001 From: Andrew Dyukov Date: Wed, 10 Mar 2010 19:50:24 +0200 Subject: Implemented normal sub-task EXT-5909(Accepted/declined inventory offer shouldn't spawn chiclet). - Removed check for INVENTORY_DECLINED from LLHandlerUtil::canSpawnIMSession(). - Added new method LLHandlerUtil::canSpawnToast() and check with it to LLTipHandler::processNotification() to supress toasts when respective IM window is open. --HG-- branch : product-engine --- indra/newview/llnotificationhandler.h | 7 +++++++ indra/newview/llnotificationhandlerutil.cpp | 10 +++++++++- indra/newview/llnotificationtiphandler.cpp | 6 ++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 1f5cff2505..62daf5f105 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -297,6 +297,13 @@ public: */ static bool canSpawnSessionAndLogToIM(const LLNotificationPtr& notification); + /** + * Checks if passed notification can create toast. + * + * It returns false only for inventory accepted/declined notifications if respective IM window is open (EXT-5909) + */ + static bool canSpawnToast(const LLNotificationPtr& notification); + /** * Determines whether IM floater is opened. */ diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index 554b67c47d..680309167e 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -165,7 +165,6 @@ bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification) { return OFFER_FRIENDSHIP == notification->getName() || USER_GIVE_ITEM == notification->getName() - || INVENTORY_DECLINED == notification->getName() || TELEPORT_OFFERED == notification->getName(); } @@ -183,6 +182,15 @@ bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notificat return canLogToIM(notification) && canSpawnIMSession(notification); } +// static +bool LLHandlerUtil::canSpawnToast(const LLNotificationPtr& notification) +{ + bool cannot_spawn = isIMFloaterOpened(notification) && (INVENTORY_DECLINED == notification->getName() + || INVENTORY_ACCEPTED == notification->getName()); + + return !cannot_spawn; +} + // static bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification) { diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index 4e2c5085ed..1f1afe293a 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -150,6 +150,12 @@ bool LLTipHandler::processNotification(const LLSD& notify) LLHandlerUtil::spawnIMSession(name, from_id); } + // don't spawn toast for inventory accepted/declined offers if respective IM window is open (EXT-5909) + if (!LLHandlerUtil::canSpawnToast(notification)) + { + return true; + } + LLToastPanel* notify_box = NULL; if("FriendOffline" == notification->getName() || "FriendOnline" == notification->getName()) { -- cgit v1.2.3