summaryrefslogtreecommitdiff
path: root/indra/newview/llnotificationtiphandler.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-04-26 14:39:52 -0700
committerRichard Linden <none@none>2012-04-26 14:39:52 -0700
commita0bb55adc6ff26595f20bed12cb6f1565011e246 (patch)
treecbd25e29777ad9921b2fee2bd0b4d349caa4da61 /indra/newview/llnotificationtiphandler.cpp
parentd6569db3520f7e0ce2d93febb6f4e26b48c08a3d (diff)
parentdb316f830df45e1b0229ebcbdb5feedc5eb23913 (diff)
merge with viewer-release
Diffstat (limited to 'indra/newview/llnotificationtiphandler.cpp')
-rw-r--r--indra/newview/llnotificationtiphandler.cpp36
1 files changed, 10 insertions, 26 deletions
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index e397cfa046..f07109335d 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -41,15 +41,14 @@
using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
-LLTipHandler::LLTipHandler(e_notification_type type, const LLSD& id)
+LLTipHandler::LLTipHandler()
+: LLSysHandler("NotificationTips", "notifytip")
{
- mType = type;
-
// Getting a Channel for our notifications
LLScreenChannel* channel = LLChannelManager::getInstance()->createNotificationChannel();
if(channel)
{
- channel->setOnRejectToastCallback(boost::bind(&LLTipHandler::onRejectToast, this, _1));
+ channel->addOnRejectToastCallback(boost::bind(&LLTipHandler::onRejectToast, this, _1));
mChannel = channel->getHandle();
}
}
@@ -68,28 +67,21 @@ void LLTipHandler::initChannel()
}
//--------------------------------------------------------------------------
-bool LLTipHandler::processNotification(const LLSD& notify)
+bool LLTipHandler::processNotification(const LLNotificationPtr& notification)
{
if(mChannel.isDead())
{
return false;
}
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- if(!notification)
- return false;
-
// arrange a channel on a screen
if(!mChannel.get()->getVisible())
{
initChannel();
}
- if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
- {
// archive message in nearby chat
- if (LLHandlerUtil::canLogToNearbyChat(notification))
+ if (notification->canLogToChat())
{
LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
@@ -109,19 +101,18 @@ bool LLTipHandler::processNotification(const LLSD& notify)
session_name = name;
}
LLUUID from_id = notification->getPayload()["from_id"];
- if (LLHandlerUtil::canLogToIM(notification))
+ if (notification->canLogToIM())
{
LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name,
notification->getMessage(), from_id, from_id);
}
- if (LLHandlerUtil::canSpawnIMSession(notification))
+ if (notification->canLogToIM() && notification->hasFormElements())
{
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))
+ if (notification->canLogToIM() && LLHandlerUtil::isIMFloaterOpened(notification))
{
return false;
}
@@ -144,25 +135,18 @@ bool LLTipHandler::processNotification(const LLSD& notify)
}
else if (notify["sigtype"].asString() == "delete")
{
- mChannel.get()->killToastByNotificationID(notification->getID());
+ mChannel->killToastByNotificationID(notification->getID());
}
return false;
}
//--------------------------------------------------------------------------
-void LLTipHandler::onDeleteToast(LLToast* toast)
-{
-}
-
-//--------------------------------------------------------------------------
void LLTipHandler::onRejectToast(const LLUUID& id)
{
LLNotificationPtr notification = LLNotifications::instance().find(id);
- if (notification
- && LLNotificationManager::getInstance()->getHandlerForNotification(
- notification->getType()) == this)
+ if (notification && mItems.find(notification) != mItems.end())
{
LLNotifications::instance().cancel(notification);
}