summaryrefslogtreecommitdiff
path: root/indra/newview/llnotificationtiphandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llnotificationtiphandler.cpp')
-rw-r--r--indra/newview/llnotificationtiphandler.cpp71
1 files changed, 64 insertions, 7 deletions
diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 543198c1d2..be76959d07 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -36,12 +36,44 @@
#include "llfloaterreg.h"
#include "llnearbychat.h"
#include "llnotificationhandler.h"
+#include "llnotifications.h"
#include "lltoastnotifypanel.h"
#include "llviewercontrol.h"
#include "llviewerwindow.h"
using namespace LLNotificationsUI;
+class LLOnlineStatusToast : public LLToastPanel
+{
+public:
+
+ struct Params
+ {
+ LLNotificationPtr notification;
+ LLUUID avatar_id;
+ std::string message;
+
+ Params() {}
+ };
+
+ LLOnlineStatusToast(Params& p) : LLToastPanel(p.notification)
+ {
+ LLUICtrlFactory::getInstance()->buildPanel(this, "panel_online_status_toast.xml");
+
+ childSetValue("avatar_icon", p.avatar_id);
+ childSetValue("message", p.message);
+
+ if (p.notification->getPayload().has("respond_on_mousedown")
+ && p.notification->getPayload()["respond_on_mousedown"] )
+ {
+ setMouseDownCallback(boost::bind(&LLNotification::respond, p.notification,
+ p.notification->getResponseTemplate()));
+ }
+
+ // set line max count to 2 in case of a very long name
+ snapToMessageHeight(getChild<LLTextBox>("message"), 2);
+ }
+};
//--------------------------------------------------------------------------
LLTipHandler::LLTipHandler(e_notification_type type, const LLSD& id)
@@ -60,7 +92,7 @@ LLTipHandler::~LLTipHandler()
//--------------------------------------------------------------------------
void LLTipHandler::initChannel()
{
- S32 channel_right_bound = gViewerWindow->getWorldViewRect().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
+ S32 channel_right_bound = gViewerWindow->getWorldViewRectScaled().mRight - gSavedSettings.getS32("NotificationChannelRightMargin");
S32 channel_width = gSavedSettings.getS32("NotifyBoxWidth");
mChannel->init(channel_right_bound - channel_width, channel_right_bound);
}
@@ -87,20 +119,45 @@ bool LLTipHandler::processNotification(const LLSD& notify)
if(notify["sigtype"].asString() == "add" || notify["sigtype"].asString() == "change")
{
// archive message in nearby chat
- LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
- if(nearby_chat)
+ if (LLHandlerUtil::canLogToNearbyChat(notification))
{
- LLChat chat_msg(notification->getMessage());
- nearby_chat->addMessage(chat_msg);
+ LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM);
// don't show toast if Nearby Chat is opened
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<
+ LLNearbyChat>("nearby_chat", LLSD());
if (nearby_chat->getVisible())
{
return true;
- }
+ }
+ }
+
+ const std::string name = notification->getSubstitutions()["NAME"];
+ LLUUID from_id = notification->getPayload()["from_id"];
+ if (LLHandlerUtil::canLogToIM(notification))
+ {
+ LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, name, name,
+ notification->getMessage(), from_id, from_id);
}
- LLToastNotifyPanel* notify_box = new LLToastNotifyPanel(notification);
+ if (LLHandlerUtil::canSpawnIMSession(notification))
+ {
+ LLHandlerUtil::spawnIMSession(name, from_id);
+ }
+
+ LLToastPanel* notify_box = NULL;
+ if("FriendOffline" == notification->getName() || "FriendOnline" == notification->getName())
+ {
+ LLOnlineStatusToast::Params p;
+ p.notification = notification;
+ p.message = notification->getMessage();
+ p.avatar_id = notification->getPayload()["FROM_ID"];
+ notify_box = new LLOnlineStatusToast(p);
+ }
+ else
+ {
+ notify_box = new LLToastNotifyPanel(notification);
+ }
LLToast::Params p;
p.notif_id = notification->getID();