summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorCho <cho@lindenlab.com>2014-05-29 03:53:43 +0100
committerCho <cho@lindenlab.com>2014-05-29 03:53:43 +0100
commit6e74c0de6aed31bc4c27fca1b14e7ab8ef301d34 (patch)
tree697621f8c8da5f443e81c397aa2406c87484ed5f /indra
parente143ceb9db4ed716716580d098791cb18b1d5ac1 (diff)
Streamlined previous fix for ACME-1471
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/llnotificationhandler.h1
-rwxr-xr-xindra/newview/llnotificationscripthandler.cpp60
2 files changed, 27 insertions, 34 deletions
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index e3270547c1..3e7f05b5e1 100755
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -171,6 +171,7 @@ public:
virtual void onDelete(LLNotificationPtr p);
virtual void onChange(LLNotificationPtr p);
virtual bool processNotification(const LLNotificationPtr& p);
+ virtual void addToastWithNotification(const LLNotificationPtr& p);
protected:
virtual void onDeleteToast(LLToast* toast);
diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp
index 267d3ac092..7acb2f9e90 100755
--- a/indra/newview/llnotificationscripthandler.cpp
+++ b/indra/newview/llnotificationscripthandler.cpp
@@ -68,6 +68,30 @@ void LLScriptHandler::initChannel()
}
//--------------------------------------------------------------------------
+void LLScriptHandler::addToastWithNotification(const LLNotificationPtr& notification)
+{
+ LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
+
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.panel = notify_box;
+ p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1);
+ if(gAgent.isDoNotDisturb())
+ {
+ p.force_show = notification->getName() == "SystemMessage"
+ || notification->getName() == "GodMessage"
+ || notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH;
+ }
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
+ if(channel)
+ {
+ channel->addToast(p);
+ }
+}
+
+//--------------------------------------------------------------------------
bool LLScriptHandler::processNotification(const LLNotificationPtr& notification)
{
if(mChannel.isDead())
@@ -92,25 +116,7 @@ bool LLScriptHandler::processNotification(const LLNotificationPtr& notification)
}
else if (notification->canShowToast())
{
- LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
-
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = notify_box;
- p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1);
- if(gAgent.isDoNotDisturb())
- {
- p.force_show = notification->getName() == "SystemMessage"
- || notification->getName() == "GodMessage"
- || notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH;
- }
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
- if(channel)
- {
- channel->addToast(p);
- }
+ addToastWithNotification(notification);
}
return false;
@@ -121,22 +127,8 @@ void LLScriptHandler::onChange( LLNotificationPtr notification )
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel.get());
if (channel)
{
- LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
-
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = notify_box;
- p.on_delete_toast = boost::bind(&LLScriptHandler::onDeleteToast, this, _1);
- if(gAgent.isDoNotDisturb())
- {
- p.force_show = notification->getName() == "SystemMessage"
- || notification->getName() == "GodMessage"
- || notification->getPriority() >= NOTIFICATION_PRIORITY_HIGH;
- }
-
channel->removeToastByNotificationID(notification->getID());
- channel->addToast(p);
+ addToastWithNotification(notification);
}
}