summaryrefslogtreecommitdiff
path: root/indra/newview/lltooldraganddrop.cpp
diff options
context:
space:
mode:
authorAura Linden <aura@lindenlab.com>2014-07-22 18:23:48 -0700
committerAura Linden <aura@lindenlab.com>2014-07-22 18:23:48 -0700
commitf61671aec7a15160f906650b4c7449be68c7b074 (patch)
tree1c8f08f04d137f41c5b8cbf9a579161ff0dd3538 /indra/newview/lltooldraganddrop.cpp
parent3d4acb535d75c4cc78c93dee318bcffaca691237 (diff)
parent532433674c9553636af9ea8d433b9da6d6fae587 (diff)
Merged in release.
Diffstat (limited to 'indra/newview/lltooldraganddrop.cpp')
-rwxr-xr-xindra/newview/lltooldraganddrop.cpp90
1 files changed, 37 insertions, 53 deletions
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index d307a31843..eabf6f0497 100755
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1584,13 +1584,22 @@ static void give_inventory_cb(const LLSD& notification, const LLSD& response)
const LLUUID& session_id = payload["session_id"];
const LLUUID& agent_id = payload["agent_id"];
LLViewerInventoryItem * inv_item = gInventory.getItem(payload["item_id"]);
- if (NULL == inv_item)
+ LLViewerInventoryCategory * inv_cat = gInventory.getCategory(payload["item_id"]);
+ if (NULL == inv_item && NULL == inv_cat)
{
- llassert(NULL != inv_item);
+ llassert( FALSE );
return;
}
-
- if (LLGiveInventory::doGiveInventoryItem(agent_id, inv_item, session_id))
+ bool successfully_shared;
+ if (inv_item)
+ {
+ successfully_shared = LLGiveInventory::doGiveInventoryItem(agent_id, inv_item, session_id);
+ }
+ else
+ {
+ successfully_shared = LLGiveInventory::doGiveInventoryCategory(agent_id, inv_cat, session_id);
+ }
+ if (successfully_shared)
{
if ("avatarpicker" == payload["d&d_dest"].asString())
{
@@ -1600,8 +1609,8 @@ static void give_inventory_cb(const LLSD& notification, const LLSD& response)
}
}
-static void show_item_sharing_confirmation(const std::string name,
- LLViewerInventoryItem* inv_item,
+static void show_object_sharing_confirmation(const std::string name,
+ LLInventoryObject* inv_item,
const LLSD& dest,
const LLUUID& dest_agent,
const LLUUID& session_id = LLUUID::null)
@@ -1611,32 +1620,28 @@ static void show_item_sharing_confirmation(const std::string name,
llassert(NULL != inv_item);
return;
}
- if(gInventory.getItem(inv_item->getUUID())
- && LLGiveInventory::isInventoryGiveAcceptable(inv_item))
- {
- LLSD substitutions;
- substitutions["RESIDENTS"] = name;
- substitutions["ITEMS"] = inv_item->getName();
- LLSD payload;
- payload["agent_id"] = dest_agent;
- payload["item_id"] = inv_item->getUUID();
- payload["session_id"] = session_id;
- payload["d&d_dest"] = dest.asString();
- LLNotificationsUtil::add("ShareItemsConfirmation", substitutions, payload, &give_inventory_cb);
- }
+ LLSD substitutions;
+ substitutions["RESIDENTS"] = name;
+ substitutions["ITEMS"] = inv_item->getName();
+ LLSD payload;
+ payload["agent_id"] = dest_agent;
+ payload["item_id"] = inv_item->getUUID();
+ payload["session_id"] = session_id;
+ payload["d&d_dest"] = dest.asString();
+ LLNotificationsUtil::add("ShareItemsConfirmation", substitutions, payload, &give_inventory_cb);
}
static void get_name_cb(const LLUUID& id,
const std::string& full_name,
- LLViewerInventoryItem* inv_item,
+ LLInventoryObject* inv_obj,
const LLSD& dest,
const LLUUID& dest_agent)
{
- show_item_sharing_confirmation(full_name,
- inv_item,
- dest,
- id,
- LLUUID::null);
+ show_object_sharing_confirmation(full_name,
+ inv_obj,
+ dest,
+ id,
+ LLUUID::null);
}
// function used as drag-and-drop handler for simple agent give inventory requests
@@ -1662,10 +1667,11 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
case DAD_GESTURE:
case DAD_CALLINGCARD:
case DAD_MESH:
+ case DAD_CATEGORY:
{
- LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
- if(gInventory.getItem(inv_item->getUUID())
- && LLGiveInventory::isInventoryGiveAcceptable(inv_item))
+ LLInventoryObject* inv_obj = (LLInventoryObject*)cargo_data;
+ if(gInventory.getCategory(inv_obj->getUUID()) || (gInventory.getItem(inv_obj->getUUID())
+ && LLGiveInventory::isInventoryGiveAcceptable(dynamic_cast<LLInventoryItem*>(inv_obj))))
{
// *TODO: get multiple object transfers working
*accept = ACCEPT_YES_COPY_SINGLE;
@@ -1682,40 +1688,18 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
// Otherwise set up a callback to show the dialog when the name arrives.
if (gCacheName->getFullName(dest_agent, fullname))
{
- show_item_sharing_confirmation(fullname, inv_item, dest, dest_agent, LLUUID::null);
+ show_object_sharing_confirmation(fullname, inv_obj, dest, dest_agent, LLUUID::null);
}
else
{
- gCacheName->get(dest_agent, false, boost::bind(&get_name_cb, _1, _2, inv_item, dest, dest_agent));
+ gCacheName->get(dest_agent, false, boost::bind(&get_name_cb, _1, _2, inv_obj, dest, dest_agent));
}
return true;
}
// If an IM session with destination agent is found item offer will be logged in this session.
- show_item_sharing_confirmation(session->mName, inv_item, dest, dest_agent, session_id);
- }
- }
- else
- {
- // It's not in the user's inventory (it's probably
- // in an object's contents), so disallow dragging
- // it here. You can't give something you don't
- // yet have.
- *accept = ACCEPT_NO;
- }
- break;
- }
- case DAD_CATEGORY:
- {
- LLViewerInventoryCategory* inv_cat = (LLViewerInventoryCategory*)cargo_data;
- if( gInventory.getCategory( inv_cat->getUUID() ) )
- {
- // *TODO: get multiple object transfers working
- *accept = ACCEPT_YES_COPY_SINGLE;
- if(drop)
- {
- LLGiveInventory::doGiveInventoryCategory(dest_agent, inv_cat, session_id);
+ show_object_sharing_confirmation(session->mName, inv_obj, dest, dest_agent, session_id);
}
}
else