diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llnotificationhandler.h | 1 | ||||
-rwxr-xr-x | indra/newview/llnotificationscripthandler.cpp | 60 |
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); } } |