summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rw-r--r--indra/newview/llviewermessage.cpp598
1 files changed, 389 insertions, 209 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 1890e0bf1d..9fc818e1ff 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -89,6 +89,7 @@
#include "llhudeffecttrail.h"
#include "llhudmanager.h"
#include "llinventorymodel.h"
+#include "llinventoryobserver.h"
#include "llinventorypanel.h"
#include "llfloaterinventory.h"
#include "llmenugl.h"
@@ -96,10 +97,12 @@
#include "llmutelist.h"
#include "llnearbychat.h"
#include "llnotifications.h"
+#include "llnotificationsutil.h"
#include "llnotify.h"
#include "llpanelgrouplandmoney.h"
#include "llpanelplaces.h"
#include "llrecentpeople.h"
+#include "llscriptfloater.h"
#include "llselectmgr.h"
#include "llsidetray.h"
#include "llstartup.h"
@@ -168,7 +171,6 @@ static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds
extern BOOL gDebugClicks;
// function prototypes
-void open_offer(const std::vector<LLUUID>& items, const std::string& from_name);
bool check_offer_throttle(const std::string& from_name, bool check_only);
//inventory offer throttle globals
@@ -209,7 +211,7 @@ const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] =
bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
LLMessageSystem* msg = gMessageSystem;
const LLSD& payload = notification["payload"];
@@ -634,7 +636,7 @@ void send_sound_trigger(const LLUUID& sound_id, F32 gain)
bool join_group_response(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
BOOL delete_context_data = TRUE;
bool accept_invite = false;
@@ -649,7 +651,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
LLGroupActions::show(group_id);
LLSD args;
args["MESSAGE"] = message;
- LLNotifications::instance().add("JoinGroup", args, notification["payload"]);
+ LLNotificationsUtil::add("JoinGroup", args, notification["payload"]);
return false;
}
if(option == 0 && !group_id.isNull())
@@ -668,7 +670,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
LLSD args;
args["NAME"] = name;
args["INVITE"] = message;
- LLNotifications::instance().add("JoinedTooManyGroupsMember", args, notification["payload"]);
+ LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification["payload"]);
}
}
@@ -685,7 +687,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
// asking about a fee.
LLSD next_payload = notification["payload"];
next_payload["fee"] = 0;
- LLNotifications::instance().add("JoinGroupCanAfford",
+ LLNotificationsUtil::add("JoinGroupCanAfford",
args,
next_payload);
}
@@ -725,7 +727,7 @@ public:
LLOpenAgentOffer(const std::string& from_name) : mFromName(from_name) {}
/*virtual*/ void done()
{
- open_offer(mComplete, mFromName);
+ open_inventory_offer(mComplete, mFromName);
gInventory.removeObserver(this);
delete this;
}
@@ -743,7 +745,7 @@ class LLOpenTaskOffer : public LLInventoryAddedObserver
protected:
/*virtual*/ void done()
{
- open_offer(mAdded, "");
+ open_inventory_offer(mAdded, "");
mAdded.clear();
}
};
@@ -874,7 +876,7 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
}
}
-void open_offer(const std::vector<LLUUID>& items, const std::string& from_name)
+void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& from_name)
{
std::vector<LLUUID>::const_iterator it = items.begin();
std::vector<LLUUID>::const_iterator end = items.end();
@@ -911,7 +913,7 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name)
LLSD args;
args["LANDMARK_NAME"] = item->getName();
args["FOLDER_NAME"] = std::string(parent_folder ? parent_folder->getName() : "unknown");
- LLNotifications::instance().add("LandmarkCreated", args);
+ LLNotificationsUtil::add("LandmarkCreated", args);
// Created landmark is passed to Places panel to allow its editing.
LLPanelPlaces *panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->showPanel("panel_places", LLSD()));
@@ -938,6 +940,11 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name)
!from_name.empty())
{
view = LLFloaterInventory::showAgentInventory();
+ //TODO:this should be moved to the end of method after all the checks,
+ //but first decide what to do with active inventory if any (EK)
+ LLSD key;
+ key["select"] = item->getUUID();
+ LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
}
else
{
@@ -1059,12 +1066,60 @@ LLSD LLOfferInfo::asLLSD()
return sd;
}
+void LLOfferInfo::send_auto_receive_response(void)
+{
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_MessageBlock);
+ msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
+ msg->addUUIDFast(_PREHASH_ToAgentID, mFromID);
+ msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
+ msg->addUUIDFast(_PREHASH_ID, mTransactionID);
+ msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
+ std::string name;
+ LLAgentUI::buildFullname(name);
+ msg->addStringFast(_PREHASH_FromAgentName, name);
+ msg->addStringFast(_PREHASH_Message, "");
+ msg->addU32Fast(_PREHASH_ParentEstateID, 0);
+ msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
+ msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
+
+ // Auto Receive Message. The math for the dialog works, because the accept
+ // for inventory_offered, task_inventory_offer or
+ // group_notice_inventory is 1 greater than the offer integer value.
+ // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED,
+ // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED
+ msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1));
+ msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData),
+ sizeof(mFolderID.mData));
+ // send the message
+ msg->sendReliable(mHost);
+
+ if(IM_INVENTORY_OFFERED == mIM)
+ {
+ // add buddy to recent people list
+ LLRecentPeople::instance().add(mFromID);
+ }
+}
+
bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& response)
- {
+{
LLChat chat;
std::string log_message;
- S32 button = LLNotification::getSelectedOption(notification, response);
-
+ S32 button = LLNotificationsUtil::getSelectedOption(notification, response);
+
+ LLInventoryObserver* opener = NULL;
+ LLViewerInventoryCategory* catp = NULL;
+ catp = (LLViewerInventoryCategory*)gInventory.getCategory(mObjectID);
+ LLViewerInventoryItem* itemp = NULL;
+ if(!catp)
+ {
+ itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID);
+ }
+
// For muting, we need to add the mute, then decline the offer.
// This must be done here because:
// * callback may be called immediately,
@@ -1075,6 +1130,136 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
gCacheName->get(mFromID, mFromGroup, &inventory_offer_mute_callback);
}
+ std::string from_string; // Used in the pop-up.
+ std::string chatHistory_string; // Used in chat history.
+
+ // TODO: when task inventory offers can also be handled the new way, migrate the code that sets these strings here:
+ from_string = chatHistory_string = mFromName;
+
+ bool busy=FALSE;
+
+ switch(button)
+ {
+ case IOR_SHOW:
+ // we will want to open this item when it comes back.
+ LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID
+ << LL_ENDL;
+ switch (mIM)
+ {
+ case IM_INVENTORY_OFFERED:
+ {
+ // This is an offer from an agent. In this case, the back
+ // end has already copied the items into your inventory,
+ // so we can fetch it out of our inventory.
+ LLInventoryFetchObserver::item_ref_t items;
+ items.push_back(mObjectID);
+ LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string);
+ open_agent_offer->fetchItems(items);
+ if(catp || (itemp && itemp->isComplete()))
+ {
+ open_agent_offer->done();
+ }
+ else
+ {
+ opener = open_agent_offer;
+ }
+ }
+ break;
+ case IM_TASK_INVENTORY_OFFERED:
+ case IM_GROUP_NOTICE:
+ case IM_GROUP_NOTICE_REQUESTED:
+ // This is an offer from a task or group.
+ // We don't use a new instance of an opener
+ // We instead use the singular observer gOpenTaskOffer
+ // Since it already exists, we don't need to actually do anything
+ break;
+ default:
+ LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL;
+ break;
+ } // end switch (mIM)
+
+ // Show falls through to accept.
+
+ case IOR_ACCEPT:
+ //don't spam them if they are getting flooded
+ if (check_offer_throttle(mFromName, true))
+ {
+ log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString(".");
+ chat.mText = log_message;
+ LLFloaterChat::addChatHistory(chat);
+ }
+ break;
+
+ case IOR_BUSY:
+ //Busy falls through to decline. Says to make busy message.
+ busy=TRUE;
+ case IOR_MUTE:
+ // MUTE falls through to decline
+ case IOR_DECLINE:
+ {
+ log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +".";
+ chat.mText = log_message;
+ if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269
+ {
+ chat.mMuted = TRUE;
+ }
+ LLFloaterChat::addChatHistory(chat);
+
+ LLInventoryFetchComboObserver::folder_ref_t folders;
+ LLInventoryFetchComboObserver::item_ref_t items;
+ items.push_back(mObjectID);
+ LLDiscardAgentOffer* discard_agent_offer;
+ discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID);
+ discard_agent_offer->fetch(folders, items);
+ if(catp || (itemp && itemp->isComplete()))
+ {
+ discard_agent_offer->done();
+ }
+ else
+ {
+ opener = discard_agent_offer;
+ }
+
+
+ if (busy && (!mFromGroup && !mFromObject))
+ {
+ busy_message(gMessageSystem, mFromID);
+ }
+ break;
+ }
+ default:
+ // close button probably
+ // The item has already been fetched and is in your inventory, we simply won't highlight it
+ // OR delete it if the notification gets killed, since we don't want that to be a vector for
+ // losing inventory offers.
+ break;
+ }
+
+ if(opener)
+ {
+ gInventory.addObserver(opener);
+ }
+
+ delete this;
+ return false;
+}
+
+bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const LLSD& response)
+{
+ LLChat chat;
+ std::string log_message;
+ S32 button = LLNotification::getSelectedOption(notification, response);
+
+ // For muting, we need to add the mute, then decline the offer.
+ // This must be done here because:
+ // * callback may be called immediately,
+ // * adding the mute sends a message,
+ // * we can't build two messages at once.
+ if (2 == button)
+ {
+ gCacheName->get(mFromID, mFromGroup, &inventory_offer_mute_callback);
+ }
+
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
msg->nextBlockFast(_PREHASH_AgentData);
@@ -1101,7 +1286,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
{
itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID);
}
-
+
std::string from_string; // Used in the pop-up.
std::string chatHistory_string; // Used in chat history.
if (mFromObject == TRUE)
@@ -1112,16 +1297,16 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
if (gCacheName->getGroupName(mFromID, group_name))
{
from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'"
- + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup")
- + " "+ "'" + group_name + "'";
+ + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup")
+ + " "+ "'" + group_name + "'";
chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup")
- + " " + group_name + "'";
+ + " " + group_name + "'";
}
else
{
from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'"
- + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup");
+ + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup");
chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup");
}
}
@@ -1131,13 +1316,13 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
if (gCacheName->getName(mFromID, first_name, last_name))
{
from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName
- + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + first_name + " " + last_name;
+ + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + first_name + " " + last_name;
chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + first_name + " " + last_name;
}
else
{
from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+LLTrans::getString("'")
- + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser");
+ + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser");
chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser");
}
}
@@ -1151,137 +1336,90 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
switch(button)
{
- case IOR_ACCEPT:
- // ACCEPT. The math for the dialog works, because the accept
- // for inventory_offered, task_inventory_offer or
- // group_notice_inventory is 1 greater than the offer integer value.
- // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED,
- // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED
- msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1));
- msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData),
- sizeof(mFolderID.mData));
- // send the message
- msg->sendReliable(mHost);
-
- //don't spam them if they are getting flooded
- if (check_offer_throttle(mFromName, true))
- {
- log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString(".");
- chat.mText = log_message;
- LLFloaterChat::addChatHistory(chat);
- }
-
- // we will want to open this item when it comes back.
- LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID
- << LL_ENDL;
- switch (mIM)
- {
- case IM_INVENTORY_OFFERED:
- {
- // This is an offer from an agent. In this case, the back
- // end has already copied the items into your inventory,
- // so we can fetch it out of our inventory.
- LLInventoryFetchObserver::item_ref_t items;
- items.push_back(mObjectID);
- LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string);
- open_agent_offer->fetchItems(items);
- if(catp || (itemp && itemp->isComplete()))
+ case IOR_ACCEPT:
+ // ACCEPT. The math for the dialog works, because the accept
+ // for inventory_offered, task_inventory_offer or
+ // group_notice_inventory is 1 greater than the offer integer value.
+ // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED,
+ // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED
+ msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1));
+ msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData),
+ sizeof(mFolderID.mData));
+ // send the message
+ msg->sendReliable(mHost);
+
+ //don't spam them if they are getting flooded
+ if (check_offer_throttle(mFromName, true))
{
- open_agent_offer->done();
+ log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString(".");
+ chat.mText = log_message;
+ LLFloaterChat::addChatHistory(chat);
}
- else
+
+ // we will want to open this item when it comes back.
+ LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID
+ << LL_ENDL;
+ switch (mIM)
+ {
+ case IM_TASK_INVENTORY_OFFERED:
+ case IM_GROUP_NOTICE:
+ case IM_GROUP_NOTICE_REQUESTED:
{
- opener = open_agent_offer;
+ // This is an offer from a task or group.
+ // We don't use a new instance of an opener
+ // We instead use the singular observer gOpenTaskOffer
+ // Since it already exists, we don't need to actually do anything
}
- }
+ break;
+ default:
+ LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL;
+ break;
+ } // end switch (mIM)
break;
- case IM_TASK_INVENTORY_OFFERED:
- case IM_GROUP_NOTICE:
- case IM_GROUP_NOTICE_REQUESTED:
- {
- // This is an offer from a task or group.
- // We don't use a new instance of an opener
- // We instead use the singular observer gOpenTaskOffer
- // Since it already exists, we don't need to actually do anything
- }
- break;
+
+ case IOR_BUSY:
+ //Busy falls through to decline. Says to make busy message.
+ busy=TRUE;
+ case IOR_MUTE:
+ // MUTE falls through to decline
+ case IOR_DECLINE:
+ // DECLINE. The math for the dialog works, because the decline
+ // for inventory_offered, task_inventory_offer or
+ // group_notice_inventory is 2 greater than the offer integer value.
+ // Generates IM_INVENTORY_DECLINED, IM_TASK_INVENTORY_DECLINED,
+ // or IM_GROUP_NOTICE_INVENTORY_DECLINED
default:
- LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL;
- break;
- } // end switch (mIM)
- break;
-
- case IOR_BUSY:
- //Busy falls through to decline. Says to make busy message.
- busy=TRUE;
- case IOR_MUTE:
- // MUTE falls through to decline
- case IOR_DECLINE:
- // DECLINE. The math for the dialog works, because the decline
- // for inventory_offered, task_inventory_offer or
- // group_notice_inventory is 2 greater than the offer integer value.
- // Generates IM_INVENTORY_DECLINED, IM_TASK_INVENTORY_DECLINED,
- // or IM_GROUP_NOTICE_INVENTORY_DECLINED
- default:
- // close button probably (or any of the fall-throughs from above)
- msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 2));
- msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE);
- // send the message
- msg->sendReliable(mHost);
-
- log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +".";
- chat.mText = log_message;
- if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269
- {
- chat.mMuted = TRUE;
- }
- LLFloaterChat::addChatHistory(chat);
-
- // If it's from an agent, we have to fetch the item to throw
- // it away. If it's from a task or group, just denying the
- // request will suffice to discard the item.
- if(IM_INVENTORY_OFFERED == mIM)
- {
- LLInventoryFetchComboObserver::folder_ref_t folders;
- LLInventoryFetchComboObserver::item_ref_t items;
- items.push_back(mObjectID);
- LLDiscardAgentOffer* discard_agent_offer;
- discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID);
- discard_agent_offer->fetch(folders, items);
- if(catp || (itemp && itemp->isComplete()))
+ // close button probably (or any of the fall-throughs from above)
+ msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 2));
+ msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE);
+ // send the message
+ msg->sendReliable(mHost);
+
+ log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +".";
+ chat.mText = log_message;
+ if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269
{
- discard_agent_offer->done();
+ chat.mMuted = TRUE;
}
- else
+ LLFloaterChat::addChatHistory(chat);
+
+ if (busy && (!mFromGroup && !mFromObject))
{
- opener = discard_agent_offer;
+ busy_message(msg,mFromID);
}
-
- }
- if (busy && (!mFromGroup && !mFromObject))
- {
- busy_message(msg,mFromID);
- }
- break;
- }
-
- if(IM_INVENTORY_OFFERED == mIM)
- {
- // add buddy to recent people list
- LLRecentPeople::instance().add(mFromID);
+ break;
}
-
+
if(opener)
{
gInventory.addObserver(opener);
}
-
+
delete this;
return false;
}
-
-void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
+void inventory_offer_handler(LLOfferInfo* info)
{
//Until throttling is implmented, busy mode should reject inventory instead of silently
//accepting it. SEE SL-39554
@@ -1367,19 +1505,46 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
payload["from_id"] = info->mFromID;
args["OBJECTFROMNAME"] = info->mFromName;
args["NAME"] = info->mFromName;
+ args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about");
+ std::string verb = "select?name=" + msg;
+ args["ITEM_SLURL"] = LLSLURL::buildCommand("inventory", info->mObjectID, verb.c_str());
LLNotification::Params p("ObjectGiveItem");
- p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, info, _1, _2));
- if (from_task)
+ // Object -> Agent Inventory Offer
+ if (info->mFromObject)
{
+ // Inventory Slurls don't currently work for non agent transfers, so only display the object name.
+ args["ITEM_SLURL"] = msg;
+ // Note: sets inventory_task_offer_callback as the callback
+ p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_task_offer_callback, info, _1, _2));
p.name = name_found ? "ObjectGiveItem" : "ObjectGiveItemUnknownUser";
}
- else
+ else // Agent -> Agent Inventory Offer
{
+ // Note: sets inventory_offer_callback as the callback
+ p.substitutions(args).payload(payload).functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, info, _1, _2));
p.name = "UserGiveItem";
+
+ // Prefetch the item into your local inventory.
+ LLInventoryFetchObserver::item_ref_t items;
+ items.push_back(info->mObjectID);
+ LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver();
+ fetch_item->fetchItems(items);
+ if(fetch_item->isEverythingComplete())
+ {
+ fetch_item->done();
+ }
+ else
+ {
+ gInventory.addObserver(fetch_item);
+ }
+
+ // 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);
}
@@ -1392,7 +1557,7 @@ bool lure_callback(const LLSD& notification, const LLSD& response)
}
else
{
- option = LLNotification::getSelectedOption(notification, response);
+ option = LLNotificationsUtil::getSelectedOption(notification, response);
}
LLUUID from_id = notification["payload"]["from_id"].asUUID();
@@ -1423,7 +1588,7 @@ static LLNotificationFunctorRegistration lure_callback_reg("TeleportOffered", lu
bool goto_url_callback(const LLSD& notification, const LLSD& response)
{
std::string url = notification["payload"]["url"].asString();
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if(1 == option)
{
LLWeb::loadURL(url);
@@ -1434,7 +1599,7 @@ static LLNotificationFunctorRegistration goto_url_callback_reg("GotoURL", goto_u
bool inspect_remote_object_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (0 == option)
{
LLFloaterReg::showInstance("inspect_remote_object", notification["payload"]);
@@ -1522,7 +1687,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// Note: don't put the message in the IM history, even though was sent
// via the IM mechanism.
- LLNotifications::instance().add("SystemMessageTip",args);
+ LLNotificationsUtil::add("SystemMessageTip",args);
break;
case IM_NOTHING_SPECIAL:
@@ -1594,7 +1759,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// Message to everyone from GOD
args["NAME"] = name;
args["MESSAGE"] = message;
- LLNotifications::instance().add("GodMessage", args);
+ LLNotificationsUtil::add("GodMessage", args);
// Treat like a system message and put in chat history.
// Claim to be from a local agent so it doesn't go into
@@ -1673,7 +1838,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// This is a block, modeless dialog.
//*TODO: Translate
args["MESSAGE"] = message;
- LLNotifications::instance().add("SystemMessage", args);
+ LLNotificationsUtil::add("SystemMessage", args);
}
break;
case IM_GROUP_NOTICE:
@@ -1806,7 +1971,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
LLSD args;
args["MESSAGE"] = message;
- LLNotifications::instance().add("JoinGroup", args, payload, join_group_response);
+ LLNotificationsUtil::add("JoinGroup", args, payload, join_group_response);
}
}
break;
@@ -1875,7 +2040,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
}
else
{
- inventory_offer_handler(info, dialog == IM_TASK_INVENTORY_OFFERED);
+ inventory_offer_handler(info);
}
}
break;
@@ -1883,13 +2048,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_INVENTORY_ACCEPTED:
{
args["NAME"] = name;
- LLNotifications::instance().add("InventoryAccepted", args);
+ LLNotificationsUtil::add("InventoryAccepted", args);
break;
}
case IM_INVENTORY_DECLINED:
{
args["NAME"] = name;
- LLNotifications::instance().add("InventoryDeclined", args);
+ LLNotificationsUtil::add("InventoryDeclined", args);
break;
}
// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856
@@ -1971,7 +2136,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
{
payload["groupowned"] = "true";
}
- LLNotifications::instance().add("ServerObjectMessage", substitutions, payload);
+ LLNotificationsUtil::add("ServerObjectMessage", substitutions, payload);
}
break;
case IM_FROM_TASK_AS_ALERT:
@@ -1983,7 +2148,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// Construct a viewer alert for this message.
args["NAME"] = name;
args["MESSAGE"] = message;
- LLNotifications::instance().add("ObjectMessage", args);
+ LLNotificationsUtil::add("ObjectMessage", args);
}
break;
case IM_BUSY_AUTO_RESPONSE:
@@ -2020,7 +2185,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
payload["from_id"] = from_id;
payload["lure_id"] = session_id;
payload["godlike"] = FALSE;
- LLNotifications::instance().add("TeleportOffered", args, payload);
+ LLNotificationsUtil::add("TeleportOffered", args, payload);
}
}
break;
@@ -2057,7 +2222,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
args["URL"] = url;
LLSD payload;
payload["url"] = url;
- LLNotifications::instance().add("GotoURL", args, payload );
+ LLNotificationsUtil::add("GotoURL", args, payload );
}
break;
@@ -2084,12 +2249,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
if(message.empty())
{
//support for frienship offers from clients before July 2008
- LLNotifications::instance().add("OfferFriendshipNoMessage", args, payload);
+ LLNotificationsUtil::add("OfferFriendshipNoMessage", args, payload);
}
else
{
args["[MESSAGE]"] = message;
- LLNotifications::instance().add("OfferFriendship", args, payload);
+ LLNotificationsUtil::add("OfferFriendship", args, payload);
}
}
}
@@ -2107,7 +2272,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
send_generic_message("requestonlinenotification", strings);
args["NAME"] = name;
- LLNotifications::instance().add("FriendshipAccepted", args);
+ LLSD payload;
+ payload["from_id"] = from_id;
+ LLNotificationsUtil::add("FriendshipAccepted", args, payload);
}
break;
@@ -2148,7 +2315,7 @@ void busy_message (LLMessageSystem* msg, LLUUID from_id)
bool callingcard_offer_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
LLUUID fid;
LLUUID from_id;
LLMessageSystem* msg = gMessageSystem;
@@ -2227,7 +2394,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**)
}
else
{
- LLNotifications::instance().add("OfferCallingCard", args, payload);
+ LLNotificationsUtil::add("OfferCallingCard", args, payload);
}
}
else
@@ -2238,12 +2405,12 @@ void process_offer_callingcard(LLMessageSystem* msg, void**)
void process_accept_callingcard(LLMessageSystem* msg, void**)
{
- LLNotifications::instance().add("CallingCardAccepted");
+ LLNotificationsUtil::add("CallingCardAccepted");
}
void process_decline_callingcard(LLMessageSystem* msg, void**)
{
- LLNotifications::instance().add("CallingCardDeclined");
+ LLNotificationsUtil::add("CallingCardDeclined");
}
@@ -2340,14 +2507,14 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
std::string prefix = mesg.substr(0, 4);
if (prefix == "/me " || prefix == "/me'")
{
- chat.mText = from_name;
- chat.mText += mesg.substr(3);
+// chat.mText = from_name;
+// chat.mText += mesg.substr(3);
ircstyle = TRUE;
}
- else
- {
+// else
+// {
chat.mText = mesg;
- }
+// }
// Look for the start of typing so we can put "..." in the bubbles.
if (CHAT_TYPE_START == chat.mChatType)
@@ -2373,19 +2540,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
return;
}
- // We have a real utterance now, so can stop showing "..." and proceed.
- if (chatter && chatter->isAvatar())
- {
- LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
- ((LLVOAvatar*)chatter)->stopTyping();
-
- if (!is_muted && !is_busy)
- {
- visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles");
- ((LLVOAvatar*)chatter)->addChat(chat);
- }
- }
-
// Look for IRC-style emotes
if (ircstyle)
{
@@ -2425,6 +2579,23 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
chat.mText += mesg;
}
+ // We have a real utterance now, so can stop showing "..." and proceed.
+ if (chatter && chatter->isAvatar())
+ {
+ LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
+ ((LLVOAvatar*)chatter)->stopTyping();
+
+ if (!is_muted && !is_busy)
+ {
+ visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles");
+ std::string formated_msg = "";
+ LLViewerChat::formatChatMsg(chat, formated_msg);
+ LLChat chat_bubble = chat;
+ chat_bubble.mText = formated_msg;
+ ((LLVOAvatar*)chatter)->addChat(chat_bubble);
+ }
+ }
+
if (chatter)
{
chat.mPosAgent = chatter->getPositionAgent();
@@ -2574,13 +2745,13 @@ public:
{ // Show notification that they can now teleport to landmarks. Use a random landmark from the inventory
S32 random_land = ll_rand( land_items.count() - 1 );
args["NAME"] = land_items[random_land]->getName();
- LLNotifications::instance().add("TeleportToLandmark",args);
+ LLNotificationsUtil::add("TeleportToLandmark",args);
}
if ( card_items.count() > 0 )
{ // Show notification that they can now contact people. Use a random calling card from the inventory
S32 random_card = ll_rand( card_items.count() - 1 );
args["NAME"] = card_items[random_card]->getName();
- LLNotifications::instance().add("TeleportToPerson",args);
+ LLNotificationsUtil::add("TeleportToPerson",args);
}
gInventory.removeObserver(this);
@@ -2957,7 +3128,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
LLSD args;
args["URL"] = url;
- LLNotifications::instance().add("ServerVersionChanged", args);
+ LLNotificationsUtil::add("ServerVersionChanged", args);
}
gLastVersionChannel = version_channel;
@@ -4176,7 +4347,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
// *TODO: Translate
LLSD args;
args["MESSAGE"] = desc;
- LLNotifications::instance().add("SystemMessage", args);
+ LLNotificationsUtil::add("SystemMessage", args);
// Once the 'recent' container gets large enough, chop some
// off the beginning.
@@ -4194,7 +4365,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
bool handle_special_notification_callback(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (0 == option)
{
@@ -4215,18 +4386,18 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
llsdBlock["REGIONMATURITY"] = LLViewerRegion::accessToString(regionAccess);
// we're going to throw the LLSD in there in case anyone ever wants to use it
- LLNotifications::instance().add(notificationID+"_Notify", llsdBlock);
+ LLNotificationsUtil::add(notificationID+"_Notify", llsdBlock);
if (regionAccess == SIM_ACCESS_MATURE)
{
if (gAgent.isTeen())
{
- LLNotifications::instance().add(notificationID+"_KB", llsdBlock);
+ LLNotificationsUtil::add(notificationID+"_KB", llsdBlock);
return true;
}
else if (gAgent.prefersPG())
{
- LLNotifications::instance().add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback);
+ LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback);
return true;
}
}
@@ -4234,12 +4405,12 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
{
if (!gAgent.isAdult())
{
- LLNotifications::instance().add(notificationID+"_KB", llsdBlock);
+ LLNotificationsUtil::add(notificationID+"_KB", llsdBlock);
return true;
}
else if (gAgent.prefersPG() || gAgent.prefersMature())
{
- LLNotifications::instance().add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback);
+ LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback);
return true;
}
}
@@ -4299,7 +4470,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
}
}
- LLNotifications::instance().add(notificationID, llsdBlock);
+ LLNotificationsUtil::add(notificationID, llsdBlock);
return true;
}
return false;
@@ -4365,14 +4536,14 @@ void process_alert_core(const std::string& message, BOOL modal)
// Allow the server to spawn a named alert so that server alerts can be
// translated out of English.
std::string alert_name(message.substr(ALERT_PREFIX.length()));
- LLNotifications::instance().add(alert_name);
+ LLNotificationsUtil::add(alert_name);
}
else if (message.find(NOTIFY_PREFIX) == 0)
{
// Allow the server to spawn a named notification so that server notifications can be
// translated out of English.
std::string notify_name(message.substr(NOTIFY_PREFIX.length()));
- LLNotifications::instance().add(notify_name);
+ LLNotificationsUtil::add(notify_name);
}
else if (message[0] == '/')
{
@@ -4384,20 +4555,20 @@ void process_alert_core(const std::string& message, BOOL modal)
S32 mins = 0;
LLStringUtil::convertToS32(text.substr(18), mins);
args["MINUTES"] = llformat("%d",mins);
- LLNotifications::instance().add("RegionRestartMinutes", args);
+ LLNotificationsUtil::add("RegionRestartMinutes", args);
}
else if (text.substr(0,17) == "RESTART_X_SECONDS")
{
S32 secs = 0;
LLStringUtil::convertToS32(text.substr(18), secs);
args["SECONDS"] = llformat("%d",secs);
- LLNotifications::instance().add("RegionRestartSeconds", args);
+ LLNotificationsUtil::add("RegionRestartSeconds", args);
}
else
{
std::string new_msg =LLNotifications::instance().getGlobalString(text);
args["MESSAGE"] = new_msg;
- LLNotifications::instance().add("SystemMessage", args);
+ LLNotificationsUtil::add("SystemMessage", args);
}
}
else if (modal)
@@ -4405,14 +4576,14 @@ void process_alert_core(const std::string& message, BOOL modal)
LLSD args;
std::string new_msg =LLNotifications::instance().getGlobalString(message);
args["ERROR_MESSAGE"] = new_msg;
- LLNotifications::instance().add("ErrorMessage", args);
+ LLNotificationsUtil::add("ErrorMessage", args);
}
else
{
LLSD args;
std::string new_msg =LLNotifications::instance().getGlobalString(message);
args["MESSAGE"] = new_msg;
- LLNotifications::instance().add("SystemMessageTip", args);
+ LLNotificationsUtil::add("SystemMessageTip", args);
}
}
@@ -4628,7 +4799,7 @@ void notify_cautioned_script_question(const LLSD& notification, const LLSD& resp
bool script_question_cb(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
LLMessageSystem *msg = gMessageSystem;
S32 orig = notification["payload"]["questions"].asInteger();
S32 new_questions = orig;
@@ -4692,10 +4863,10 @@ bool script_question_cb(const LLSD& notification, const LLSD& response)
if (response["Details"])
{
// respawn notification...
- LLNotifications::instance().add(notification["name"], notification["substitutions"], notification["payload"]);
+ LLNotificationsUtil::add(notification["name"], notification["substitutions"], notification["payload"]);
// ...with description on top
- LLNotifications::instance().add("DebitPermissionDetails");
+ LLNotificationsUtil::add("DebitPermissionDetails");
}
return false;
}
@@ -4792,12 +4963,12 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
{
// display the caution permissions prompt
- LLNotifications::instance().add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload);
+ LLNotificationsUtil::add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload);
}
else
{
// fall back to default behavior if cautions are entirely disabled
- LLNotifications::instance().add("ScriptQuestion", args, payload);
+ LLNotificationsUtil::add("ScriptQuestion", args, payload);
}
}
@@ -4834,8 +5005,7 @@ void container_inventory_arrived(LLViewerObject* object,
InventoryObjectList::const_iterator end = inventory->end();
for ( ; it != end; ++it)
{
- if ((*it)->getType() != LLAssetType::AT_CATEGORY &&
- (*it)->getType() != LLAssetType::AT_ROOT_CATEGORY)
+ if ((*it)->getType() != LLAssetType::AT_CATEGORY)
{
LLInventoryObject* obj = (LLInventoryObject*)(*it);
LLInventoryItem* item = (LLInventoryItem*)(obj);
@@ -4870,8 +5040,7 @@ void container_inventory_arrived(LLViewerObject* object,
// one actual object
InventoryObjectList::iterator it = inventory->begin();
- if ((*it)->getType() == LLAssetType::AT_CATEGORY ||
- (*it)->getType() == LLAssetType::AT_ROOT_CATEGORY)
+ if ((*it)->getType() == LLAssetType::AT_CATEGORY)
{
++it;
}
@@ -4999,7 +5168,7 @@ void process_teleport_failed(LLMessageSystem *msg, void**)
}
}
- LLNotifications::instance().add("CouldNotTeleportReason", args);
+ LLNotificationsUtil::add("CouldNotTeleportReason", args);
// Let the interested parties know that teleport failed.
LLViewerParcelMgr::getInstance()->onTeleportFailed();
@@ -5132,7 +5301,7 @@ void send_group_notice(const LLUUID& group_id,
bool handle_lure_callback(const LLSD& notification, const LLSD& response)
{
std::string text = response["message"].asString();
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if(0 == option)
{
@@ -5179,11 +5348,11 @@ void handle_lure(const std::vector<LLUUID>& ids)
}
if (gAgent.isGodlike())
{
- LLNotifications::instance().add("OfferTeleportFromGod", edit_args, payload, handle_lure_callback);
+ LLNotificationsUtil::add("OfferTeleportFromGod", edit_args, payload, handle_lure_callback);
}
else
{
- LLNotifications::instance().add("OfferTeleport", edit_args, payload, handle_lure_callback);
+ LLNotificationsUtil::add("OfferTeleport", edit_args, payload, handle_lure_callback);
}
}
@@ -5367,6 +5536,17 @@ void process_script_dialog(LLMessageSystem* msg, void**)
notification = LLNotifications::instance().add(
LLNotification::Params("ScriptDialogGroup").substitutions(args).payload(payload).form_elements(form.asLLSD()));
}
+
+ // "ScriptDialog" and "ScriptDialogGroup" are handles by LLScriptFloaterManager.
+ // We want to inform user that there is a script floater, lets add "ScriptToast"
+ LLNotification::Params p("ScriptToast");
+ p.substitutions(args).payload(payload).functor.function(boost::bind(
+ LLScriptFloaterManager::onToastButtonClick, _1, _2));
+
+ notification = LLNotifications::instance().add(p);
+
+ LLScriptFloaterManager::getInstance()->setNotificationToastId(
+ object_id, notification->getID());
}
//---------------------------------------------------------------------------
@@ -5376,7 +5556,7 @@ std::vector<LLSD> gLoadUrlList;
bool callback_load_url(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotification::getSelectedOption(notification, response);
+ S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (0 == option)
{
@@ -5421,7 +5601,7 @@ void callback_load_url_name(const LLUUID& id, const std::string& first, const st
args["OBJECTNAME"] = load_url_info["object_name"].asString();
args["NAME"] = owner_name;
- LLNotifications::instance().add("LoadWebPage", args, load_url_info);
+ LLNotificationsUtil::add("LoadWebPage", args, load_url_info);
}
else
{
@@ -5476,7 +5656,7 @@ void callback_download_complete(void** data, S32 result, LLExtStat ext_status)
std::string* filepath = (std::string*)data;
LLSD args;
args["DOWNLOAD_PATH"] = *filepath;
- LLNotifications::instance().add("FinishedRawDownload", args);
+ LLNotificationsUtil::add("FinishedRawDownload", args);
delete filepath;
}