summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llnotificationofferhandler.cpp49
-rw-r--r--indra/newview/llviewermessage.cpp32
2 files changed, 63 insertions, 18 deletions
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index c179a2cf90..4f353bf6a5 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -39,6 +39,7 @@
#include "llviewerwindow.h"
#include "llnotificationmanager.h"
#include "llnotifications.h"
+#include "llscriptfloater.h"
using namespace LLNotificationsUI;
@@ -92,24 +93,42 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
{
LLHandlerUtil::logToIMP2P(notification);
- 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(&LLOfferHandler::onDeleteToast, this, _1);
-
- LLScreenChannel* channel = dynamic_cast<LLScreenChannel*>(mChannel);
- if(channel)
- channel->addToast(p);
-
- // send a signal to the counter manager
- mNewNotificationSignal();
+ 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
+ {
+ 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(&LLOfferHandler::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());
+ if( notification->getPayload().has("give_inventory_notification")
+ && !notification->getPayload()["give_inventory_notification"] )
+ {
+ // Remove original inventory offer script floater
+ LLScriptFloaterManager::instance().onRemoveNotification(notification->getID());
+ }
+ else
+ {
+ mChannel->killToastByNotificationID(notification->getID());
+ }
}
return true;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index a5e06e7cff..23d02af73d 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1240,6 +1240,10 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
gInventory.addObserver(opener);
}
+ // Remove script dialog because there is no need in it no more.
+ LLUUID object_id = notification["payload"]["object_id"].asUUID();
+ LLScriptFloaterManager::instance().removeNotificationByObjectId(object_id);
+
delete this;
return false;
}
@@ -1414,7 +1418,11 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const
{
gInventory.addObserver(opener);
}
-
+
+ // Remove script dialog because there is no need in it no more.
+ LLUUID object_id = notification["payload"]["object_id"].asUUID();
+ LLScriptFloaterManager::instance().removeNotificationByObjectId(object_id);
+
delete this;
return false;
}
@@ -1502,7 +1510,18 @@ void inventory_offer_handler(LLOfferInfo* info)
}
}
+ // If mObjectID is null then generate the object_id based on msg to prevent
+ // multiple creation of chiclets for same object.
+ LLUUID object_id = info->mObjectID;
+ if (object_id.isNull())
+ object_id.generate(msg);
+
payload["from_id"] = info->mFromID;
+ // Needed by LLScriptFloaterManager to bind original notification with
+ // faked for toast one.
+ payload["object_id"] = object_id;
+ // Flag indicating that this notification is faked for toast.
+ payload["give_inventory_notification"] = FALSE;
args["OBJECTFROMNAME"] = info->mFromName;
args["NAME"] = info->mFromName;
args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about");
@@ -1543,9 +1562,16 @@ void inventory_offer_handler(LLOfferInfo* info)
// In viewer 2 we're now auto receiving inventory offers and messaging as such (not sending reject messages).
info->send_auto_receive_response();
}
-
+
// Pop up inv offer notification and let the user accept (keep), or reject (and silently delete) the inventory.
- LLNotifications::instance().add(p);
+ LLNotifications::instance().add(p);
+
+ // Inform user that there is a script floater via toast system
+ {
+ payload["give_inventory_notification"] = TRUE;
+ LLNotificationPtr notification = LLNotifications::instance().add(p.payload(payload));
+ LLScriptFloaterManager::getInstance()->setNotificationToastId(object_id, notification->getID());
+ }
}
bool lure_callback(const LLSD& notification, const LLSD& response)