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.cpp50
1 files changed, 16 insertions, 34 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 68745d5aeb..6435904fee 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1299,29 +1299,12 @@ bool highlight_offered_object(const LLUUID& obj_id)
void inventory_offer_mute_callback(const LLUUID& blocked_id,
const std::string& full_name,
- bool is_group,
- boost::shared_ptr<LLNotificationResponderInterface> offer_ptr)
+ bool is_group)
{
- LLOfferInfo* offer = dynamic_cast<LLOfferInfo*>(offer_ptr.get());
-
- std::string from_name = full_name;
- LLMute::EType type;
- if (is_group)
- {
- type = LLMute::GROUP;
- }
- else if(offer && offer->mFromObject)
- {
- //we have to block object by name because blocked_id is an id of owner
- type = LLMute::BY_NAME;
- }
- else
- {
- type = LLMute::AGENT;
- }
+ // *NOTE: blocks owner if the offer came from an object
+ LLMute::EType mute_type = is_group ? LLMute::GROUP : LLMute::AGENT;
- // id should be null for BY_NAME mute, see LLMuteList::add for details
- LLMute mute(type == LLMute::BY_NAME ? LLUUID::null : blocked_id, from_name, type);
+ LLMute mute(blocked_id, full_name, mute_type);
if (LLMuteList::getInstance()->add(mute))
{
LLPanelBlockedList::showPanelAndSelect(blocked_id);
@@ -1335,6 +1318,7 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id,
bool matches(const LLNotificationPtr notification) const
{
if(notification->getName() == "ObjectGiveItem"
+ || notification->getName() == "OwnObjectGiveItem"
|| notification->getName() == "UserGiveItem")
{
return (notification->getPayload()["from_id"].asUUID() == blocked_id);
@@ -1495,7 +1479,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
llassert(notification_ptr != NULL);
if (notification_ptr != NULL)
{
- gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,notification_ptr->getResponderPtr()));
+ gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback, _1, _2, _3));
}
}
@@ -1640,7 +1624,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const
llassert(notification_ptr != NULL);
if (notification_ptr != NULL)
{
- gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,notification_ptr->getResponderPtr()));
+ gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback, _1, _2, _3));
}
}
@@ -1818,6 +1802,7 @@ void LLOfferInfo::initRespondFunctionMap()
if(mRespondFunctions.empty())
{
mRespondFunctions["ObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
+ mRespondFunctions["OwnObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
mRespondFunctions["UserGiveItem"] = boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2);
}
}
@@ -1905,7 +1890,7 @@ void inventory_offer_handler(LLOfferInfo* info)
std::string verb = "select?name=" + LLURI::escape(msg);
args["ITEM_SLURL"] = LLSLURL("inventory", info->mObjectID, verb.c_str()).getSLURLString();
- LLNotification::Params p("ObjectGiveItem");
+ LLNotification::Params p;
// Object -> Agent Inventory Offer
if (info->mFromObject)
@@ -1915,7 +1900,10 @@ void inventory_offer_handler(LLOfferInfo* info)
// Note: sets inventory_task_offer_callback as the callback
p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
info->mPersist = true;
- p.name = "ObjectGiveItem";
+
+ // Offers from your own objects need a special notification template.
+ p.name = info->mFromID == gAgentID ? "OwnObjectGiveItem" : "ObjectGiveItem";
+
// Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory.
LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == TRUE);
}
@@ -2594,8 +2582,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0];
info->mType = (LLAssetType::EType) bucketp->asset_type;
info->mObjectID = bucketp->object_id;
+ info->mFromObject = FALSE;
}
- else
+ else // IM_TASK_INVENTORY_OFFERED
{
if (sizeof(S8) != binary_bucket_size)
{
@@ -2605,6 +2594,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
}
info->mType = (LLAssetType::EType) binary_bucket[0];
info->mObjectID = LLUUID::null;
+ info->mFromObject = TRUE;
}
info->mIM = dialog;
@@ -2613,14 +2603,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
info->mTransactionID = session_id;
info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType));
- if (dialog == IM_TASK_INVENTORY_OFFERED)
- {
- info->mFromObject = TRUE;
- }
- else
- {
- info->mFromObject = FALSE;
- }
info->mFromName = name;
info->mDesc = message;
info->mHost = msg->getSender();