summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRichard Linden <none@none>2012-03-27 22:56:02 -0700
committerRichard Linden <none@none>2012-03-27 22:56:02 -0700
commit1ea65f0285d7022ce20ef84d4e35e3c94bcb3fbd (patch)
tree5af1e50737b6a96f7a05ba6b5f5c5ac3c0f551b3 /indra/newview
parentb187aeb8f177bd76e792652e773617beff18b47b (diff)
CHUI-51 WIP notifications routig code cleanup
phase 1, removal of most of llnotificationhandler
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llbrowsernotification.cpp5
-rw-r--r--indra/newview/llchiclet.cpp9
-rw-r--r--indra/newview/llfloaternotificationsconsole.cpp2
-rw-r--r--indra/newview/llfloateroutbox.cpp51
-rw-r--r--indra/newview/llfloateroutbox.h2
-rw-r--r--indra/newview/llimhandler.cpp82
-rw-r--r--indra/newview/llnearbychathandler.cpp8
-rw-r--r--indra/newview/llnearbychathandler.h3
-rw-r--r--indra/newview/llnotificationalerthandler.cpp99
-rw-r--r--indra/newview/llnotificationgrouphandler.cpp50
-rw-r--r--indra/newview/llnotificationhandler.h143
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp126
-rw-r--r--indra/newview/llnotificationhinthandler.cpp26
-rw-r--r--indra/newview/llnotificationmanager.cpp90
-rw-r--r--indra/newview/llnotificationmanager.h11
-rw-r--r--indra/newview/llnotificationofferhandler.cpp172
-rw-r--r--indra/newview/llnotificationscripthandler.cpp89
-rw-r--r--indra/newview/llnotificationtiphandler.cpp117
-rw-r--r--indra/newview/llscreenchannel.h14
-rw-r--r--indra/newview/llsyswellwindow.cpp11
-rw-r--r--indra/newview/lltoastgroupnotifypanel.cpp2
-rw-r--r--indra/newview/lltoastgroupnotifypanel.h2
-rw-r--r--indra/newview/lltoastnotifypanel.cpp4
-rw-r--r--indra/newview/lltoastnotifypanel.h4
-rwxr-xr-xindra/newview/llviewermessage.cpp2
-rw-r--r--indra/newview/llviewerwindow.cpp8
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml22
27 files changed, 393 insertions, 761 deletions
diff --git a/indra/newview/llbrowsernotification.cpp b/indra/newview/llbrowsernotification.cpp
index 6e77d1e336..9e608d2c8b 100644
--- a/indra/newview/llbrowsernotification.cpp
+++ b/indra/newview/llbrowsernotification.cpp
@@ -35,11 +35,8 @@
using namespace LLNotificationsUI;
-bool LLBrowserNotification::processNotification(const LLSD& notify)
+bool LLBrowserNotification::processNotification(const LLNotificationPtr& notification)
{
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
- if (!notification) return false;
-
LLUUID media_id = notification->getPayload()["media_id"].asUUID();
LLMediaCtrl* media_instance = LLMediaCtrl::getInstance(media_id);
if (media_instance)
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index aabab0ccb9..9f19f8dd1c 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -339,9 +339,9 @@ LLNotificationChiclet::LLNotificationChiclet(const Params& p)
, mUreadSystemNotifications(0)
{
// connect counter handlers to the signals
- connectCounterUpdatersToSignal("notify");
- connectCounterUpdatersToSignal("groupnotify");
- connectCounterUpdatersToSignal("offer");
+ connectCounterUpdatersToSignal("Notify");
+ connectCounterUpdatersToSignal("Group Notify");
+ connectCounterUpdatersToSignal("Offer");
// ensure that notification well window exists, to synchronously
// handle toast add/delete events.
@@ -350,8 +350,7 @@ LLNotificationChiclet::LLNotificationChiclet(const Params& p)
void LLNotificationChiclet::connectCounterUpdatersToSignal(const std::string& notification_type)
{
- LLNotificationsUI::LLNotificationManager* manager = LLNotificationsUI::LLNotificationManager::getInstance();
- LLNotificationsUI::LLEventHandler* n_handler = manager->getHandlerForNotification(notification_type);
+ LLNotificationsUI::LLEventHandler* n_handler = dynamic_cast<LLNotificationsUI::LLEventHandler*>(LLNotifications::instance().getChannel(notification_type).get());
if(n_handler)
{
n_handler->setNewNotificationCallback(boost::bind(&LLNotificationChiclet::incUreadSystemNotifications, this));
diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp
index 2681d4b34d..90dbabebfb 100644
--- a/indra/newview/llfloaternotificationsconsole.cpp
+++ b/indra/newview/llfloaternotificationsconsole.cpp
@@ -57,7 +57,7 @@ LLNotificationChannelPanel::LLNotificationChannelPanel(const LLNotificationChann
{
mChannelPtr = LLNotifications::instance().getChannel(p.name);
mChannelRejectsPtr = LLNotificationChannelPtr(
- LLNotificationChannel::buildChannel(p.name() + "rejects", mChannelPtr->getParentChannelName(),
+ new LLNotificationChannel(p.name() + "rejects", mChannelPtr->getParentChannelName(),
!boost::bind(mChannelPtr->getFilter(), _1)));
buildFromFile( "panel_notifications_channel.xml");
}
diff --git a/indra/newview/llfloateroutbox.cpp b/indra/newview/llfloateroutbox.cpp
index 540f977305..2a2b231b53 100644
--- a/indra/newview/llfloateroutbox.cpp
+++ b/indra/newview/llfloateroutbox.cpp
@@ -44,14 +44,12 @@
#include "llviewernetwork.h"
#include "llwindowshade.h"
-#define USE_WINDOWSHADE_DIALOGS 0
-
///----------------------------------------------------------------------------
/// LLOutboxNotification class
///----------------------------------------------------------------------------
-bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLSD& notify)
+bool LLNotificationsUI::LLOutboxNotification::processNotification(const LLNotificationPtr& notify)
{
LLFloaterOutbox* outbox_floater = LLFloaterReg::getTypedInstance<LLFloaterOutbox>("outbox");
@@ -516,52 +514,11 @@ void LLFloaterOutbox::initializationReportError(U32 status, const LLSD& content)
updateView();
}
-void LLFloaterOutbox::showNotification(const LLSD& notify)
+void LLFloaterOutbox::showNotification(const LLNotificationPtr& notification)
{
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- if (!notification)
- {
- llerrs << "Unable to find outbox notification!" << notify.asString() << llendl;
-
- return;
- }
-
-#if USE_WINDOWSHADE_DIALOGS
-
- if (mWindowShade)
- {
- delete mWindowShade;
- }
-
- LLRect floater_rect = getLocalRect();
- floater_rect.mTop -= getHeaderHeight();
- floater_rect.stretch(-5, 0);
-
- LLWindowShade::Params params;
- params.name = "notification_shade";
- params.rect = floater_rect;
- params.follows.flags = FOLLOWS_ALL;
- params.modal = true;
- params.can_close = false;
- params.shade_color = LLColor4::white % 0.25f;
- params.text_color = LLColor4::white;
-
- mWindowShade = LLUICtrlFactory::create<LLWindowShade>(params);
-
- addChild(mWindowShade);
- mWindowShade->show(notification);
-
-#else
-
- LLNotificationsUI::LLEventHandler * handler =
- LLNotificationsUI::LLNotificationManager::instance().getHandlerForNotification("alertmodal");
-
- LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast<LLNotificationsUI::LLSysHandler *>(handler);
+ LLNotificationsUI::LLSysHandler * sys_handler = dynamic_cast<LLNotificationsUI::LLSysHandler*>(LLNotifications::instance().getChannel("AlertModal").get());
llassert(sys_handler);
- sys_handler->processNotification(notify);
-
-#endif
+ sys_handler->processNotification(notification);
}
diff --git a/indra/newview/llfloateroutbox.h b/indra/newview/llfloateroutbox.h
index 18baccf1c9..a91d8c1139 100644
--- a/indra/newview/llfloateroutbox.h
+++ b/indra/newview/llfloateroutbox.h
@@ -64,7 +64,7 @@ public:
EAcceptance* accept,
std::string& tooltip_msg);
- void showNotification(const LLSD& notify);
+ void showNotification(const LLNotificationPtr& notification);
BOOL handleHover(S32 x, S32 y, MASK mask);
void onMouseLeave(S32 x, S32 y, MASK mask);
diff --git a/indra/newview/llimhandler.cpp b/indra/newview/llimhandler.cpp
index cd71da7393..a92c4fa387 100644
--- a/indra/newview/llimhandler.cpp
+++ b/indra/newview/llimhandler.cpp
@@ -37,10 +37,9 @@
using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
-LLIMHandler::LLIMHandler(e_notification_type type, const LLSD& id)
+LLIMHandler::LLIMHandler()
+: LLSysHandler("IM Notifications", "notifytoast")
{
- mType = type;
-
// Getting a Channel for our notifications
mChannel = LLChannelManager::getInstance()->createNotificationChannel();
}
@@ -59,62 +58,51 @@ void LLIMHandler::initChannel()
}
//--------------------------------------------------------------------------
-bool LLIMHandler::processNotification(const LLSD& notify)
+bool LLIMHandler::processNotification(const LLNotificationPtr& notification)
{
if(!mChannel)
{
return false;
}
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- if(!notification)
- return false;
-
// arrange a channel on a screen
if(!mChannel->getVisible())
{
initChannel();
}
- if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
- {
- LLSD substitutions = notification->getSubstitutions();
-
- // According to comments in LLIMMgr::addMessage(), if we get message
- // from ourselves, the sender id is set to null. This fixes EXT-875.
- LLUUID avatar_id = substitutions["FROM_ID"].asUUID();
- if (avatar_id.isNull())
- avatar_id = gAgentID;
-
- LLToastIMPanel::Params im_p;
- im_p.notification = notification;
- im_p.avatar_id = avatar_id;
- im_p.from = substitutions["FROM"].asString();
- im_p.time = substitutions["TIME"].asString();
- im_p.message = substitutions["MESSAGE"].asString();
- im_p.session_id = substitutions["SESSION_ID"].asUUID();
-
- LLToastIMPanel* im_box = new LLToastIMPanel(im_p);
-
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.session_id = im_p.session_id;
- p.notification = notification;
- p.panel = im_box;
- p.can_be_stored = false;
- p.on_delete_toast = boost::bind(&LLIMHandler::onDeleteToast, this, _1);
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
- channel->addToast(p);
-
- // send a signal to the counter manager;
- mNewNotificationSignal();
- }
- else if (notify["sigtype"].asString() == "delete")
- {
- mChannel->killToastByNotificationID(notification->getID());
- }
+ LLSD substitutions = notification->getSubstitutions();
+
+ // According to comments in LLIMMgr::addMessage(), if we get message
+ // from ourselves, the sender id is set to null. This fixes EXT-875.
+ LLUUID avatar_id = substitutions["FROM_ID"].asUUID();
+ if (avatar_id.isNull())
+ avatar_id = gAgentID;
+
+ LLToastIMPanel::Params im_p;
+ im_p.notification = notification;
+ im_p.avatar_id = avatar_id;
+ im_p.from = substitutions["FROM"].asString();
+ im_p.time = substitutions["TIME"].asString();
+ im_p.message = substitutions["MESSAGE"].asString();
+ im_p.session_id = substitutions["SESSION_ID"].asUUID();
+
+ LLToastIMPanel* im_box = new LLToastIMPanel(im_p);
+
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.session_id = im_p.session_id;
+ p.notification = notification;
+ p.panel = im_box;
+ p.can_be_stored = false;
+ p.on_delete_toast = boost::bind(&LLIMHandler::onDeleteToast, this, _1);
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ if(channel)
+ channel->addToast(p);
+
+ // send a signal to the counter manager;
+ mNewNotificationSignal();
+
return false;
}
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 240a7c7a35..269b42bbe9 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -445,10 +445,8 @@ void LLNearbyChatScreenChannel::arrangeToasts()
//-----------------------------------------------------------------------------------------------
boost::scoped_ptr<LLEventPump> LLNearbyChatHandler::sChatWatcher(new LLEventStream("LLChat"));
-LLNearbyChatHandler::LLNearbyChatHandler(e_notification_type type, const LLSD& id)
+LLNearbyChatHandler::LLNearbyChatHandler()
{
- mType = type;
-
// Getting a Channel for our notifications
LLNearbyChatScreenChannel::Params p;
p.id = LLUUID(gSavedSettings.getString("NearByChatChannelUUID"));
@@ -614,10 +612,6 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg,
}
}
-void LLNearbyChatHandler::onDeleteToast(LLToast* toast)
-{
-}
-
//-----------------------------------------------------------------------------------------------
// LLNearbyChatToast
diff --git a/indra/newview/llnearbychathandler.h b/indra/newview/llnearbychathandler.h
index b0e4f62d51..a5034ac1cb 100644
--- a/indra/newview/llnearbychathandler.h
+++ b/indra/newview/llnearbychathandler.h
@@ -37,14 +37,13 @@ namespace LLNotificationsUI{
class LLNearbyChatHandler : public LLChatHandler
{
public:
- LLNearbyChatHandler(e_notification_type type,const LLSD& id);
+ LLNearbyChatHandler();
virtual ~LLNearbyChatHandler();
virtual void processChat(const LLChat& chat_msg, const LLSD &args);
protected:
- virtual void onDeleteToast(LLToast* toast);
virtual void initChannel();
static boost::scoped_ptr<LLEventPump> sChatWatcher;
diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp
index cae7d02fed..e6239534f7 100644
--- a/indra/newview/llnotificationalerthandler.cpp
+++ b/indra/newview/llnotificationalerthandler.cpp
@@ -40,10 +40,10 @@
using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
-LLAlertHandler::LLAlertHandler(e_notification_type type, const LLSD& id) : mIsModal(false)
+LLAlertHandler::LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal)
+: LLSysHandler(name, notification_type),
+ mIsModal(is_modal)
{
- mType = type;
-
LLScreenChannelBase::Params p;
p.id = LLUUID(gSavedSettings.getString("AlertChannelUUID"));
p.display_toasts_always = true;
@@ -68,79 +68,58 @@ void LLAlertHandler::initChannel()
}
//--------------------------------------------------------------------------
-bool LLAlertHandler::processNotification(const LLSD& notify)
+bool LLAlertHandler::processNotification(const LLNotificationPtr& notification)
{
if(!mChannel)
{
return false;
}
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- if(!notification)
- return false;
-
// arrange a channel on a screen
if(!mChannel->getVisible())
{
initChannel();
}
- if (notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "load")
+ if (notification->canLogToIM() && notification->hasFormElements())
{
- if (LLHandlerUtil::canSpawnSessionAndLogToIM(notification))
- {
- const std::string name = LLHandlerUtil::getSubstitutionName(notification);
-
- LLUUID from_id = notification->getPayload()["from_id"];
-
- // firstly create session...
- LLHandlerUtil::spawnIMSession(name, from_id);
-
- // ...then log message to have IM Well notified about new message
- LLHandlerUtil::logToIMP2P(notification);
- }
-
- LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = dynamic_cast<LLToastPanel*>(alert_dialog);
- p.enable_hide_btn = false;
- p.can_fade = false;
- p.is_modal = mIsModal;
- p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1);
-
- // Show alert in middle of progress view (during teleport) (EXT-1093)
- LLProgressView* progress = gViewerWindow->getProgressView();
- LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled();
- mChannel->updatePositionAndSize(rc);
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
- channel->addToast(p);
- }
- else if (notify["sigtype"].asString() == "change")
- {
- LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
- channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog);
- }
- else
- {
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
- channel->killToastByNotificationID(notification->getID());
+ const std::string name = LLHandlerUtil::getSubstitutionName(notification);
+
+ LLUUID from_id = notification->getPayload()["from_id"];
+
+ // firstly create session...
+ LLHandlerUtil::spawnIMSession(name, from_id);
+
+ // ...then log message to have IM Well notified about new message
+ LLHandlerUtil::logToIMP2P(notification);
}
+
+ LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.panel = dynamic_cast<LLToastPanel*>(alert_dialog);
+ p.enable_hide_btn = false;
+ p.can_fade = false;
+ p.is_modal = mIsModal;
+ p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1);
+
+ // Show alert in middle of progress view (during teleport) (EXT-1093)
+ LLProgressView* progress = gViewerWindow->getProgressView();
+ LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled();
+ mChannel->updatePositionAndSize(rc);
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ if(channel)
+ channel->addToast(p);
+
return false;
}
-//--------------------------------------------------------------------------
-
-void LLAlertHandler::onDeleteToast(LLToast* toast)
+void LLAlertHandler::onChange( LLNotificationPtr notification )
{
+ LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal);
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ if(channel)
+ channel->modifyToastByNotificationID(notification->getID(), (LLToastPanel*)alert_dialog);
}
-
-//--------------------------------------------------------------------------
-
diff --git a/indra/newview/llnotificationgrouphandler.cpp b/indra/newview/llnotificationgrouphandler.cpp
index 9b7fdaef82..2ce51fa094 100644
--- a/indra/newview/llnotificationgrouphandler.cpp
+++ b/indra/newview/llnotificationgrouphandler.cpp
@@ -37,15 +37,14 @@
using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
-LLGroupHandler::LLGroupHandler(e_notification_type type, const LLSD& id)
+LLGroupHandler::LLGroupHandler()
+: LLSysHandler("Group Notifications", "groupnotify")
{
- mType = type;
-
// Getting a Channel for our notifications
mChannel = LLChannelManager::getInstance()->createNotificationChannel();
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
if(channel)
- channel->setOnRejectToastCallback(boost::bind(&LLGroupHandler::onRejectToast, this, _1));
+ channel->addOnRejectToastCallback(boost::bind(&LLGroupHandler::onRejectToast, this, _1));
}
//--------------------------------------------------------------------------
@@ -62,48 +61,37 @@ void LLGroupHandler::initChannel()
}
//--------------------------------------------------------------------------
-bool LLGroupHandler::processNotification(const LLSD& notify)
+bool LLGroupHandler::processNotification(const LLNotificationPtr& notification)
{
if(!mChannel)
{
return false;
}
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- if(!notification)
- return false;
-
// arrange a channel on a screen
if(!mChannel->getVisible())
{
initChannel();
}
- if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
- {
- LLHandlerUtil::logGroupNoticeToIMGroup(notification);
+ LLHandlerUtil::logGroupNoticeToIMGroup(notification);
+
+ LLPanel* notify_box = new LLToastGroupNotifyPanel(notification);
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.panel = notify_box;
+ p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1);
- LLPanel* notify_box = new LLToastGroupNotifyPanel(notification);
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = notify_box;
- p.on_delete_toast = boost::bind(&LLGroupHandler::onDeleteToast, this, _1);
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ if(channel)
+ channel->addToast(p);
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
- channel->addToast(p);
+ // send a signal to the counter manager
+ mNewNotificationSignal();
- // send a signal to the counter manager
- mNewNotificationSignal();
+ LLGroupActions::refresh_notices();
- LLGroupActions::refresh_notices();
- }
- else if (notify["sigtype"].asString() == "delete")
- {
- mChannel->killToastByNotificationID(notification->getID());
- }
return false;
}
@@ -123,7 +111,7 @@ void LLGroupHandler::onRejectToast(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);
}
diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index 23dbb6b047..ff9371f7df 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -30,7 +30,7 @@
#include "llwindow.h"
-//#include "llnotificationsutil.h"
+#include "llnotifications.h"
#include "llchannelmanager.h"
#include "llchat.h"
#include "llinstantmessage.h"
@@ -40,20 +40,6 @@ class LLIMFloater;
namespace LLNotificationsUI
{
-// ENotificationType enumerates all possible types of notifications that could be met
-//
-typedef enum e_notification_type
-{
- NT_NOTIFY,
- NT_NOTIFYTIP,
- NT_GROUPNOTIFY,
- NT_IMCHAT,
- NT_GROUPCHAT,
- NT_NEARBYCHAT,
- NT_ALERT,
- NT_ALERTMODAL,
- NT_OFFER
-} ENotificationType;
/**
* Handler of notification events.
@@ -95,7 +81,7 @@ public:
boost::signals2::connection setNotificationIDCallback(notification_id_callback_t cb) { return mNotificationIDSignal.connect(cb); }
protected:
- virtual void onDeleteToast(LLToast* toast)=0;
+ virtual void onDeleteToast(LLToast* toast) {}
// arrange handler's channel on a screen
// is necessary to unbind a moment of creation of a channel and a moment of positioning of it
@@ -104,8 +90,6 @@ protected:
virtual void initChannel()=0;
LLScreenChannelBase* mChannel;
- e_notification_type mType;
-
};
// LLSysHandler and LLChatHandler are more specific base classes
@@ -115,13 +99,18 @@ protected:
/**
* Handler for system notifications.
*/
-class LLSysHandler : public LLEventHandler
+class LLSysHandler : public LLEventHandler, public LLNotificationChannel
{
public:
- LLSysHandler();
+ LLSysHandler(const std::string& name, const std::string& notification_type);
virtual ~LLSysHandler() {};
- virtual bool processNotification(const LLSD& notify)=0;
+ // base interface functions
+ /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); }
+ /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); }
+ /*virtual*/ void onDelete(LLNotificationPtr p) { if (mChannel) mChannel->killToastByNotificationID(p->getID());}
+
+ virtual bool processNotification(const LLNotificationPtr& notify)=0;
protected :
static void init();
@@ -149,13 +138,11 @@ public:
class LLIMHandler : public LLSysHandler
{
public:
- LLIMHandler(e_notification_type type, const LLSD& id);
+ LLIMHandler();
virtual ~LLIMHandler();
- // base interface functions
- virtual bool processNotification(const LLSD& notify);
-
protected:
+ bool processNotification(const LLNotificationPtr& p);
virtual void onDeleteToast(LLToast* toast);
virtual void initChannel();
};
@@ -167,14 +154,13 @@ protected:
class LLTipHandler : public LLSysHandler
{
public:
- LLTipHandler(e_notification_type type, const LLSD& id);
+ LLTipHandler();
virtual ~LLTipHandler();
// base interface functions
- virtual bool processNotification(const LLSD& notify);
+ virtual bool processNotification(const LLNotificationPtr& p);
protected:
- virtual void onDeleteToast(LLToast* toast);
virtual void onRejectToast(const LLUUID& id);
virtual void initChannel();
};
@@ -186,11 +172,12 @@ protected:
class LLScriptHandler : public LLSysHandler
{
public:
- LLScriptHandler(e_notification_type type, const LLSD& id);
+ LLScriptHandler();
virtual ~LLScriptHandler();
+ virtual void onDelete(LLNotificationPtr p);
// base interface functions
- virtual bool processNotification(const LLSD& notify);
+ virtual bool processNotification(const LLNotificationPtr& p);
protected:
virtual void onDeleteToast(LLToast* toast);
@@ -207,11 +194,11 @@ protected:
class LLGroupHandler : public LLSysHandler
{
public:
- LLGroupHandler(e_notification_type type, const LLSD& id);
+ LLGroupHandler();
virtual ~LLGroupHandler();
// base interface functions
- virtual bool processNotification(const LLSD& notify);
+ virtual bool processNotification(const LLNotificationPtr& p);
protected:
virtual void onDeleteToast(LLToast* toast);
@@ -227,16 +214,16 @@ protected:
class LLAlertHandler : public LLSysHandler
{
public:
- LLAlertHandler(e_notification_type type, const LLSD& id);
+ LLAlertHandler(const std::string& name, const std::string& notification_type, bool is_modal);
virtual ~LLAlertHandler();
- void setAlertMode(bool is_modal) { mIsModal = is_modal; }
+ /*virtual*/ void onChange(LLNotificationPtr p);
+ /*virtual*/ void onLoad(LLNotificationPtr p) { processNotification(p); }
// base interface functions
- virtual bool processNotification(const LLSD& notify);
+ virtual bool processNotification(const LLNotificationPtr& p);
protected:
- virtual void onDeleteToast(LLToast* toast);
virtual void initChannel();
bool mIsModal;
@@ -249,11 +236,12 @@ protected:
class LLOfferHandler : public LLSysHandler
{
public:
- LLOfferHandler(e_notification_type type, const LLSD& id);
+ LLOfferHandler();
virtual ~LLOfferHandler();
// base interface functions
- virtual bool processNotification(const LLSD& notify);
+ /*virtual*/ void onDelete(LLNotificationPtr notification);
+ virtual bool processNotification(const LLNotificationPtr& p);
protected:
virtual void onDeleteToast(LLToast* toast);
@@ -266,85 +254,55 @@ protected:
/**
* Handler for UI hints.
*/
-class LLHintHandler : public LLSingleton<LLHintHandler>
+class LLHintHandler : public LLNotificationChannel
{
public:
- LLHintHandler();
- virtual ~LLHintHandler();
+ LLHintHandler() : LLNotificationChannel("Hints", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "hint"))
+ {}
+ virtual ~LLHintHandler() {}
- // base interface functions
- virtual bool processNotification(const LLSD& notify);
+ /*virtual*/ void onAdd(LLNotificationPtr p);
+ /*virtual*/ void onChange(LLNotificationPtr p);
+ /*virtual*/ void onDelete(LLNotificationPtr p);
};
/**
* Handler for browser notifications
*/
-class LLBrowserNotification : public LLSingleton<LLBrowserNotification>
+class LLBrowserNotification : public LLNotificationChannel
{
public:
- virtual bool processNotification(const LLSD& notify);
+ LLBrowserNotification()
+ : LLNotificationChannel("Browser", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "browser"))
+ {}
+ /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); }
+ /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); }
+ bool processNotification(const LLNotificationPtr& p);
};
/**
* Handler for outbox notifications
*/
-class LLOutboxNotification : public LLSingleton<LLOutboxNotification>
+class LLOutboxNotification : public LLNotificationChannel
{
public:
- virtual bool processNotification(const LLSD& notify);
+ LLOutboxNotification()
+ : LLNotificationChannel("Outbox", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "outbox"))
+ {}
+ /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); }
+ /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); }
+ bool processNotification(const LLNotificationPtr& p);
};
class LLHandlerUtil
{
public:
/**
- * Checks sufficient conditions to log notification message to IM session.
- */
- static bool canLogToIM(const LLNotificationPtr& notification);
-
- /**
- * Checks sufficient conditions to log notification message to nearby chat session.
- */
- static bool canLogToNearbyChat(const LLNotificationPtr& notification);
-
- /**
- * Checks sufficient conditions to spawn IM session.
- */
- static bool canSpawnIMSession(const LLNotificationPtr& notification);
-
- /**
- * Checks sufficient conditions to add notification toast panel IM floater.
- */
- static bool canAddNotifPanelToIM(const LLNotificationPtr& notification);
-
- /**
- * Checks whether notification can be used multiple times or not.
- */
- static bool isNotificationReusable(const LLNotificationPtr& notification);
-
- /**
- * Checks if passed notification can create IM session and be written into it.
- *
- * This method uses canLogToIM() & canSpawnIMSession().
- */
- static bool canSpawnSessionAndLogToIM(const LLNotificationPtr& notification);
-
- /**
- * Checks if passed notification can create toast.
- */
- static bool canSpawnToast(const LLNotificationPtr& notification);
-
- /**
* Determines whether IM floater is opened.
*/
static bool isIMFloaterOpened(const LLNotificationPtr& notification);
/**
- * Determines whether IM floater is focused.
- */
- static bool isIMFloaterFocused(const LLNotificationPtr& notification);
-
- /**
* Writes notification message to IM session.
*/
static void logToIM(const EInstantMessage& session_type,
@@ -406,13 +364,6 @@ public:
*/
static void decIMMesageCounter(const LLNotificationPtr& notification);
-private:
-
- /**
- * Find IM floater based on "from_id"
- */
- static LLIMFloater* findIMFloater(const LLNotificationPtr& notification);
-
};
}
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 1b767e80d4..dca7fda151 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -54,7 +54,8 @@ void LLSysHandler::init()
sExclusiveNotificationGroups.push_back(online_offline_group);
}
-LLSysHandler::LLSysHandler()
+LLSysHandler::LLSysHandler(const std::string& name, const std::string& notification_type)
+: LLNotificationChannel(name, "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, notification_type))
{
if(sExclusiveNotificationGroups.empty())
{
@@ -110,119 +111,9 @@ void LLSysHandler::removeExclusiveNotifications(const LLNotificationPtr& notif)
}
}
-const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"),
- REVOKED_MODIFY_RIGHTS("RevokedModifyRights"),
- OBJECT_GIVE_ITEM("ObjectGiveItem"),
- OBJECT_GIVE_ITEM_UNKNOWN_USER("ObjectGiveItemUnknownUser"),
- PAYMENT_RECEIVED("PaymentReceived"),
- PAYMENT_SENT("PaymentSent"),
- ADD_FRIEND_WITH_MESSAGE("AddFriendWithMessage"),
- USER_GIVE_ITEM("UserGiveItem"),
- INVENTORY_ACCEPTED("InventoryAccepted"),
- INVENTORY_DECLINED("InventoryDeclined"),
- OFFER_FRIENDSHIP("OfferFriendship"),
- FRIENDSHIP_ACCEPTED("FriendshipAccepted"),
- FRIENDSHIP_OFFERED("FriendshipOffered"),
- FRIENDSHIP_ACCEPTED_BYME("FriendshipAcceptedByMe"),
- FRIENDSHIP_DECLINED_BYME("FriendshipDeclinedByMe"),
- FRIEND_ONLINE("FriendOnline"), FRIEND_OFFLINE("FriendOffline"),
- SERVER_OBJECT_MESSAGE("ServerObjectMessage"),
- TELEPORT_OFFERED("TeleportOffered"),
- TELEPORT_OFFER_SENT("TeleportOfferSent"),
- IM_SYSTEM_MESSAGE_TIP("IMSystemMessageTip");
+const static std::string OBJECT_GIVE_ITEM("ObjectGiveItem");
-
-// static
-bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
-{
- return GRANTED_MODIFY_RIGHTS == notification->getName()
- || REVOKED_MODIFY_RIGHTS == notification->getName()
- || PAYMENT_RECEIVED == notification->getName()
- || PAYMENT_SENT == notification->getName()
- || OFFER_FRIENDSHIP == notification->getName()
- || FRIENDSHIP_OFFERED == notification->getName()
- || FRIENDSHIP_ACCEPTED == notification->getName()
- || FRIENDSHIP_ACCEPTED_BYME == notification->getName()
- || FRIENDSHIP_DECLINED_BYME == notification->getName()
- || SERVER_OBJECT_MESSAGE == notification->getName()
- || INVENTORY_ACCEPTED == notification->getName()
- || INVENTORY_DECLINED == notification->getName()
- || USER_GIVE_ITEM == notification->getName()
- || TELEPORT_OFFERED == notification->getName()
- || TELEPORT_OFFER_SENT == notification->getName()
- || IM_SYSTEM_MESSAGE_TIP == notification->getName();
-}
-
-// static
-bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification)
-{
- return notification->getType() == "notifytip"
- && FRIEND_ONLINE != notification->getName()
- && FRIEND_OFFLINE != notification->getName()
- && INVENTORY_ACCEPTED != notification->getName()
- && INVENTORY_DECLINED != notification->getName()
- && IM_SYSTEM_MESSAGE_TIP != notification->getName();
-}
-
-// static
-bool LLHandlerUtil::canSpawnIMSession(const LLNotificationPtr& notification)
-{
- return OFFER_FRIENDSHIP == notification->getName()
- || USER_GIVE_ITEM == notification->getName()
- || TELEPORT_OFFERED == notification->getName();
-}
-
-// static
-bool LLHandlerUtil::canAddNotifPanelToIM(const LLNotificationPtr& notification)
-{
- return OFFER_FRIENDSHIP == notification->getName()
- || USER_GIVE_ITEM == notification->getName()
- || TELEPORT_OFFERED == notification->getName();
-}
-
-// static
-bool LLHandlerUtil::isNotificationReusable(const LLNotificationPtr& notification)
-{
- return OFFER_FRIENDSHIP == notification->getName()
- || USER_GIVE_ITEM == notification->getName()
- || TELEPORT_OFFERED == notification->getName();
-}
-
-// static
-bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notification)
-{
- return canLogToIM(notification) && canSpawnIMSession(notification);
-}
-
-// static
-bool LLHandlerUtil::canSpawnToast(const LLNotificationPtr& notification)
-{
- 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)
+static LLIMFloater* find_im_floater(const LLNotificationPtr& notification)
{
LLUUID from_id = notification->getPayload()["from_id"];
LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
@@ -234,7 +125,7 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification)
{
bool res = false;
- LLIMFloater* im_floater = findIMFloater(notification);
+ LLIMFloater* im_floater = find_im_floater(notification);
if (im_floater != NULL)
{
res = im_floater->getVisible() == TRUE;
@@ -243,11 +134,11 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification)
return res;
}
-bool LLHandlerUtil::isIMFloaterFocused(const LLNotificationPtr& notification)
+static bool is_IM_floater_focused(const LLNotificationPtr& notification)
{
bool res = false;
- LLIMFloater* im_floater = findIMFloater(notification);
+ LLIMFloater* im_floater = find_im_floater(notification);
if (im_floater != NULL)
{
res = im_floater->hasFocus() == TRUE;
@@ -335,7 +226,7 @@ void log_name_callback(const std::string& full_name, const std::string& from_nam
void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only)
{
// don't create IM p2p session with objects, it's necessary condition to log
- if (notification->getName() != OBJECT_GIVE_ITEM)
+ //if (notification->getName() != OBJECT_GIVE_ITEM)
{
LLUUID from_id = notification->getPayload()["from_id"];
@@ -505,3 +396,4 @@ void LLHandlerUtil::decIMMesageCounter(const LLNotificationPtr& notification)
arg["participant_unread"] = session->mParticipantUnreadMessageCount;
LLIMModel::getInstance()->mNewMsgSignal(arg);
}
+
diff --git a/indra/newview/llnotificationhinthandler.cpp b/indra/newview/llnotificationhinthandler.cpp
index f7163cb04f..47156a3915 100644
--- a/indra/newview/llnotificationhinthandler.cpp
+++ b/indra/newview/llnotificationhinthandler.cpp
@@ -33,26 +33,6 @@
using namespace LLNotificationsUI;
-LLHintHandler::LLHintHandler()
-{
-}
-
-LLHintHandler::~LLHintHandler()
-{
-}
-
-bool LLHintHandler::processNotification(const LLSD& notify)
-{
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- std::string sigtype = notify["sigtype"].asString();
- if (sigtype == "add" || sigtype == "load")
- {
- LLHints::show(notification);
- }
- else if (sigtype == "delete")
- {
- LLHints::hide(notification);
- }
- return false;
-}
+void LLHintHandler::onAdd(LLNotificationPtr p) { LLHints::show(p); }
+void LLHintHandler::onChange(LLNotificationPtr p) { LLHints::show(p); }
+void LLHintHandler::onDelete(LLNotificationPtr p) { LLHints::hide(p); }
diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp
index 6105eff8ea..394ae2ac21 100644
--- a/indra/newview/llnotificationmanager.cpp
+++ b/indra/newview/llnotificationmanager.cpp
@@ -41,7 +41,6 @@ using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
LLNotificationManager::LLNotificationManager()
{
- mNotifyHandlers.clear();
init();
}
@@ -53,88 +52,23 @@ LLNotificationManager::~LLNotificationManager()
//--------------------------------------------------------------------------
void LLNotificationManager::init()
{
- LLNotificationChannel::buildChannel("Notifications", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "notify"));
- LLNotificationChannel::buildChannel("NotificationTips", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "notifytip"));
- LLNotificationChannel::buildChannel("Group Notifications", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "groupnotify"));
- LLNotificationChannel::buildChannel("Alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert"));
- LLNotificationChannel::buildChannel("AlertModal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal"));
- LLNotificationChannel::buildChannel("IM Notifications", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "notifytoast"));
- LLNotificationChannel::buildChannel("Offer", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "offer"));
- LLNotificationChannel::buildChannel("Hints", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "hint"));
- LLNotificationChannel::buildChannel("Browser", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "browser"));
- LLNotificationChannel::buildChannel("Outbox", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "outbox"));
-
- LLNotifications::instance().getChannel("Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
- LLNotifications::instance().getChannel("NotificationTips")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
- LLNotifications::instance().getChannel("Group Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
- LLNotifications::instance().getChannel("Alerts")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
- LLNotifications::instance().getChannel("AlertModal")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
- LLNotifications::instance().getChannel("IM Notifications")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
- LLNotifications::instance().getChannel("Offer")->connectChanged(boost::bind(&LLNotificationManager::onNotification, this, _1));
- LLNotifications::instance().getChannel("Hints")->connectChanged(boost::bind(&LLHintHandler::processNotification, LLHintHandler::getInstance(), _1));
- LLNotifications::instance().getChannel("Browser")->connectChanged(boost::bind(&LLBrowserNotification::processNotification, LLBrowserNotification::getInstance(), _1));
- LLNotifications::instance().getChannel("Outbox")->connectChanged(boost::bind(&LLOutboxNotification::processNotification, LLOutboxNotification::getInstance(), _1));
-
- mNotifyHandlers["notify"] = boost::shared_ptr<LLEventHandler>(new LLScriptHandler(NT_NOTIFY, LLSD()));
- mNotifyHandlers["notifytip"] = boost::shared_ptr<LLEventHandler>(new LLTipHandler(NT_NOTIFY, LLSD()));
- mNotifyHandlers["groupnotify"] = boost::shared_ptr<LLEventHandler>(new LLGroupHandler(NT_GROUPNOTIFY, LLSD()));
- mNotifyHandlers["alert"] = boost::shared_ptr<LLEventHandler>(new LLAlertHandler(NT_ALERT, LLSD()));
- mNotifyHandlers["alertmodal"] = boost::shared_ptr<LLEventHandler>(new LLAlertHandler(NT_ALERT, LLSD()));
- static_cast<LLAlertHandler*>(mNotifyHandlers["alertmodal"].get())->setAlertMode(true);
- mNotifyHandlers["notifytoast"] = boost::shared_ptr<LLEventHandler>(new LLIMHandler(NT_IMCHAT, LLSD()));
-
- mNotifyHandlers["nearbychat"] = boost::shared_ptr<LLEventHandler>(new LLNearbyChatHandler(NT_NEARBYCHAT, LLSD()));
- mNotifyHandlers["offer"] = boost::shared_ptr<LLEventHandler>(new LLOfferHandler(NT_OFFER, LLSD()));
-}
-
-//--------------------------------------------------------------------------
-bool LLNotificationManager::onNotification(const LLSD& notify)
-{
- LLSysHandler* handle = NULL;
-
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- if (!notification)
- return false;
-
- std::string notification_type = notification->getType();
- handle = static_cast<LLSysHandler*>(mNotifyHandlers[notification_type].get());
-
- if(!handle)
- return false;
+ new LLScriptHandler();
+ new LLTipHandler();
+ new LLGroupHandler();
+ new LLAlertHandler("Alerts", "alert", false);
+ new LLAlertHandler("AlertModal", "alertmodal", true);
+ new LLOfferHandler();
+ new LLHintHandler();
+ new LLBrowserNotification();
+ new LLOutboxNotification();
- return handle->processNotification(notify);
+ mChatHandler = boost::shared_ptr<LLNearbyChatHandler>(new LLNearbyChatHandler());
}
//--------------------------------------------------------------------------
void LLNotificationManager::onChat(const LLChat& msg, const LLSD &args)
{
- // check ENotificationType argument
- switch(args["type"].asInteger())
- {
- case NT_NEARBYCHAT:
- {
- LLNearbyChatHandler* handle = dynamic_cast<LLNearbyChatHandler*>(mNotifyHandlers["nearbychat"].get());
-
- if(handle)
- handle->processChat(msg, args);
- }
- break;
- default: //no need to handle all enum types
- break;
- }
+ if(mChatHandler)
+ mChatHandler->processChat(msg, args);
}
-//--------------------------------------------------------------------------
-LLEventHandler* LLNotificationManager::getHandlerForNotification(std::string notification_type)
-{
- std::map<std::string, boost::shared_ptr<LLEventHandler> >::iterator it = mNotifyHandlers.find(notification_type);
-
- if(it != mNotifyHandlers.end())
- return (*it).second.get();
-
- return NULL;
-}
-
-//--------------------------------------------------------------------------
-
diff --git a/indra/newview/llnotificationmanager.h b/indra/newview/llnotificationmanager.h
index 16e82e4cce..4d124e1379 100644
--- a/indra/newview/llnotificationmanager.h
+++ b/indra/newview/llnotificationmanager.h
@@ -56,20 +56,11 @@ public:
void init(void);
//TODO: combine processing and storage (*)
- // this method reacts on system notifications and calls an appropriate handler
- bool onNotification(const LLSD& notification);
-
// this method reacts on chat notifications and calls an appropriate handler
void onChat(const LLChat& msg, const LLSD &args);
- // get a handler for a certain type of notification
- LLEventHandler* getHandlerForNotification(std::string notification_type);
-
-
private:
- //TODO (*)
- std::map<std::string, boost::shared_ptr<LLEventHandler> > mNotifyHandlers;
- // cruft std::map<std::string, LLChatHandler*> mChatHandlers;
+ boost::shared_ptr<class LLNearbyChatHandler> mChatHandler;
};
}
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index 68fd65be0f..8010417d43 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -40,17 +40,16 @@
using namespace LLNotificationsUI;
//--------------------------------------------------------------------------
-LLOfferHandler::LLOfferHandler(e_notification_type type, const LLSD& id)
+LLOfferHandler::LLOfferHandler()
+: LLSysHandler("Offer", "offer")
{
- mType = type;
-
// Getting a Channel for our notifications
mChannel = LLChannelManager::getInstance()->createNotificationChannel();
mChannel->setControlHovering(true);
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
if(channel)
- channel->setOnRejectToastCallback(boost::bind(&LLOfferHandler::onRejectToast, this, _1));
+ channel->addOnRejectToastCallback(boost::bind(&LLOfferHandler::onRejectToast, this, _1));
}
//--------------------------------------------------------------------------
@@ -67,126 +66,118 @@ void LLOfferHandler::initChannel()
}
//--------------------------------------------------------------------------
-bool LLOfferHandler::processNotification(const LLSD& notify)
+bool LLOfferHandler::processNotification(const LLNotificationPtr& notification)
{
if(!mChannel)
{
return false;
}
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- if(!notification)
- return false;
-
// arrange a channel on a screen
if(!mChannel->getVisible())
{
initChannel();
}
- if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
- {
+ bool add_notif_to_im = notification->canLogToIM() && notification->hasFormElements();
+ if( notification->getPayload().has("give_inventory_notification")
+ && !notification->getPayload()["give_inventory_notification"] )
+ {
+ // This is an original inventory offer, so add a script floater
+ LLScriptFloaterManager::instance().onAddNotification(notification->getID());
+ }
+ else
+ {
+ notification->setReusable(add_notif_to_im);
- if( notification->getPayload().has("give_inventory_notification")
- && !notification->getPayload()["give_inventory_notification"] )
- {
- // This is an original inventory offer, so add a script floater
- LLScriptFloaterManager::instance().onAddNotification(notification->getID());
- }
- else
+ LLUUID session_id;
+ if (add_notif_to_im)
{
- notification->setReusable(LLHandlerUtil::isNotificationReusable(notification));
+ const std::string name = LLHandlerUtil::getSubstitutionName(notification);
- LLUUID session_id;
- if (LLHandlerUtil::canSpawnIMSession(notification))
- {
- const std::string name = LLHandlerUtil::getSubstitutionName(notification);
+ LLUUID from_id = notification->getPayload()["from_id"];
- LLUUID from_id = notification->getPayload()["from_id"];
+ session_id = LLHandlerUtil::spawnIMSession(name, from_id);
+ }
- session_id = LLHandlerUtil::spawnIMSession(name, from_id);
- }
+ if (add_notif_to_im)
+ {
+ LLHandlerUtil::addNotifPanelToIM(notification);
+ }
- bool show_toast = LLHandlerUtil::canSpawnToast(notification);
- bool add_notid_to_im = LLHandlerUtil::canAddNotifPanelToIM(notification);
- if (add_notid_to_im)
+ if (notification->getPayload().has("SUPPRESS_TOAST")
+ && notification->getPayload()["SUPPRESS_TOAST"])
+ {
+ LLNotificationsUtil::cancel(notification);
+ }
+ else if(!notification->canLogToIM() || !LLHandlerUtil::isIMFloaterOpened(notification))
+ {
+ LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
+ // don't close notification on panel destroy since it will be used by IM floater
+ notify_box->setCloseNotificationOnDestroy(!add_notif_to_im);
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.panel = notify_box;
+ p.on_delete_toast = boost::bind(&LLOfferHandler::onDeleteToast, this, _1);
+ // we not save offer notifications to the syswell floater that should be added to the IM floater
+ p.can_be_stored = !add_notif_to_im;
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ if(channel)
+ channel->addToast(p);
+
+ // if we not add notification to IM - add it to notification well
+ if (!add_notif_to_im)
{
- LLHandlerUtil::addNotifPanelToIM(notification);
+ // send a signal to the counter manager
+ mNewNotificationSignal();
}
+ }
- if (notification->getPayload().has("SUPPRESS_TOAST")
- && notification->getPayload()["SUPPRESS_TOAST"])
- {
- LLNotificationsUtil::cancel(notification);
- }
- else if(show_toast)
+ if (notification->canLogToIM())
+ {
+ // log only to file if notif panel can be embedded to IM and IM is opened
+ if (add_notif_to_im && LLHandlerUtil::isIMFloaterOpened(notification))
{
- LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
- // don't close notification on panel destroy since it will be used by IM floater
- notify_box->setCloseNotificationOnDestroy(!add_notid_to_im);
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.panel = notify_box;
- p.on_delete_toast = boost::bind(&LLOfferHandler::onDeleteToast, this, _1);
- // we not save offer notifications to the syswell floater that should be added to the IM floater
- p.can_be_stored = !add_notid_to_im;
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
- channel->addToast(p);
-
- // if we not add notification to IM - add it to notification well
- if (!add_notid_to_im)
- {
- // send a signal to the counter manager
- mNewNotificationSignal();
- }
+ LLHandlerUtil::logToIMP2P(notification, true);
}
-
- if (LLHandlerUtil::canLogToIM(notification))
+ else
{
- // log only to file if notif panel can be embedded to IM and IM is opened
- if (add_notid_to_im && LLHandlerUtil::isIMFloaterOpened(notification))
- {
- LLHandlerUtil::logToIMP2P(notification, true);
- }
- else
- {
- LLHandlerUtil::logToIMP2P(notification);
- }
+ LLHandlerUtil::logToIMP2P(notification);
}
}
}
- else if (notify["sigtype"].asString() == "delete")
+
+ return false;
+}
+
+/*virtual*/ void LLOfferHandler::onDelete(LLNotificationPtr notification)
+{
+ if( notification->getPayload().has("give_inventory_notification")
+ && !notification->getPayload()["give_inventory_notification"] )
+ {
+ // Remove original inventory offer script floater
+ LLScriptFloaterManager::instance().onRemoveNotification(notification->getID());
+ }
+ else
{
- if( notification->getPayload().has("give_inventory_notification")
- && !notification->getPayload()["give_inventory_notification"] )
+ if (notification->canLogToIM()
+ && notification->hasFormElements()
+ && !LLHandlerUtil::isIMFloaterOpened(notification))
{
- // Remove original inventory offer script floater
- LLScriptFloaterManager::instance().onRemoveNotification(notification->getID());
- }
- else
- {
- if (LLHandlerUtil::canAddNotifPanelToIM(notification)
- && !LLHandlerUtil::isIMFloaterOpened(notification))
- {
- LLHandlerUtil::decIMMesageCounter(notification);
- }
- mChannel->killToastByNotificationID(notification->getID());
+ LLHandlerUtil::decIMMesageCounter(notification);
}
+ mChannel->killToastByNotificationID(notification->getID());
}
-
- return false;
}
//--------------------------------------------------------------------------
void LLOfferHandler::onDeleteToast(LLToast* toast)
{
- if (!LLHandlerUtil::canAddNotifPanelToIM(toast->getNotification()))
+ if (!toast->getNotification()->canLogToIM() || !toast->getNotification()->hasFormElements())
{
// send a signal to the counter manager
mDelNotificationSignal();
@@ -202,11 +193,10 @@ void LLOfferHandler::onRejectToast(LLUUID& id)
{
LLNotificationPtr notification = LLNotifications::instance().find(id);
- if (notification
- && LLNotificationManager::getInstance()->getHandlerForNotification(
- notification->getType()) == this
- // don't delete notification since it may be used by IM floater
- && !LLHandlerUtil::canAddNotifPanelToIM(notification))
+ if (notification
+ && mItems.find(notification) != mItems.end()
+ // don't delete notification since it may be used by IM floater
+ && (!notification->canLogToIM() || !notification->hasFormElements()))
{
LLNotifications::instance().cancel(notification);
}
diff --git a/indra/newview/llnotificationscripthandler.cpp b/indra/newview/llnotificationscripthandler.cpp
index bbb4d03768..714f14963c 100644
--- a/indra/newview/llnotificationscripthandler.cpp
+++ b/indra/newview/llnotificationscripthandler.cpp
@@ -42,17 +42,16 @@ static const std::string SCRIPT_DIALOG_GROUP ("ScriptDialogGroup");
static const std::string SCRIPT_LOAD_URL ("LoadWebPage");
//--------------------------------------------------------------------------
-LLScriptHandler::LLScriptHandler(e_notification_type type, const LLSD& id)
+LLScriptHandler::LLScriptHandler()
+: LLSysHandler("Notifications", "notify")
{
- mType = type;
-
// Getting a Channel for our notifications
mChannel = LLChannelManager::getInstance()->createNotificationChannel();
mChannel->setControlHovering(true);
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
if(channel)
- channel->setOnRejectToastCallback(boost::bind(&LLScriptHandler::onRejectToast, this, _1));
+ channel->addOnRejectToastCallback(boost::bind(&LLScriptHandler::onRejectToast, this, _1));
}
@@ -70,69 +69,65 @@ void LLScriptHandler::initChannel()
}
//--------------------------------------------------------------------------
-bool LLScriptHandler::processNotification(const LLSD& notify)
+bool LLScriptHandler::processNotification(const LLNotificationPtr& notification)
{
if(!mChannel)
{
return false;
}
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- if(!notification)
- return false;
-
// arrange a channel on a screen
if(!mChannel->getVisible())
{
initChannel();
}
- if(notify["sigtype"].asString() == "add")
+ if (notification->canLogToIM())
{
- if (LLHandlerUtil::canLogToIM(notification))
- {
- LLHandlerUtil::logToIMP2P(notification);
- }
+ LLHandlerUtil::logToIMP2P(notification);
+ }
- if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName())
- {
- LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID());
- }
- else
- {
- LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(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);
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
- {
- channel->addToast(p);
- }
-
- // send a signal to the counter manager
- mNewNotificationSignal();
- }
+ if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName())
+ {
+ LLScriptFloaterManager::getInstance()->onAddNotification(notification->getID());
}
- else if (notify["sigtype"].asString() == "delete")
+ else
{
- if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName())
- {
- LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
- }
- else
+ LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(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);
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ if(channel)
{
- mChannel->killToastByNotificationID(notification->getID());
+ channel->addToast(p);
}
+
+ // send a signal to the counter manager
+ mNewNotificationSignal();
}
+
return false;
}
+
+void LLScriptHandler::onDelete( LLNotificationPtr notification )
+{
+ if(SCRIPT_DIALOG == notification->getName() || SCRIPT_DIALOG_GROUP == notification->getName() || SCRIPT_LOAD_URL == notification->getName())
+ {
+ LLScriptFloaterManager::getInstance()->onRemoveNotification(notification->getID());
+ }
+ else
+ {
+ mChannel->killToastByNotificationID(notification->getID());
+ }
+}
+
+
//--------------------------------------------------------------------------
void LLScriptHandler::onDeleteToast(LLToast* toast)
@@ -158,9 +153,7 @@ void LLScriptHandler::onRejectToast(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);
}
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index fb0891c4c5..0b0ac040cb 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -41,16 +41,15 @@
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
mChannel = LLChannelManager::getInstance()->createNotificationChannel();
LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
if(channel)
- channel->setOnRejectToastCallback(boost::bind(&LLTipHandler::onRejectToast, this, _1));
+ channel->addOnRejectToastCallback(boost::bind(&LLTipHandler::onRejectToast, this, _1));
}
//--------------------------------------------------------------------------
@@ -67,90 +66,74 @@ void LLTipHandler::initChannel()
}
//--------------------------------------------------------------------------
-bool LLTipHandler::processNotification(const LLSD& notify)
+bool LLTipHandler::processNotification(const LLNotificationPtr& notification)
{
if(!mChannel)
{
return false;
}
- LLNotificationPtr notification = LLNotifications::instance().find(notify["id"].asUUID());
-
- if(!notification)
- return false;
-
// arrange a channel on a screen
if(!mChannel->getVisible())
{
initChannel();
}
- if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
+ // archive message in nearby chat
+ if (notification->canLogToChat())
{
- // archive message in nearby chat
- if (LLHandlerUtil::canLogToNearbyChat(notification))
- {
- LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
-
- // don't show toast if Nearby Chat is opened
- LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
- LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance();
- if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible())
- {
- return false;
- }
- }
+ LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
- std::string session_name = notification->getPayload()["SESSION_NAME"];
- const std::string name = notification->getSubstitutions()["NAME"];
- if (session_name.empty())
- {
- session_name = name;
- }
- LLUUID from_id = notification->getPayload()["from_id"];
- if (LLHandlerUtil::canLogToIM(notification))
- {
- LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name,
- notification->getMessage(), from_id, from_id);
- }
-
- if (LLHandlerUtil::canSpawnIMSession(notification))
- {
- 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))
+ // don't show toast if Nearby Chat is opened
+ LLNearbyChat* nearby_chat = LLNearbyChat::getInstance();
+ LLNearbyChatBar* nearby_chat_bar = LLNearbyChatBar::getInstance();
+ if (!nearby_chat_bar->isMinimized() && nearby_chat_bar->getVisible() && nearby_chat->getVisible())
{
return false;
}
+ }
- LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
-
- LLToast::Params p;
- p.notif_id = notification->getID();
- p.notification = notification;
- p.lifetime_secs = gSavedSettings.getS32("NotificationTipToastLifeTime");
- p.panel = notify_box;
- p.is_tip = true;
- p.can_be_stored = false;
-
- removeExclusiveNotifications(notification);
+ std::string session_name = notification->getPayload()["SESSION_NAME"];
+ const std::string name = notification->getSubstitutions()["NAME"];
+ if (session_name.empty())
+ {
+ session_name = name;
+ }
+ LLUUID from_id = notification->getPayload()["from_id"];
+ if (notification->canLogToIM())
+ {
+ LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, session_name, name,
+ notification->getMessage(), from_id, from_id);
+ }
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
- channel->addToast(p);
+ if (notification->canLogToIM() && notification->hasFormElements())
+ {
+ LLHandlerUtil::spawnIMSession(name, from_id);
}
- else if (notify["sigtype"].asString() == "delete")
+
+ if (notification->canLogToIM() && LLHandlerUtil::isIMFloaterOpened(notification))
{
- mChannel->killToastByNotificationID(notification->getID());
+ return false;
}
- return false;
-}
-//--------------------------------------------------------------------------
-void LLTipHandler::onDeleteToast(LLToast* toast)
-{
+ LLToastPanel* notify_box = LLToastPanel::buidPanelFromNotification(notification);
+
+ LLToast::Params p;
+ p.notif_id = notification->getID();
+ p.notification = notification;
+ p.lifetime_secs = gSavedSettings.getS32("NotificationTipToastLifeTime");
+ p.panel = notify_box;
+ p.is_tip = true;
+ p.can_be_stored = false;
+
+ removeExclusiveNotifications(notification);
+
+ LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
+ if(channel)
+ channel->addToast(p);
+
+
+ return false;
}
//--------------------------------------------------------------------------
@@ -159,9 +142,7 @@ 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);
}
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h
index c9f8855fe6..2ea5b8e546 100644
--- a/indra/newview/llscreenchannel.h
+++ b/indra/newview/llscreenchannel.h
@@ -228,16 +228,16 @@ public:
// Channel's signals
// signal on storing of faded toasts event
- typedef boost::function<void (LLPanel* info_panel, const LLUUID id)> store_tost_callback_t;
- typedef boost::signals2::signal<void (LLPanel* info_panel, const LLUUID id)> store_tost_signal_t;
- store_tost_signal_t mOnStoreToast;
- boost::signals2::connection setOnStoreToastCallback(store_tost_callback_t cb) { return mOnStoreToast.connect(cb); }
+ typedef boost::signals2::signal<void (LLPanel* info_panel, const LLUUID id)> store_toast_signal_t;
+ boost::signals2::connection addOnStoreToastCallback(store_toast_signal_t::slot_type cb) { return mOnStoreToast.connect(cb); }
// signal on rejecting of a toast event
- typedef boost::function<void (LLUUID id)> reject_tost_callback_t;
- typedef boost::signals2::signal<void (LLUUID id)> reject_tost_signal_t;
- reject_tost_signal_t mRejectToastSignal; boost::signals2::connection setOnRejectToastCallback(reject_tost_callback_t cb) { return mRejectToastSignal.connect(cb); }
+ typedef boost::signals2::signal<void (LLUUID id)> reject_toast_signal_t;
+ boost::signals2::connection addOnRejectToastCallback(reject_toast_signal_t::slot_type cb) { return mRejectToastSignal.connect(cb); }
private:
+ store_toast_signal_t mOnStoreToast;
+ reject_toast_signal_t mRejectToastSignal;
+
struct ToastElem
{
LLUUID id;
diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index 0cb6c85012..e8293ebe2b 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -437,9 +437,9 @@ LLNotificationWellWindow::LLNotificationWellWindow(const LLSD& key)
: LLSysWellWindow(key)
{
// init connections to the list's update events
- connectListUpdaterToSignal("notify");
- connectListUpdaterToSignal("groupnotify");
- connectListUpdaterToSignal("offer");
+ connectListUpdaterToSignal("Notifications");
+ connectListUpdaterToSignal("Group Notifications");
+ connectListUpdaterToSignal("Offer");
}
// static
@@ -519,7 +519,7 @@ void LLNotificationWellWindow::initChannel()
LLSysWellWindow::initChannel();
if(mChannel)
{
- mChannel->setOnStoreToastCallback(boost::bind(&LLNotificationWellWindow::onStoreToast, this, _1, _2));
+ mChannel->addOnStoreToastCallback(boost::bind(&LLNotificationWellWindow::onStoreToast, this, _1, _2));
}
}
@@ -548,8 +548,7 @@ void LLNotificationWellWindow::onStoreToast(LLPanel* info_panel, LLUUID id)
void LLNotificationWellWindow::connectListUpdaterToSignal(std::string notification_type)
{
- LLNotificationsUI::LLNotificationManager* manager = LLNotificationsUI::LLNotificationManager::getInstance();
- LLNotificationsUI::LLEventHandler* n_handler = manager->getHandlerForNotification(notification_type);
+ LLNotificationsUI::LLEventHandler* n_handler = dynamic_cast<LLNotificationsUI::LLEventHandler*>(LLNotifications::instance().getChannel(notification_type).get());
if(n_handler)
{
n_handler->setNotificationIDCallback(boost::bind(&LLNotificationWellWindow::removeItemByID, this, _1));
diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp
index 75178a6ef8..707d2d9765 100644
--- a/indra/newview/lltoastgroupnotifypanel.cpp
+++ b/indra/newview/lltoastgroupnotifypanel.cpp
@@ -51,7 +51,7 @@
const S32 LLToastGroupNotifyPanel::DEFAULT_MESSAGE_MAX_LINE_COUNT = 7;
-LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(LLNotificationPtr& notification)
+LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notification)
: LLToastPanel(notification),
mInventoryOffer(NULL)
{
diff --git a/indra/newview/lltoastgroupnotifypanel.h b/indra/newview/lltoastgroupnotifypanel.h
index 7794ec9f63..3b8b31eac1 100644
--- a/indra/newview/lltoastgroupnotifypanel.h
+++ b/indra/newview/lltoastgroupnotifypanel.h
@@ -53,7 +53,7 @@ public:
// Non-transient messages. You can specify non-default button
// layouts (like one for script dialogs) by passing various
// numbers in for "layout".
- LLToastGroupNotifyPanel(LLNotificationPtr& notification);
+ LLToastGroupNotifyPanel(const LLNotificationPtr& notification);
/*virtual*/ ~LLToastGroupNotifyPanel();
protected:
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index de305bf3d9..dc5cc88dc4 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -52,7 +52,7 @@ const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL;
LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal;
-LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect, bool show_images) :
+LLToastNotifyPanel::LLToastNotifyPanel(const LLNotificationPtr& notification, const LLRect& rect, bool show_images) :
LLToastPanel(notification),
mTextBox(NULL),
mInfoPanel(NULL),
@@ -536,7 +536,7 @@ void LLToastNotifyPanel::onToastPanelButtonClicked(const LLUUID& notification_id
}
}
-void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification)
+void LLToastNotifyPanel::disableRespondedOptions(const LLNotificationPtr& notification)
{
LLSD response = notification->getResponse();
for (LLSD::map_const_iterator response_it = response.beginMap();
diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h
index 57711b3d80..db517ec858 100644
--- a/indra/newview/lltoastnotifypanel.h
+++ b/indra/newview/lltoastnotifypanel.h
@@ -60,7 +60,7 @@ public:
* @deprecated if you intend to instantiate LLToastNotifyPanel - it's point to
* implement right class for desired toast panel. @see LLGenericTipPanel as example.
*/
- LLToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null, bool show_images = true);
+ LLToastNotifyPanel(const LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null, bool show_images = true);
virtual ~LLToastNotifyPanel();
LLPanel * getControlPanel() { return mControlPanel; }
@@ -118,7 +118,7 @@ protected:
/**
* Process response data. Will disable selected options
*/
- void disableRespondedOptions(LLNotificationPtr& notification);
+ void disableRespondedOptions(const LLNotificationPtr& notification);
bool mIsTip;
bool mAddedDefaultBtn;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 3c6770df43..4f83d9096c 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2776,7 +2776,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
chat.mOwnerID = from_id;
LLSD args;
args["slurl"] = location;
- args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
// Look for IRC-style emotes here so object name formatting is correct
std::string prefix = message.substr(0, 4);
@@ -3379,7 +3378,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
// pass owner_id to chat so that we can display the remote
// object inspect for an object that is chatting with you
LLSD args;
- args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
chat.mOwnerID = owner_id;
if (gSavedSettings.getBOOL("TranslateChat") && chat.mSourceType != CHAT_SOURCE_SYSTEM)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index e0653fec30..6d9b8b4eb3 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1548,11 +1548,11 @@ LLViewerWindow::LLViewerWindow(const Params& p)
mViewerWindowListener(new LLViewerWindowListener(this)),
mProgressView(NULL)
{
- LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert"));
- LLNotificationChannel::buildChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal"));
+ LLNotificationChannelPtr vw_alerts_channel(new LLNotificationChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert")));
+ LLNotificationChannelPtr vw_alerts_modal_channel(new LLNotificationChannel("VW_alertmodal", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alertmodal")));
- LLNotifications::instance().getChannel("VW_alerts")->connectChanged(&LLViewerWindow::onAlert);
- LLNotifications::instance().getChannel("VW_alertmodal")->connectChanged(&LLViewerWindow::onAlert);
+ vw_alerts_channel->connectChanged(&LLViewerWindow::onAlert);
+ vw_alerts_modal_channel->connectChanged(&LLViewerWindow::onAlert);
LLNotifications::instance().setIgnoreAllNotifications(gSavedSettings.getBOOL("IgnoreAllNotifications"));
llinfos << "NOTE: ALL NOTIFICATIONS THAT OCCUR WILL GET ADDED TO IGNORE LIST FOR LATER RUNS." << llendl;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index af75d49353..da83ffbab4 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -2904,6 +2904,7 @@ Would you like to trust this authority?
icon="alertmodal.tga"
name="GrantedModifyRights"
persist="true"
+ log_to_im="true"
type="notify">
[NAME] has given you permission to edit their objects.
</notification>
@@ -2912,6 +2913,7 @@ Would you like to trust this authority?
icon="alertmodal.tga"
name="RevokedModifyRights"
persist="true"
+ log_to_im="true"
type="notify">
Your privilege to modify [NAME]&apos;s objects has been revoked
</notification>
@@ -5161,6 +5163,8 @@ The string [STRING_NAME] is missing from strings.xml
<notification
icon="notifytip.tga"
name="IMSystemMessageTip"
+ log_to_im="true"
+ log_to_chat="true"
type="notifytip">
[MESSAGE]
</notification>
@@ -5205,6 +5209,7 @@ Topic: [SUBJECT], Message: [MESSAGE]
<notification
icon="notifytip.tga"
name="FriendOnline"
+ log_to_chat="true"
type="notifytip">
<tag>friendship</tag>
&lt;nolink&gt;[NAME]&lt;/nolink&gt; is Online
@@ -5213,6 +5218,7 @@ Topic: [SUBJECT], Message: [MESSAGE]
<notification
icon="notifytip.tga"
name="FriendOffline"
+ log_to_chat="true"
type="notifytip">
<tag>friendship</tag>
&lt;nolink&gt;[NAME]&lt;/nolink&gt; is Offline
@@ -5459,6 +5465,8 @@ You don&apos;t have permission to copy this.
<notification
icon="notifytip.tga"
name="InventoryAccepted"
+ log_to_im="true"
+ log_to_chat="true"
type="notifytip">
[NAME] received your inventory offer.
</notification>
@@ -5466,6 +5474,8 @@ You don&apos;t have permission to copy this.
<notification
icon="notifytip.tga"
name="InventoryDeclined"
+ log_to_im="true"
+ log_to_chat="true"
type="notifytip">
[NAME] declined your inventory offer.
</notification>
@@ -5547,6 +5557,7 @@ Please select at least one type of content to search (General, Moderate, or Adul
<notification
icon="notify.tga"
name="PaymentReceived"
+ log_to_im="true"
persist="true"
type="notify">
<tag>funds</tag>
@@ -5556,6 +5567,7 @@ Please select at least one type of content to search (General, Moderate, or Adul
<notification
icon="notify.tga"
name="PaymentSent"
+ log_to_im="true"
persist="true"
type="notify">
<tag>funds</tag>
@@ -5700,6 +5712,7 @@ The objects on the selected parcel that are NOT owned by you have been returned
<notification
icon="notify.tga"
name="ServerObjectMessage"
+ log_to_im="true"
persist="true"
type="notify">
Message from [NAME]:
@@ -6070,6 +6083,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
<notification
icon="notify.tga"
name="UserGiveItem"
+ log_to_im ="true"
type="offer">
[NAME_SLURL] has given you this [OBJECTTYPE]:
[ITEM_SLURL]
@@ -6125,6 +6139,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
<notification
icon="notify.tga"
name="TeleportOffered"
+ log_to_im="true"
type="offer">
[NAME_SLURL] has offered to teleport you to their location:
@@ -6145,6 +6160,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
<notification
icon="notify.tga"
name="TeleportOfferSent"
+ log_to_im="true"
type="offer">
Teleport offer sent to [TO_NAME]
</notification>
@@ -6172,6 +6188,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
<notification
icon="notify.tga"
name="OfferFriendship"
+ log_to_im="true"
type="offer">
<tag>friendship</tag>
<tag>confirm</tag>
@@ -6195,6 +6212,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
<notification
icon="notify.tga"
name="FriendshipOffered"
+ log_to_im="true"
type="offer">
<tag>friendship</tag>
You have offered friendship to [TO_NAME]
@@ -6224,6 +6242,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
<notification
icon="notify.tga"
name="FriendshipAccepted"
+ log_to_im="true"
type="offer">
<tag>friendship</tag>
&lt;nolink&gt;[NAME]&lt;/nolink&gt; accepted your friendship offer.
@@ -6232,6 +6251,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
<notification
icon="notify.tga"
name="FriendshipDeclined"
+ log_to_im="true"
persist="true"
type="notify">
<tag>friendship</tag>
@@ -6241,6 +6261,7 @@ Your object named &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt; has given you th
<notification
icon="notify.tga"
name="FriendshipAcceptedByMe"
+ log_to_im="true"
type="offer">
<tag>friendship</tag>
Friendship offer accepted.
@@ -6249,6 +6270,7 @@ Friendship offer accepted.
<notification
icon="notify.tga"
name="FriendshipDeclinedByMe"
+ log_to_im="true"
type="offer">
<tag>friendship</tag>
Friendship offer declined.