* Support for CreateInventoryCategory capability; backported from V3 by Henri Beauchamp (Cool VL)

Sun, 15 Jan 2012 13:43:22 +0100

author
Ansariel
date
Sun, 15 Jan 2012 13:43:22 +0100
changeset 1617
afcaf62a83c8
parent 1616
d5a1e93aefb9
child 1618
2c0488ac9fa0

* Support for CreateInventoryCategory capability; backported from V3 by Henri Beauchamp (Cool VL)
* Bugfixes to and further migration of inventory code from V3; from Henri Beauchamp (Cool VL)
* Backported option to give away calling cards, by Henri Beauchamp (Cool VL)

indra/newview/cofmgr.cpp file | annotate | diff | revisions
indra/newview/llfloatercustomize.cpp file | annotate | diff | revisions
indra/newview/llfloateropenobject.cpp file | annotate | diff | revisions
indra/newview/llfloateropenobject.h file | annotate | diff | revisions
indra/newview/llfloaterproperties.cpp file | annotate | diff | revisions
indra/newview/llinventoryactions.cpp file | annotate | diff | revisions
indra/newview/llinventorybridge.cpp file | annotate | diff | revisions
indra/newview/llinventorymodel.cpp file | annotate | diff | revisions
indra/newview/llinventorymodel.h file | annotate | diff | revisions
indra/newview/llinventorymodelbackgroundfetch.cpp file | annotate | diff | revisions
indra/newview/llpreview.cpp file | annotate | diff | revisions
indra/newview/llpreviewgesture.cpp file | annotate | diff | revisions
indra/newview/llpreviewscript.cpp file | annotate | diff | revisions
indra/newview/lltooldraganddrop.cpp file | annotate | diff | revisions
indra/newview/lltooldraganddrop.h file | annotate | diff | revisions
indra/newview/llurldispatcher.cpp file | annotate | diff | revisions
indra/newview/llurldispatcher.h file | annotate | diff | revisions
indra/newview/llviewerinventory.cpp file | annotate | diff | revisions
indra/newview/llviewerinventory.h file | annotate | diff | revisions
indra/newview/llviewermenu.cpp file | annotate | diff | revisions
indra/newview/llviewermessage.cpp file | annotate | diff | revisions
indra/newview/llviewerregion.cpp file | annotate | diff | revisions
indra/newview/llwearable.cpp file | annotate | diff | revisions
indra/newview/rlvinventory.cpp file | annotate | diff | revisions
indra/newview/rlvviewer2.cpp file | annotate | diff | revisions
     1.1 --- a/indra/newview/cofmgr.cpp	Sat Jan 07 17:05:31 2012 +0100
     1.2 +++ b/indra/newview/cofmgr.cpp	Sun Jan 15 13:43:22 2012 +0100
     1.3 @@ -218,7 +218,7 @@
     1.4  
     1.5  		LLCOFFetcher* pFetcher = new LLCOFFetcher();
     1.6  		pFetcher->fetchDescendents(fetchFolders);
     1.7 -		if (pFetcher->isEverythingComplete())
     1.8 +		if (pFetcher->isFinished())
     1.9  			pFetcher->done();
    1.10  		else
    1.11  			gInventory.addObserver(pFetcher);
     2.1 --- a/indra/newview/llfloatercustomize.cpp	Sat Jan 07 17:05:31 2012 +0100
     2.2 +++ b/indra/newview/llfloatercustomize.cpp	Sun Jan 15 13:43:22 2012 +0100
     2.3 @@ -596,7 +596,7 @@
     2.4  		if(item)
     2.5  		{
     2.6  			perm_mask = item->getPermissions().getMaskOwner();
     2.7 -			is_complete = item->isComplete();
     2.8 +			is_complete = item->isFinished();
     2.9  		}
    2.10  		setUIPermissions(perm_mask, is_complete);
    2.11  		BOOL editable = ((perm_mask & PERM_MODIFY) && is_complete) ? TRUE : FALSE;
    2.12 @@ -954,7 +954,7 @@
    2.13  		const LLPermissions& perm = item->getPermissions();
    2.14  		is_modifiable = perm.allowModifyBy(gAgent.getID(), gAgent.getGroupID());
    2.15  		is_copyable = perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID());
    2.16 -		is_complete = item->isComplete();
    2.17 +		is_complete = item->isFinished();
    2.18  	}
    2.19  
    2.20  	childSetEnabled("Save", is_modifiable && is_complete && has_wearable && is_dirty);
    2.21 @@ -2642,7 +2642,7 @@
    2.22  		}
    2.23  		if(item)
    2.24  		{
    2.25 -			is_complete = item->isComplete();
    2.26 +			is_complete = item->isFinished();
    2.27  			if(!is_complete)
    2.28  			{
    2.29  				all_complete = FALSE;
    2.30 @@ -2684,7 +2684,7 @@
    2.31  		if(item)
    2.32  		{
    2.33  			U32 perm_mask = item->getPermissions().getMaskOwner();
    2.34 -			BOOL is_complete = item->isComplete();
    2.35 +			BOOL is_complete = item->isFinished();
    2.36  			updateScrollingPanelList((perm_mask & PERM_MODIFY) ? is_complete : FALSE);
    2.37  		}
    2.38  	}
     3.1 --- a/indra/newview/llfloateropenobject.cpp	Sat Jan 07 17:05:31 2012 +0100
     3.2 +++ b/indra/newview/llfloateropenobject.cpp	Sun Jan 15 13:43:22 2012 +0100
     3.3 @@ -155,29 +155,70 @@
     3.4  	{
     3.5  		parent_category_id = gInventory.getRootFolderID();
     3.6  	}
     3.7 -	LLUUID category_id = gInventory.createNewCategory(parent_category_id, 
     3.8 -		LLFolderType::FT_NONE, 
     3.9 -		name);
    3.10  
    3.11 -	LLCatAndWear* data = new LLCatAndWear;
    3.12 -	data->mCatID = category_id;
    3.13 -	data->mWear = wear;
    3.14 +	LLCategoryCreate* cat_data = new LLCategoryCreate(object_id, wear);
    3.15 +	LLUUID category_id = gInventory.createNewCategory(parent_category_id,
    3.16 +													  LLFolderType::FT_NONE,
    3.17 +													  name,
    3.18 +													  callbackCreateInventoryCategory,
    3.19 +													  (void*)cat_data);
    3.20  
    3.21 -	// Copy and/or move the items into the newly created folder.
    3.22 -	// Ignore any "you're going to break this item" messages.
    3.23 -	BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE,
    3.24 -													callbackMoveInventory, 
    3.25 -													(void*)data);
    3.26 -	if (!success)
    3.27 +	// If we get a null category ID, we are using a capability in
    3.28 +	// createNewCategory and we will handle the following in the
    3.29 +	// callbackCreateInventoryCategory routine.
    3.30 +	if (category_id.notNull())
    3.31  	{
    3.32 -		delete data;
    3.33 -		data = NULL;
    3.34 +		delete cat_data;
    3.35  
    3.36 -		LLNotifications::instance().add("OpenObjectCannotCopy");
    3.37 +		LLCatAndWear* data = new LLCatAndWear;
    3.38 +		data->mCatID = category_id;
    3.39 +		data->mWear = wear;
    3.40 +		data->mFolderResponded = false;
    3.41 +
    3.42 +		// Copy and/or move the items into the newly created folder.
    3.43 +		// Ignore any "you're going to break this item" messages.
    3.44 +		BOOL success = move_inv_category_world_to_agent(object_id, category_id, TRUE,
    3.45 +														callbackMoveInventory, 
    3.46 +														(void*)data);
    3.47 +		if (!success)
    3.48 +		{
    3.49 +			delete data;
    3.50 +			data = NULL;
    3.51 +
    3.52 +			LLNotifications::instance().add("OpenObjectCannotCopy");
    3.53 +		}
    3.54  	}
    3.55  }
    3.56  
    3.57  // static
    3.58 +void LLFloaterOpenObject::callbackCreateInventoryCategory(const LLSD& result, void* data)
    3.59 +{
    3.60 +	LLCategoryCreate* cat_data = (LLCategoryCreate*)data;
    3.61 +
    3.62 +	LLUUID category_id = result["folder_id"].asUUID();
    3.63 +	LLCatAndWear* wear_data = new LLCatAndWear;
    3.64 +
    3.65 +	wear_data->mCatID = category_id;
    3.66 +	wear_data->mWear = cat_data->mWear;
    3.67 +	wear_data->mFolderResponded = true;
    3.68 +
    3.69 + 	// Copy and/or move the items into the newly created folder.
    3.70 + 	// Ignore any "you're going to break this item" messages.
    3.71 +
    3.72 +	BOOL success = move_inv_category_world_to_agent(cat_data->mObjectID, category_id, TRUE,
    3.73 + 													callbackMoveInventory, 
    3.74 +													(void*)wear_data);
    3.75 + 	if (!success)
    3.76 + 	{
    3.77 +		delete wear_data;
    3.78 +		wear_data = NULL;
    3.79 +
    3.80 + 		LLNotifications::instance().add("OpenObjectCannotCopy");
    3.81 + 	}
    3.82 +	delete cat_data;	
    3.83 + }
    3.84 +
    3.85 +// static
    3.86  void LLFloaterOpenObject::callbackMoveInventory(S32 result, void* data)
    3.87  {
    3.88  	LLCatAndWear* cat = (LLCatAndWear*)data;
     4.1 --- a/indra/newview/llfloateropenobject.h	Sat Jan 07 17:05:31 2012 +0100
     4.2 +++ b/indra/newview/llfloateropenobject.h	Sun Jan 15 13:43:22 2012 +0100
     4.3 @@ -50,10 +50,24 @@
     4.4  	static void show();
     4.5  	static void dirty();
     4.6  	
     4.7 +	class LLCategoryCreate
     4.8 +	{
     4.9 +		public:
    4.10 +			LLCategoryCreate(LLUUID object_id, bool wear)
    4.11 +			:	mObjectID(object_id),
    4.12 +				mWear(wear)
    4.13 +			{}
    4.14 +
    4.15 +		public:
    4.16 +			LLUUID mObjectID;
    4.17 +			bool mWear;
    4.18 +	};
    4.19 +
    4.20  	struct LLCatAndWear
    4.21  	{
    4.22  		LLUUID mCatID;
    4.23  		bool mWear;
    4.24 +		bool mFolderResponded;
    4.25  	};
    4.26  
    4.27  protected:
    4.28 @@ -67,6 +81,7 @@
    4.29  
    4.30  	static void onClickMoveToInventory(void* data);
    4.31  	static void onClickMoveAndWear(void* data);
    4.32 +	static void callbackCreateInventoryCategory(const LLSD& result, void* data);
    4.33  	static void callbackMoveInventory(S32 result, void* data);
    4.34  	static void* createPanelInventory(void* data);
    4.35  
     5.1 --- a/indra/newview/llfloaterproperties.cpp	Sat Jan 07 17:05:31 2012 +0100
     5.2 +++ b/indra/newview/llfloaterproperties.cpp	Sun Jan 15 13:43:22 2012 +0100
     5.3 @@ -289,7 +289,7 @@
     5.4  
     5.5  	// do not enable the UI for incomplete items.
     5.6  	LLViewerInventoryItem* i = (LLViewerInventoryItem*)item;
     5.7 -	BOOL is_complete = i->isComplete();
     5.8 +	BOOL is_complete = i->isFinished();
     5.9  
    5.10  	const LLPermissions& perm = item->getPermissions();
    5.11  	BOOL can_agent_manipulate = gAgent.allowOperation(PERM_OWNER, perm, 
    5.12 @@ -753,7 +753,7 @@
    5.13  							CheckNextOwnerTransfer->get(), PERM_TRANSFER);
    5.14  	}
    5.15  	if(perm != item->getPermissions()
    5.16 -		&& item->isComplete())
    5.17 +		&& item->isFinished())
    5.18  	{
    5.19  		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
    5.20  		new_item->setPermissions(perm);
    5.21 @@ -889,7 +889,7 @@
    5.22  		sale_info.setSaleType(LLSaleInfo::FS_NOT);
    5.23  	}
    5.24  	if(sale_info != item->getSaleInfo()
    5.25 -		&& item->isComplete())
    5.26 +		&& item->isFinished())
    5.27  	{
    5.28  		LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
    5.29  
     6.1 --- a/indra/newview/llinventoryactions.cpp	Sat Jan 07 17:05:31 2012 +0100
     6.2 +++ b/indra/newview/llinventoryactions.cpp	Sun Jan 15 13:43:22 2012 +0100
     6.3 @@ -791,7 +791,7 @@
     6.4  		{
     6.5  			rez_attachment(item, attachmentp);
     6.6  		}
     6.7 -		else if(item && item->isComplete())
     6.8 +		else if(item && item->isFinished())
     6.9  		{
    6.10  			// must be in library. copy it to our inventory and put it on.
    6.11  			LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(attachmentp);
     7.1 --- a/indra/newview/llinventorybridge.cpp	Sat Jan 07 17:05:31 2012 +0100
     7.2 +++ b/indra/newview/llinventorybridge.cpp	Sun Jan 15 13:43:22 2012 +0100
     7.3 @@ -1021,7 +1021,7 @@
     7.4  void LLItemBridge::selectItem()
     7.5  {
     7.6  	LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem();
     7.7 -	if(item && !item->isComplete())
     7.8 +	if(item && !item->isFinished())
     7.9  	{
    7.10  		item->fetchFromServer();
    7.11  	}
    7.12 @@ -1866,7 +1866,7 @@
    7.13  	outfit->fetchItems(ids);
    7.14  	outfit->done();				//Not interested in waiting and this will be right 99% of the time.
    7.15  //Uncomment the following code for laggy Inventory UI.
    7.16 -/*	if(outfit->isEverythingComplete())
    7.17 +/*	if(outfit->isFinished())
    7.18  	{
    7.19  		// everything is already here - call done.
    7.20  		outfit->done();
    7.21 @@ -1889,14 +1889,20 @@
    7.22  class LLInventoryCopyAndWearObserver : public LLInventoryObserver
    7.23  {
    7.24  public:
    7.25 -	LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count) :mCatID(cat_id), mContentsCount(count), mFolderAdded(FALSE) {}
    7.26 +	LLInventoryCopyAndWearObserver(const LLUUID& cat_id,
    7.27 +								   int count,
    7.28 +								   bool folder_added = false)
    7.29 +	:	mCatID(cat_id),
    7.30 +		mContentsCount(count),
    7.31 +		mFolderAdded(folder_added)
    7.32 +	{}
    7.33  	virtual ~LLInventoryCopyAndWearObserver() {}
    7.34  	virtual void changed(U32 mask);
    7.35  
    7.36  protected:
    7.37  	LLUUID mCatID;
    7.38  	int    mContentsCount;
    7.39 -	BOOL   mFolderAdded;
    7.40 +	bool   mFolderAdded;
    7.41  };
    7.42  
    7.43  
    7.44 @@ -2388,7 +2394,7 @@
    7.45  		folders.push_back(category->getUUID());
    7.46  		fetch->fetchDescendents(folders);
    7.47  		inc_busy_count();
    7.48 -		if (fetch->isEverythingComplete())
    7.49 +		if (fetch->isFinished())
    7.50  		{
    7.51  			// everything is already here - call done.
    7.52  			fetch->done();
    7.53 @@ -2608,13 +2614,16 @@
    7.54  
    7.55  	if(option == 0 && object)
    7.56  	{
    7.57 -		if (cat_and_wear && cat_and_wear->mWear)
    7.58 +		if (cat_and_wear && cat_and_wear->mWear) // && !cat_and_wear->mFolderResponded)
    7.59  		{
    7.60  			InventoryObjectList inventory_objects;
    7.61  			object->getInventoryContents(inventory_objects);
    7.62  			int contents_count = inventory_objects.size()-1; //subtract one for containing folder
    7.63  
    7.64 -			LLInventoryCopyAndWearObserver* inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID, contents_count);
    7.65 +			LLInventoryCopyAndWearObserver* inventoryObserver;
    7.66 +			inventoryObserver = new LLInventoryCopyAndWearObserver(cat_and_wear->mCatID,
    7.67 +																   contents_count,
    7.68 +																   cat_and_wear->mFolderResponded);
    7.69  			gInventory.addObserver(inventoryObserver);
    7.70  		}
    7.71  
    7.72 @@ -2831,7 +2840,7 @@
    7.73  	else if (LLToolDragAndDrop::SOURCE_LIBRARY == source)
    7.74  	{
    7.75  		LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item;
    7.76 -		if (item && item->isComplete())
    7.77 +		if (item && item->isFinished())
    7.78  		{
    7.79  			accept = TRUE;
    7.80  			if (drop)
    7.81 @@ -3882,7 +3891,7 @@
    7.82  		{
    7.83  			rez_attachment(item, NULL, replace);
    7.84  		}
    7.85 -		else if(item && item->isComplete())
    7.86 +		else if(item && item->isFinished())
    7.87  		{
    7.88  			// must be in library. copy it to our inventory and put it on.
    7.89  			LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0, replace);
    7.90 @@ -3971,7 +3980,7 @@
    7.91  		{
    7.92  			rez_attachment(item, NULL);
    7.93  		}
    7.94 -		else if(item && item->isComplete())
    7.95 +		else if(item && item->isFinished())
    7.96  		{
    7.97  			// must be in library. copy it to our inventory and put it on.
    7.98  			LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0);
    7.99 @@ -4511,6 +4520,8 @@
   7.100  									item->getUUID(), cat_id, std::string(), cb);
   7.101  			}
   7.102  		}
   7.103 +		// BAP fixes a lag in display of created dir.
   7.104 +		gInventory.notifyObservers();
   7.105  	}
   7.106  	else
   7.107  	{
   7.108 @@ -4573,7 +4584,7 @@
   7.109  
   7.110  	// do the fetch
   7.111  	outfit->fetchItems(ids);
   7.112 -	if(outfit->isEverythingComplete())
   7.113 +	if(outfit->isFinished())
   7.114  	{
   7.115  		// everything is already here - call done.
   7.116  		outfit->done();
   7.117 @@ -4648,7 +4659,7 @@
   7.118  	folders.push_back(category->getUUID());
   7.119  	outfit->fetchDescendents(folders);
   7.120  	inc_busy_count();
   7.121 -	if(outfit->isEverythingComplete())
   7.122 +	if(outfit->isFinished())
   7.123  	{
   7.124  		// everything is already here - call done.
   7.125  		outfit->done();
   7.126 @@ -5185,7 +5196,7 @@
   7.127  		// must be in the inventory library. copy it to our inventory
   7.128  		// and put it on right away.
   7.129  		LLViewerInventoryItem* item = getItem();
   7.130 -		if(item && item->isComplete())
   7.131 +		if(item && item->isFinished())
   7.132  		{
   7.133  			LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
   7.134  			copy_inventory_item(
   7.135 @@ -5292,7 +5303,7 @@
   7.136  	if(!self->isAgentInventory())
   7.137  	{
   7.138  		LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
   7.139 -		if(!item || !item->isComplete()) return FALSE;
   7.140 +		if(!item || !item->isFinished()) return FALSE;
   7.141  	}
   7.142  	return (!gAgent.isWearingItem(self->mUUID));
   7.143  }
     8.1 --- a/indra/newview/llinventorymodel.cpp	Sat Jan 07 17:05:31 2012 +0100
     8.2 +++ b/indra/newview/llinventorymodel.cpp	Sun Jan 15 13:43:22 2012 +0100
     8.3 @@ -32,8 +32,6 @@
     8.4  
     8.5  #include "llviewerprecompiledheaders.h"
     8.6  
     8.7 -#include <deque>
     8.8 -
     8.9  #include "llinventorymodel.h"
    8.10  
    8.11  #include "lldir.h"
    8.12 @@ -42,7 +40,6 @@
    8.13  #include "llagent.h"
    8.14  #include "llappviewer.h"
    8.15  #include "llcallbacklist.h"
    8.16 -#include "llfloater.h"
    8.17  #include "llinventoryview.h"
    8.18  #include "llmutelist.h"
    8.19  #include "llpreview.h"
    8.20 @@ -59,9 +56,6 @@
    8.21  #include "rlvhandler.h"
    8.22  // [/RLVa:KB]
    8.23  
    8.24 -// RN: for some reason, using std::queue in the header file confuses the compiler which thinks it's an xmlrpc_queue
    8.25 -static std::deque<LLUUID> sFetchQueue;
    8.26 -
    8.27  // Increment this if the inventory contents change in a non-backwards-compatible way.
    8.28  // For viewers with link items support, former caches are incorrect.
    8.29  const S32 LLInventoryModel::sCurrentInvCacheVersion = 2;
    8.30 @@ -388,13 +382,64 @@
    8.31  	return LLUUID::null;
    8.32  }
    8.33  
    8.34 +class LLCreateInventoryCategoryResponder : public LLHTTPClient::Responder
    8.35 +{
    8.36 +public:
    8.37 +	LLCreateInventoryCategoryResponder(LLInventoryModel* model, 
    8.38 +									   void (*callback)(const LLSD&, void*),
    8.39 +									   void* user_data)
    8.40 +	:	mModel(model),
    8.41 +		mCallback(callback), 
    8.42 +		mData(user_data) 
    8.43 +	{
    8.44 +	}
    8.45 +
    8.46 +	virtual void error(U32 status, const std::string& reason)
    8.47 +	{
    8.48 +		llwarns << "CreateInventoryCategory failed. status = " << status
    8.49 +				<< ", reason = \"" << reason << "\"" << llendl;
    8.50 +	}
    8.51 +
    8.52 +	virtual void result(const LLSD& content)
    8.53 +	{
    8.54 +		// Server has created folder.
    8.55 +
    8.56 +		LLUUID category_id = content["folder_id"].asUUID();
    8.57 +
    8.58 +		// Add the category to the internal representation
    8.59 +		LLPointer<LLViewerInventoryCategory> cat;
    8.60 +		cat = new LLViewerInventoryCategory(category_id,
    8.61 +											content["parent_id"].asUUID(),
    8.62 +											(LLFolderType::EType)content["type"].asInteger(),
    8.63 +											content["name"].asString(), 
    8.64 +											gAgent.getID());
    8.65 +		cat->setVersion(LLViewerInventoryCategory::VERSION_INITIAL);
    8.66 +		cat->setDescendentCount(0);
    8.67 +		LLInventoryModel::LLCategoryUpdate update(cat->getParentUUID(), 1);
    8.68 +		mModel->accountForUpdate(update);
    8.69 +		mModel->updateCategory(cat);
    8.70 +
    8.71 +		if (mCallback && mData)
    8.72 +		{
    8.73 +			mCallback(content, mData);
    8.74 +		}
    8.75 +	}
    8.76 +
    8.77 +private:
    8.78 +	void (*mCallback)(const LLSD&, void*);
    8.79 +	void* mData;
    8.80 +	LLInventoryModel* mModel;
    8.81 +};
    8.82 +
    8.83  // Convenience function to create a new category. You could call
    8.84  // updateCategory() with a newly generated UUID category, but this
    8.85  // version will take care of details like what the name should be
    8.86  // based on preferred type. Returns the UUID of the new category.
    8.87  LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id,
    8.88  										   LLFolderType::EType preferred_type,
    8.89 -										   const std::string& pname)
    8.90 +										   const std::string& pname,
    8.91 +										   void (*callback)(const LLSD&, void*),
    8.92 +										   void* user_data)
    8.93  {
    8.94  	LLUUID id;
    8.95  	if(!isInventoryUsable())
    8.96 @@ -420,6 +465,37 @@
    8.97  		name.assign(LLViewerFolderType::lookupNewCategoryName(preferred_type));
    8.98  	}
    8.99  
   8.100 +	if (callback && user_data)  // callback required for acked message.
   8.101 +	{
   8.102 +		LLViewerRegion* viewer_region = gAgent.getRegion();
   8.103 +		std::string url;
   8.104 +		if (viewer_region)
   8.105 +		{
   8.106 +			url = viewer_region->getCapability("CreateInventoryCategory");
   8.107 +		}
   8.108 +	
   8.109 +		if (!url.empty())
   8.110 +		{
   8.111 +			LL_DEBUGS("Inventory") << "Using the CreateInventoryCategory capability."
   8.112 +								   << LL_ENDL;
   8.113 +			// Let's use the new capability.
   8.114 +			LLSD request, body;
   8.115 +			body["folder_id"] = id;
   8.116 +			body["parent_id"] = parent_id;
   8.117 +			body["type"] = (LLSD::Integer) preferred_type;
   8.118 +			body["name"] = name;
   8.119 +
   8.120 +			request["message"] = "CreateInventoryCategory";
   8.121 +			request["payload"] = body;
   8.122 +
   8.123 +			LLHTTPClient::post(url, body,
   8.124 +							   new LLCreateInventoryCategoryResponder(this,
   8.125 +																	  callback,
   8.126 +																	  user_data));
   8.127 +			return LLUUID::null;
   8.128 +		}
   8.129 +	}
   8.130 +
   8.131  	// Add the category to the internal representation
   8.132  	LLPointer<LLViewerInventoryCategory> cat =
   8.133  		new LLViewerInventoryCategory(id, parent_id, preferred_type, name, gAgent.getID());
   8.134 @@ -1192,10 +1268,7 @@
   8.135  	}
   8.136  }
   8.137  
   8.138 -//If we get back a normal response, handle it here
   8.139 -// Note: this is the responder used in "fetchInventory" cap, 
   8.140 -// this is not responder for "WebFetchInventoryDescendents" or "agent/inventory" cap
   8.141 -
   8.142 +// If we get back a normal response, handle it here
   8.143  void  LLInventoryModel::fetchInventoryResponder::result(const LLSD& content)
   8.144  {	
   8.145  	start_new_inventory_observer();
   8.146 @@ -2616,7 +2689,7 @@
   8.147  		//		<< titem->getParentUUID() << llendl;
   8.148  		U32 callback_id;
   8.149  		msg->getU32Fast(_PREHASH_ItemData, _PREHASH_CallbackID, callback_id);
   8.150 -		if(titem->getUUID().notNull())
   8.151 +		if(titem->getUUID().notNull()) // && callback_id.notNull())
   8.152  		{
   8.153  			items.push_back(titem);
   8.154  			cblist.push_back(InventoryCallbackInfo(callback_id, titem->getUUID()));
   8.155 @@ -3080,7 +3153,7 @@
   8.156  				it = mIncomplete.erase(it);
   8.157  				continue;
   8.158  			}
   8.159 -			if(item->isComplete())
   8.160 +			if(item->isFinished())
   8.161  			{
   8.162  				mComplete.push_back(*it);
   8.163  				it = mIncomplete.erase(it);
   8.164 @@ -3121,7 +3194,7 @@
   8.165  				it = mIncomplete.erase(it);
   8.166  				continue;
   8.167  			}
   8.168 -			if(item->isComplete())
   8.169 +			if(item->isFinished())
   8.170  			{
   8.171  				mComplete.push_back(*it);
   8.172  				it = mIncomplete.erase(it);
   8.173 @@ -3138,7 +3211,7 @@
   8.174  	//llinfos << "LLInventoryFetchObserver::changed() mIncomplete size " << mIncomplete.size() << llendl;
   8.175  }
   8.176  
   8.177 -bool LLInventoryFetchObserver::isEverythingComplete() const
   8.178 +bool LLInventoryFetchObserver::isFinished() const
   8.179  {
   8.180  	return mIncomplete.empty();
   8.181  }
   8.182 @@ -3147,9 +3220,19 @@
   8.183  {
   8.184  	if (!items_llsd.size()) return;
   8.185  	LLSD body;
   8.186 -	body[0]["cap_name"] = "FetchInventory";
   8.187 -	body[1]["cap_name"] = "FetchLib";
   8.188 -	for (S32 i=0; i<items_llsd.size();i++)
   8.189 +	std::string url = gAgent.getRegion()->getCapability("FetchInventory2");
   8.190 +	if (url.empty())
   8.191 +	{
   8.192 +		body[0]["cap_name"] = "FetchInventory";
   8.193 +		body[1]["cap_name"] = "FetchLib";
   8.194 +	}
   8.195 +	else
   8.196 +	{
   8.197 +		body[0]["cap_name"] = "FetchInventory2";
   8.198 +		body[1]["cap_name"] = "FetchLib2";
   8.199 +	}
   8.200 +
   8.201 +	for (S32 i = 0; i < items_llsd.size(); i++)
   8.202  	{
   8.203  		if (items_llsd[i]["owner_id"].asString() == gAgent.getID().asString())
   8.204  		{
   8.205 @@ -3163,10 +3246,10 @@
   8.206  		}
   8.207  	}
   8.208  		
   8.209 -	for (S32 i=0; i<body.size(); i++)
   8.210 +	for (S32 i = 0; i < body.size(); i++)
   8.211  	{
   8.212  		if (0 >= body[i].size()) continue;
   8.213 -		std::string url = gAgent.getRegion()->getCapability(body[i]["cap_name"].asString());
   8.214 +		url = gAgent.getRegion()->getCapability(body[i]["cap_name"].asString());
   8.215  
   8.216  		if (!url.empty())
   8.217  		{
   8.218 @@ -3177,7 +3260,7 @@
   8.219  
   8.220  		LLMessageSystem* msg = gMessageSystem;
   8.221  		BOOL start_new_message = TRUE;
   8.222 -		for (S32 j=0; j<body[i]["items"].size(); j++)
   8.223 +		for (S32 j = 0; j < body[i]["items"].size(); j++)
   8.224  		{
   8.225  			LLSD item_entry = body[i]["items"][j];
   8.226  			if(start_new_message)
   8.227 @@ -3214,7 +3297,7 @@
   8.228  		LLViewerInventoryItem* item = gInventory.getItem(*it);
   8.229  		if(item)
   8.230  		{
   8.231 -			if(item->isComplete())
   8.232 +			if(item->isFinished())
   8.233  			{
   8.234  				// It's complete, so put it on the complete container.
   8.235  				mComplete.push_back(*it);
   8.236 @@ -3255,7 +3338,7 @@
   8.237  			it = mIncompleteFolders.erase(it);
   8.238  			continue;
   8.239  		}
   8.240 -		if(isComplete(cat))
   8.241 +		if (isCategoryComplete(cat))
   8.242  		{
   8.243  			mCompleteFolders.push_back(*it);
   8.244  			it = mIncompleteFolders.erase(it);
   8.245 @@ -3276,7 +3359,7 @@
   8.246  	{
   8.247  		LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
   8.248  		if(!cat) continue;
   8.249 -		if(!isComplete(cat))
   8.250 +		if (!isCategoryComplete(cat))
   8.251  		{
   8.252  			cat->fetch();	// blindly fetch it without seeing if anything else is fetching it.
   8.253  			mIncompleteFolders.push_back(*it);	//Add to list of things being downloaded for this observer.
   8.254 @@ -3288,12 +3371,12 @@
   8.255  	}
   8.256  }
   8.257  
   8.258 -bool LLInventoryFetchDescendentsObserver::isEverythingComplete() const
   8.259 +bool LLInventoryFetchDescendentsObserver::isFinished() const
   8.260  {
   8.261  	return mIncompleteFolders.empty();
   8.262  }
   8.263  
   8.264 -bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory* cat)
   8.265 +bool LLInventoryFetchDescendentsObserver::isCategoryComplete(LLViewerInventoryCategory* cat)
   8.266  {
   8.267  	S32 version = cat->getVersion();
   8.268  	S32 descendents = cat->getDescendentCount();
   8.269 @@ -3335,7 +3418,7 @@
   8.270  				it = mIncompleteItems.erase(it);
   8.271  				continue;
   8.272  			}
   8.273 -			if(item->isComplete())
   8.274 +			if(item->isFinished())
   8.275  			{
   8.276  				mCompleteItems.push_back(*it);
   8.277  				it = mIncompleteItems.erase(it);
   8.278 @@ -3406,7 +3489,7 @@
   8.279  			lldebugs << "uanble to find item " << *iit << llendl;
   8.280  			continue;
   8.281  		}
   8.282 -		if(item->isComplete())
   8.283 +		if(item->isFinished())
   8.284  		{
   8.285  			// It's complete, so put it on the complete container.
   8.286  			mCompleteItems.push_back(*iit);
   8.287 @@ -3476,16 +3559,7 @@
   8.288  	// the network, figure out which item was updated.
   8.289  	LLMessageSystem* msg = gMessageSystem;
   8.290  
   8.291 -	std::string msg_name;
   8.292 -	if (mMessageName.empty())
   8.293 -	{
   8.294 -		msg_name = msg->getMessageName();
   8.295 -	}
   8.296 -	else
   8.297 -	{
   8.298 -		msg_name = mMessageName;
   8.299 -	}
   8.300 -
   8.301 +	std::string msg_name = msg->getMessageName();
   8.302  	if (msg_name.empty())
   8.303  	{
   8.304  		return;
     9.1 --- a/indra/newview/llinventorymodel.h	Sat Jan 07 17:05:31 2012 +0100
     9.2 +++ b/indra/newview/llinventorymodel.h	Sun Jan 15 13:43:22 2012 +0100
     9.3 @@ -71,7 +71,6 @@
     9.4  	};
     9.5  	virtual ~LLInventoryObserver() {};
     9.6  	virtual void changed(U32 mask) = 0;
     9.7 -	std::string mMessageName; // used by Agent Inventory Service only. [DEV-20328]
     9.8  };
     9.9  
    9.10  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    9.11 @@ -380,7 +379,9 @@
    9.12  	// name based on type, pass in a NULL to the 'name' parameter.
    9.13  	LLUUID createNewCategory(const LLUUID& parent_id,
    9.14  							 LLFolderType::EType preferred_type,
    9.15 -							 const std::string& name);
    9.16 +							 const std::string& name,
    9.17 +							 void (*callback)(const LLSD&, void*) = NULL,
    9.18 +							 void* user_data = NULL);
    9.19  
    9.20  	LLUUID findCategoryByName(std::string name);
    9.21  
    9.22 @@ -798,7 +799,7 @@
    9.23  
    9.24  	typedef std::vector<LLUUID> item_ref_t;
    9.25  
    9.26 -	bool isEverythingComplete() const;
    9.27 +	bool isFinished() const;
    9.28  	void fetchItems(const item_ref_t& ids);
    9.29  	virtual void done() = 0;
    9.30  
    9.31 @@ -822,11 +823,11 @@
    9.32  
    9.33  	typedef std::vector<LLUUID> folder_ref_t;
    9.34  	void fetchDescendents(const folder_ref_t& ids);
    9.35 -	bool isEverythingComplete() const;
    9.36 +	bool isFinished() const;
    9.37  	virtual void done() = 0;
    9.38  
    9.39  protected:
    9.40 -	bool isComplete(LLViewerInventoryCategory* cat);
    9.41 +	bool isCategoryComplete(LLViewerInventoryCategory* cat);
    9.42  	folder_ref_t mIncompleteFolders;
    9.43  	folder_ref_t mCompleteFolders;
    9.44  };
    10.1 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp	Sat Jan 07 17:05:31 2012 +0100
    10.2 +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp	Sun Jan 15 13:43:22 2012 +0100
    10.3 @@ -193,7 +193,7 @@
    10.4  		// If we'll be using the capability, we'll be sending batches and the
    10.5  		// background thing isn't as important.
    10.6  		std::string url = gAgent.getRegion()->getCapability("FetchInventoryDescendents2");   
    10.7 -		if (gSavedSettings.getBOOL("UseHTTPInventory") && !url.empty()) 
    10.8 +		if (!url.empty()) 
    10.9  		{
   10.10  			bulkFetch(url);
   10.11  			return;
   10.12 @@ -601,28 +601,20 @@
   10.13  		}
   10.14  		if (body_lib["folders"].size())
   10.15  		{
   10.16 -			std::string url_lib;
   10.17 -			if (!gSavedSettings.getBOOL("OpenGridProtocol"))
   10.18 +			std::string capability = "FetchLibDescendents2";
   10.19 +			std::string url_lib = gAgent.getRegion()->getCapability(capability);
   10.20 +			if (url_lib.empty())
   10.21  			{
   10.22 -				url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents2");
   10.23 -				if (url_lib.empty())
   10.24 -				{
   10.25 -					url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
   10.26 -					LL_DEBUGS("InventoryFetch") << "Using capability FetchLibDescendents for fetch"
   10.27 -												<< LL_ENDL;
   10.28 -				}
   10.29 -				else
   10.30 -				{
   10.31 -					LL_DEBUGS("InventoryFetch") << "Using capability FetchLibDescendents2 for fetch"
   10.32 -												<< LL_ENDL;
   10.33 -				}
   10.34 +				capability = "FetchLibDescendents";
   10.35 +				url_lib = gAgent.getRegion()->getCapability(capability);
   10.36  			}
   10.37 -			else
   10.38 +			if (url_lib.empty() && gSavedSettings.getBOOL("OpenGridProtocol"))
   10.39  			{
   10.40 -				url_lib = gAgent.getCapability("agent/inventory_library");
   10.41 -				LL_DEBUGS("InventoryFetch") << "Using capability agent/inventory_library for fetch"
   10.42 -											<< LL_ENDL;
   10.43 +				capability = "agent/inventory_library";
   10.44 +				url_lib = gAgent.getCapability(capability);
   10.45  			}
   10.46 +			LL_DEBUGS("InventoryFetch") << "Using capability " << capability
   10.47 +										<< " for fetch" << LL_ENDL;
   10.48  
   10.49  			LLInventoryModelFetchDescendentsResponder *fetcher = new LLInventoryModelFetchDescendentsResponder(body_lib, recursive_cats);
   10.50  			LLHTTPClient::post(url_lib, body_lib, fetcher, 300.0);
    11.1 --- a/indra/newview/llpreview.cpp	Sat Jan 07 17:05:31 2012 +0100
    11.2 +++ b/indra/newview/llpreview.cpp	Sun Jan 15 13:43:22 2012 +0100
    11.3 @@ -196,7 +196,7 @@
    11.4  	const LLViewerInventoryItem *item = getItem();
    11.5  	if(item)
    11.6  	{
    11.7 -		if (!item->isComplete())
    11.8 +		if (!item->isFinished())
    11.9  		{
   11.10  			// We are attempting to save an item that was never loaded
   11.11  			llwarns << "LLPreview::onCommit() called with mIsComplete == FALSE"
    12.1 --- a/indra/newview/llpreviewgesture.cpp	Sat Jan 07 17:05:31 2012 +0100
    12.2 +++ b/indra/newview/llpreviewgesture.cpp	Sun Jan 15 13:43:22 2012 +0100
    12.3 @@ -161,7 +161,7 @@
    12.4  
    12.5  	// this will call refresh when we have everything.
    12.6  	LLViewerInventoryItem* item = (LLViewerInventoryItem*)self->getItem();
    12.7 -	if(item && !item->isComplete())
    12.8 +	if(item && !item->isFinished())
    12.9  	{
   12.10  		LLInventoryGestureAvailable* observer;
   12.11  		observer = new LLInventoryGestureAvailable();
   12.12 @@ -710,7 +710,7 @@
   12.13  {
   12.14  	// If previewing or item is incomplete, all controls are disabled
   12.15  	LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem();
   12.16 -	bool is_complete = (item && item->isComplete()) ? true : false;
   12.17 +	bool is_complete = (item && item->isFinished()) ? true : false;
   12.18  	if (mPreviewGesture || !is_complete)
   12.19  	{
   12.20  		
    13.1 --- a/indra/newview/llpreviewscript.cpp	Sat Jan 07 17:05:31 2012 +0100
    13.2 +++ b/indra/newview/llpreviewscript.cpp	Sun Jan 15 13:43:22 2012 +0100
    13.3 @@ -2603,7 +2603,7 @@
    13.4  		return;
    13.5  	}
    13.6  
    13.7 -	if(mItem.isNull() || !mItem->isComplete())
    13.8 +	if(mItem.isNull() || !mItem->isFinished())
    13.9  	{
   13.10  		// $NOTE: While the error message may not be exactly correct,
   13.11  		// it's pretty close.
    14.1 --- a/indra/newview/lltooldraganddrop.cpp	Sat Jan 07 17:05:31 2012 +0100
    14.2 +++ b/indra/newview/lltooldraganddrop.cpp	Sun Jan 15 13:43:22 2012 +0100
    14.3 @@ -54,7 +54,6 @@
    14.4  #include "llmutelist.h"
    14.5  #include "llpreviewnotecard.h"
    14.6  #include "llselectmgr.h"
    14.7 -#include "lltooldraganddrop.h"
    14.8  #include "lltoolmgr.h"
    14.9  #include "lltrans.h"
   14.10  #include "llviewercontrol.h"
   14.11 @@ -238,6 +237,9 @@
   14.12  	return allowed;
   14.13  }
   14.14  
   14.15 +// Starts a fetch on folders and items.  This is really not used 
   14.16 +// as an observer in the traditional sense; we're just using it to
   14.17 +// request a fetch and we don't care about when/if the response arrives.
   14.18  class LLCategoryFireAndForget : public LLInventoryFetchComboObserver
   14.19  {
   14.20  public:
   14.21 @@ -246,7 +248,7 @@
   14.22  	virtual void done()
   14.23  	{
   14.24  		/* no-op: it's fire n forget right? */
   14.25 -		lldebugs << "LLCategoryFireAndForget::done()" << llendl;
   14.26 +		LL_DEBUGS("DragAndDrop") << "LLCategoryFireAndForget::done()" << LL_ENDL;
   14.27  	}
   14.28  };
   14.29  
   14.30 @@ -292,6 +294,7 @@
   14.31  	delete this;
   14.32  }
   14.33  
   14.34 +/* Doesn't seem to be used anymore.
   14.35  class LLCategoryDropDescendentsObserver : public LLInventoryFetchDescendentsObserver
   14.36  {
   14.37  public:
   14.38 @@ -337,9 +340,9 @@
   14.39  		std::back_insert_iterator<LLInventoryFetchObserver::item_ref_t> copier(ids);
   14.40  		std::copy(unique_ids.begin(), unique_ids.end(), copier);
   14.41  		LLCategoryDropObserver* dropper;
   14.42 -		dropper = new LLCategoryDropObserver(mObjectID, mSource);
   14.43 -		dropper->fetchItems(ids);
   14.44 -		if(dropper->isEverythingComplete())
   14.45 +		dropper = new LLCategoryDropObserver(ids, mObjectID, mSource);
   14.46 +		dropper->startFetch();
   14.47 +		if (dropper->isFinished())
   14.48  		{
   14.49  			dropper->done();
   14.50  		}
   14.51 @@ -350,145 +353,54 @@
   14.52  	}
   14.53  	delete this;
   14.54  }
   14.55 +*/
   14.56  
   14.57 -// This array is used to more easily control what happens when a 3d
   14.58 -// drag and drop event occurs. Since there's an array of drop target
   14.59 -// and cargo type, it's implemented as an array of pointers to member
   14.60 -// functions which correctly carry out the actual drop.
   14.61 -LLToolDragAndDrop::dragOrDrop3dImpl LLToolDragAndDrop::sDragAndDrop3d[DAD_COUNT][LLToolDragAndDrop::DT_COUNT] =
   14.62 +LLToolDragAndDrop::DragAndDropEntry::DragAndDropEntry(dragOrDrop3dImpl f_none,
   14.63 +													  dragOrDrop3dImpl f_self,
   14.64 +													  dragOrDrop3dImpl f_avatar,
   14.65 +													  dragOrDrop3dImpl f_object,
   14.66 +													  dragOrDrop3dImpl f_land) :
   14.67 +	LLDictionaryEntry("")
   14.68  {
   14.69 -	//	Source: DAD_NONE
   14.70 +	mFunctions[DT_NONE] = f_none;
   14.71 +	mFunctions[DT_SELF] = f_self;
   14.72 +	mFunctions[DT_AVATAR] = f_avatar;
   14.73 +	mFunctions[DT_OBJECT] = f_object;
   14.74 +	mFunctions[DT_LAND] = f_land;
   14.75 +}
   14.76 +
   14.77 +LLToolDragAndDrop::dragOrDrop3dImpl LLToolDragAndDrop::LLDragAndDropDictionary::get(EDragAndDropType dad_type, LLToolDragAndDrop::EDropTarget drop_target)
   14.78 +{
   14.79 +	const DragAndDropEntry *entry = lookup(dad_type);
   14.80 +	if (entry)
   14.81  	{
   14.82 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
   14.83 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
   14.84 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_AVATAR
   14.85 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_OBJECT
   14.86 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_LAND
   14.87 -	},
   14.88 -	//	Source: DAD_TEXTURE
   14.89 -	{
   14.90 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
   14.91 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
   14.92 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
   14.93 -		&LLToolDragAndDrop::dad3dTextureObject, // Dest: DT_OBJECT
   14.94 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
   14.95 -	},
   14.96 -	//	Source: DAD_SOUND
   14.97 -	{
   14.98 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
   14.99 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
  14.100 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
  14.101 -		&LLToolDragAndDrop::dad3dUpdateInventory, // Dest: DT_OBJECT
  14.102 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.103 -	},
  14.104 -	//	Source: DAD_CALLINGCARD
  14.105 -	{
  14.106 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.107 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
  14.108 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_AVATAR
  14.109 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_OBJECT
  14.110 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_LAND
  14.111 -	},
  14.112 -	//	Source: DAD_LANDMARK
  14.113 -	{
  14.114 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.115 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
  14.116 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
  14.117 -		&LLToolDragAndDrop::dad3dUpdateInventory, // Dest: DT_OBJECT
  14.118 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.119 -	},
  14.120 -	//	Source: DAD_SCRIPT
  14.121 -	{
  14.122 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.123 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
  14.124 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
  14.125 -		&LLToolDragAndDrop::dad3dRezScript, // Dest: DT_OBJECT
  14.126 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.127 -	},
  14.128 -	//	Source: DAD_CLOTHING
  14.129 -	{
  14.130 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.131 -		&LLToolDragAndDrop::dad3dWearItem, // Dest: DT_SELF
  14.132 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
  14.133 -		&LLToolDragAndDrop::dad3dUpdateInventory, // Dest: DT_OBJECT
  14.134 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.135 -	},
  14.136 -	//	Source: DAD_OBJECT
  14.137 -	{
  14.138 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.139 -		&LLToolDragAndDrop::dad3dRezAttachmentFromInv, // Dest: DT_SELF
  14.140 -		&LLToolDragAndDrop::dad3dGiveInventoryObject, // Dest: DT_AVATAR
  14.141 -		&LLToolDragAndDrop::dad3dRezObjectOnObject, // Dest: DT_OBJECT
  14.142 -		&LLToolDragAndDrop::dad3dRezObjectOnLand, // Dest: DT_LAND
  14.143 -	},
  14.144 -	//	Source: DAD_NOTECARD
  14.145 -	{
  14.146 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.147 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
  14.148 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
  14.149 -		&LLToolDragAndDrop::dad3dUpdateInventory, // Dest: DT_OBJECT
  14.150 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.151 -	},
  14.152 -	//	Source: DAD_CATEGORY
  14.153 -	{
  14.154 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.155 -		&LLToolDragAndDrop::dad3dWearCategory, // Dest: DT_SELF
  14.156 -		&LLToolDragAndDrop::dad3dGiveInventoryCategory, // Dest: DT_AVATAR
  14.157 -		&LLToolDragAndDrop::dad3dUpdateInventoryCategory, // Dest: DT_OBJECT
  14.158 -		&LLToolDragAndDrop::dad3dNULL,//dad3dCategoryOnLand, // Dest: DT_LAND
  14.159 -	},
  14.160 -	//	Source: DAD_ROOT
  14.161 -	{
  14.162 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.163 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
  14.164 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_AVATAR
  14.165 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_OBJECT
  14.166 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_LAND
  14.167 -	},
  14.168 -	//	Source: DAD_BODYPART
  14.169 -	{
  14.170 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.171 -		&LLToolDragAndDrop::dad3dWearItem, // Dest: DT_SELF
  14.172 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
  14.173 -		&LLToolDragAndDrop::dad3dUpdateInventory, // Dest: DT_OBJECT
  14.174 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.175 -	},
  14.176 -	//	Source: DAD_ANIMATION
  14.177 +		return (entry->mFunctions[(U8)drop_target]);
  14.178 +	}
  14.179 +	return &LLToolDragAndDrop::dad3dNULL;
  14.180 +}
  14.181 +
  14.182 +LLToolDragAndDrop::LLDragAndDropDictionary::LLDragAndDropDictionary()
  14.183 +{
  14.184 + 	//       										 DT_NONE                         DT_SELF                                        DT_AVATAR                   					DT_OBJECT                       					DT_LAND
  14.185 +	//      										|-------------------------------|----------------------------------------------|-----------------------------------------------|---------------------------------------------------|--------------------------------|
  14.186 +	addEntry(DAD_NONE, 			new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dNULL,						&LLToolDragAndDrop::dad3dNULL));
  14.187 +	addEntry(DAD_TEXTURE, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dGiveInventory,			&LLToolDragAndDrop::dad3dTextureObject,				&LLToolDragAndDrop::dad3dNULL));
  14.188 +	addEntry(DAD_SOUND, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dGiveInventory,			&LLToolDragAndDrop::dad3dUpdateInventory,			&LLToolDragAndDrop::dad3dNULL));
  14.189 +	addEntry(DAD_CALLINGCARD, 	new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dGiveInventory, 		&LLToolDragAndDrop::dad3dUpdateInventory, 			&LLToolDragAndDrop::dad3dNULL));
  14.190 +	addEntry(DAD_LANDMARK, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, 					&LLToolDragAndDrop::dad3dGiveInventory, 		&LLToolDragAndDrop::dad3dUpdateInventory, 			&LLToolDragAndDrop::dad3dNULL));
  14.191 +	addEntry(DAD_SCRIPT, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, 					&LLToolDragAndDrop::dad3dGiveInventory, 		&LLToolDragAndDrop::dad3dRezScript, 				&LLToolDragAndDrop::dad3dNULL));
  14.192 +	addEntry(DAD_CLOTHING, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dWearItem, 				&LLToolDragAndDrop::dad3dGiveInventory, 		&LLToolDragAndDrop::dad3dUpdateInventory, 			&LLToolDragAndDrop::dad3dNULL));
  14.193 +	addEntry(DAD_OBJECT, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dRezAttachmentFromInv,	&LLToolDragAndDrop::dad3dGiveInventoryObject,	&LLToolDragAndDrop::dad3dRezObjectOnObject, 		&LLToolDragAndDrop::dad3dRezObjectOnLand));
  14.194 +	addEntry(DAD_NOTECARD, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dNULL, 					&LLToolDragAndDrop::dad3dGiveInventory, 		&LLToolDragAndDrop::dad3dUpdateInventory, 			&LLToolDragAndDrop::dad3dNULL));
  14.195 +	addEntry(DAD_CATEGORY, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL, &LLToolDragAndDrop::dad3dWearCategory,			&LLToolDragAndDrop::dad3dGiveInventoryCategory,	&LLToolDragAndDrop::dad3dUpdateInventoryCategory,	&LLToolDragAndDrop::dad3dNULL));
  14.196 +	addEntry(DAD_ROOT_CATEGORY, new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dNULL,						&LLToolDragAndDrop::dad3dNULL));
  14.197 +	addEntry(DAD_BODYPART, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dWearItem,				&LLToolDragAndDrop::dad3dGiveInventory,			&LLToolDragAndDrop::dad3dUpdateInventory,			&LLToolDragAndDrop::dad3dNULL));
  14.198 +	addEntry(DAD_ANIMATION, 	new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dGiveInventory,			&LLToolDragAndDrop::dad3dUpdateInventory,			&LLToolDragAndDrop::dad3dNULL));
  14.199 +	addEntry(DAD_GESTURE, 		new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dActivateGesture,		&LLToolDragAndDrop::dad3dGiveInventory,			&LLToolDragAndDrop::dad3dUpdateInventory,			&LLToolDragAndDrop::dad3dNULL));
  14.200 +	addEntry(DAD_LINK, 			new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dNULL,						&LLToolDragAndDrop::dad3dNULL));
  14.201 +	addEntry(DAD_MESH, 			new DragAndDropEntry(&LLToolDragAndDrop::dad3dNULL,	&LLToolDragAndDrop::dad3dNULL,					&LLToolDragAndDrop::dad3dGiveInventory,			&LLToolDragAndDrop::dad3dMeshObject,				&LLToolDragAndDrop::dad3dNULL));
  14.202  	// TODO: animation on self could play it?  edit it?
  14.203 -	{
  14.204 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.205 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
  14.206 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
  14.207 -		&LLToolDragAndDrop::dad3dUpdateInventory, // Dest: DT_OBJECT
  14.208 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.209 -	},
  14.210 -	//	Source: DAD_GESTURE
  14.211  	// TODO: gesture on self could play it?  edit it?
  14.212 -	{
  14.213 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.214 -		&LLToolDragAndDrop::dad3dActivateGesture, // Dest: DT_SELF
  14.215 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
  14.216 -		&LLToolDragAndDrop::dad3dUpdateInventory, // Dest: DT_OBJECT
  14.217 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.218 -	},
  14.219 -	//	Source: DAD_LINK
  14.220 -	// TODO: gesture on self could play it?  edit it?
  14.221 -	{
  14.222 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.223 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
  14.224 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_AVATAR
  14.225 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_OBJECT
  14.226 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.227 -	},
  14.228 -	//	Source: DAD_MESH
  14.229 -	// TODO: gesture on self could play it?  edit it?
  14.230 -	{
  14.231 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_NONE
  14.232 -		&LLToolDragAndDrop::dad3dNULL, // Dest: DT_SELF
  14.233 -		&LLToolDragAndDrop::dad3dGiveInventory, // Dest: DT_AVATAR
  14.234 -		&LLToolDragAndDrop::dad3dMeshObject, // Dest: DT_OBJECT
  14.235 -		&LLToolDragAndDrop::dad3dNULL,//dad3dAssetOnLand, // Dest: DT_LAND
  14.236 -	},
  14.237  };
  14.238  
  14.239  LLToolDragAndDrop::LLToolDragAndDrop()
  14.240 @@ -942,40 +854,41 @@
  14.241  
  14.242  void LLToolDragAndDrop::pickCallback(const LLPickInfo& pick_info)
  14.243  {
  14.244 +	LLToolDragAndDrop* self = LLToolDragAndDrop::getInstance();
  14.245  	EDropTarget target = DT_NONE;
  14.246  	S32	hit_face = -1;
  14.247  
  14.248  	LLViewerObject* hit_obj = pick_info.getObject();
  14.249  	LLSelectMgr::getInstance()->unhighlightAll();
  14.250 +	bool highlight_object = false;
  14.251  
  14.252  	// Treat attachments as part of the avatar they are attached to.
  14.253  	if (hit_obj)
  14.254  	{
  14.255  		// don't allow drag and drop on grass, trees, etc.
  14.256 -		if(pick_info.mPickType == LLPickInfo::PICK_FLORA)
  14.257 +		if (pick_info.mPickType == LLPickInfo::PICK_FLORA)
  14.258  		{
  14.259 -			LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_NO;
  14.260 -			gViewerWindow->getWindow()->setCursor( LLToolDragAndDrop::getInstance()->mCursor );
  14.261 +			self->mCursor = UI_CURSOR_NO;
  14.262 +			gViewerWindow->getWindow()->setCursor(self->mCursor);
  14.263  			return;
  14.264  		}
  14.265  
  14.266 -		if(hit_obj->isAttachment() && !hit_obj->isHUDAttachment())
  14.267 +		if (hit_obj->isAttachment() && !hit_obj->isHUDAttachment())
  14.268  		{
  14.269 -			LLVOAvatar* avatar = LLVOAvatar::findAvatarFromAttachment( hit_obj );
  14.270 -			if( !avatar )
  14.271 +			LLVOAvatar* avatar = LLVOAvatar::findAvatarFromAttachment(hit_obj);
  14.272 +			if (!avatar)
  14.273  			{
  14.274 -				LLToolDragAndDrop::getInstance()->mLastAccept = ACCEPT_NO;
  14.275 -				LLToolDragAndDrop::getInstance()->mCursor = UI_CURSOR_NO;
  14.276 -				gViewerWindow->getWindow()->setCursor( LLToolDragAndDrop::getInstance()->mCursor );
  14.277 +				self->mLastAccept = ACCEPT_NO;
  14.278 +				self->mCursor = UI_CURSOR_NO;
  14.279 +				gViewerWindow->getWindow()->setCursor(self->mCursor);
  14.280  				return;
  14.281  			}
  14.282 -			
  14.283  			hit_obj = avatar;
  14.284  		}
  14.285  
  14.286 -		if(hit_obj->isAvatar())
  14.287 +		if (hit_obj->isAvatar())
  14.288  		{
  14.289 -			if(((LLVOAvatar*) hit_obj)->isSelf())
  14.290 +			if (((LLVOAvatar*) hit_obj)->isSelf())
  14.291  			{
  14.292  				target = DT_SELF;
  14.293  				hit_face = -1;
  14.294 @@ -990,67 +903,75 @@
  14.295  		{
  14.296  			target = DT_OBJECT;
  14.297  			hit_face = pick_info.mObjectFace;
  14.298 -			// if any item being dragged will be applied to the object under our cursor
  14.299 -			// highlight that object
  14.300 -			for (S32 i = 0; i < (S32)LLToolDragAndDrop::getInstance()->mCargoIDs.size(); i++)
  14.301 -			{
  14.302 -				if (LLToolDragAndDrop::getInstance()->mCargoTypes[i] != DAD_OBJECT || (pick_info.mKeyMask & MASK_CONTROL))
  14.303 -				{
  14.304 -					LLSelectMgr::getInstance()->highlightObjectAndFamily(hit_obj);
  14.305 -					break;
  14.306 -				}
  14.307 -			}
  14.308 +			highlight_object = true;
  14.309  		}
  14.310  	}
  14.311 -	else if(pick_info.mPickType == LLPickInfo::PICK_LAND)
  14.312 +	else if (pick_info.mPickType == LLPickInfo::PICK_LAND)
  14.313  	{
  14.314  		target = DT_LAND;
  14.315  		hit_face = -1;
  14.316  	}
  14.317  
  14.318 -	LLToolDragAndDrop::getInstance()->mLastAccept = ACCEPT_YES_MULTI;
  14.319 +	self->mLastAccept = ACCEPT_YES_MULTI;
  14.320  
  14.321 -	for (LLToolDragAndDrop::getInstance()->mCurItemIndex = 0; LLToolDragAndDrop::getInstance()->mCurItemIndex < (S32)LLToolDragAndDrop::getInstance()->mCargoIDs.size(); 
  14.322 -		LLToolDragAndDrop::getInstance()->mCurItemIndex++)
  14.323 +	for (self->mCurItemIndex = 0;
  14.324 +		 self->mCurItemIndex < (S32)self->mCargoIDs.size();
  14.325 +		 self->mCurItemIndex++)
  14.326  	{
  14.327 +		const S32 item_index = self->mCurItemIndex;
  14.328 +		const EDragAndDropType dad_type = self->mCargoTypes[item_index];
  14.329  		// Call the right implementation function
  14.330 -		LLToolDragAndDrop::getInstance()->mLastAccept = (EAcceptance)llmin(
  14.331 -			(U32)LLToolDragAndDrop::getInstance()->mLastAccept,
  14.332 -			(U32)callMemberFunction((*LLToolDragAndDrop::getInstance()), 
  14.333 -				LLToolDragAndDrop::getInstance()->sDragAndDrop3d[LLToolDragAndDrop::getInstance()->mCargoTypes[LLToolDragAndDrop::getInstance()->mCurItemIndex]][target])
  14.334 -				(hit_obj, hit_face, pick_info.mKeyMask, FALSE));
  14.335 +		self->mLastAccept = (EAcceptance)llmin(
  14.336 +			(U32)self->mLastAccept,
  14.337 +			(U32)callMemberFunction(*self,
  14.338 +									LLDragAndDropDictionary::instance().get(dad_type, target))
  14.339 +										(hit_obj, hit_face, pick_info.mKeyMask, FALSE));
  14.340  	}
  14.341  
  14.342 -	if (LLToolDragAndDrop::getInstance()->mDrop &&
  14.343 -	    (U32)LLToolDragAndDrop::getInstance()->mLastAccept >= ACCEPT_YES_COPY_SINGLE)
  14.344 +	if (self->mDrop && (U32)self->mLastAccept >= ACCEPT_YES_COPY_SINGLE)
  14.345  	{
  14.346  		// if target allows multi-drop or there is only one item being dropped, go ahead
  14.347 -		if (LLToolDragAndDrop::getInstance()->mLastAccept >= ACCEPT_YES_COPY_MULTI ||
  14.348 -		    LLToolDragAndDrop::getInstance()->mCargoIDs.size() == 1)
  14.349 +		if (self->mLastAccept >= ACCEPT_YES_COPY_MULTI ||
  14.350 +		    self->mCargoIDs.size() == 1)
  14.351  		{
  14.352  			// Target accepts multi, or cargo is a single-drop
  14.353 -			for (LLToolDragAndDrop::getInstance()->mCurItemIndex = 0;
  14.354 -			     LLToolDragAndDrop::getInstance()->mCurItemIndex < (S32)LLToolDragAndDrop::getInstance()->mCargoIDs.size(); 
  14.355 -			     LLToolDragAndDrop::getInstance()->mCurItemIndex++)
  14.356 +			for (self->mCurItemIndex = 0;
  14.357 +			     self->mCurItemIndex < (S32)self->mCargoIDs.size(); 
  14.358 +			     self->mCurItemIndex++)
  14.359  			{
  14.360 +				const S32 item_index = self->mCurItemIndex;
  14.361 +				const EDragAndDropType dad_type = self->mCargoTypes[item_index];
  14.362  				// Call the right implementation function
  14.363 -				(U32)callMemberFunction((*LLToolDragAndDrop::getInstance()), 
  14.364 -							LLToolDragAndDrop::getInstance()->sDragAndDrop3d[LLToolDragAndDrop::getInstance()->mCargoTypes[LLToolDragAndDrop::getInstance()->mCurItemIndex]][target])
  14.365 -					(hit_obj, hit_face, pick_info.mKeyMask, TRUE);
  14.366 +				(U32)callMemberFunction(*self, 
  14.367 +										LLDragAndDropDictionary::instance().get(dad_type, target))
  14.368 +											(hit_obj, hit_face, pick_info.mKeyMask, TRUE);
  14.369  			}
  14.370  		}
  14.371  		else
  14.372  		{
  14.373  			// Target does not accept multi, but cargo is multi
  14.374 -			LLToolDragAndDrop::getInstance()->mLastAccept = ACCEPT_NO;
  14.375 +			self->mLastAccept = ACCEPT_NO;
  14.376  		}
  14.377  	}
  14.378  
  14.379 -	ECursorType cursor = LLToolDragAndDrop::getInstance()->acceptanceToCursor( LLToolDragAndDrop::getInstance()->mLastAccept );
  14.380 -	gViewerWindow->getWindow()->setCursor( cursor );
  14.381 +	if (highlight_object && self->mLastAccept > ACCEPT_NO_LOCKED)
  14.382 +	{
  14.383 +		// if any item being dragged will be applied to the object under our cursor
  14.384 +		// highlight that object
  14.385 +		for (S32 i = 0; i < (S32)self->mCargoIDs.size(); i++)
  14.386 +		{
  14.387 +			if (self->mCargoTypes[i] != DAD_OBJECT || (pick_info.mKeyMask & MASK_CONTROL))
  14.388 +			{
  14.389 +				LLSelectMgr::getInstance()->highlightObjectAndFamily(hit_obj);
  14.390 +				break;
  14.391 +			}
  14.392 +		}
  14.393 +	}
  14.394 +	ECursorType cursor = self->acceptanceToCursor(self->mLastAccept);
  14.395 +	gViewerWindow->getWindow()->setCursor(cursor);
  14.396  
  14.397 -	LLToolDragAndDrop::getInstance()->mLastHitPos = pick_info.mPosGlobal;
  14.398 -	LLToolDragAndDrop::getInstance()->mLastCameraPos = gAgent.getCameraPositionGlobal();
  14.399 +	self->mLastHitPos = pick_info.mPosGlobal;
  14.400 +	self->mLastCameraPos = gAgent.getCameraPositionGlobal();
  14.401  }
  14.402  
  14.403  // static
  14.404 @@ -1248,11 +1169,11 @@
  14.405  {
  14.406  	// *HACK: In order to resolve SL-22177, we need to block drags
  14.407  	// from notecards and objects onto other objects.
  14.408 -	if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
  14.409 -	   || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
  14.410 +	if (LLToolDragAndDrop::getInstance()->mSource == SOURCE_WORLD ||
  14.411 +		LLToolDragAndDrop::getInstance()->mSource == SOURCE_NOTECARD)
  14.412  	{
  14.413 -		llwarns << "Call to LLToolDragAndDrop::dropScript() from world"
  14.414 -			<< " or notecard." << llendl;
  14.415 +		llwarns << "Call to LLToolDragAndDrop::dropScript() from world or notecard."
  14.416 +				<< llendl;
  14.417  		return;
  14.418  	}
  14.419  	if(hit_obj && item)
  14.420 @@ -1317,15 +1238,14 @@
  14.421  	}
  14.422  // [/RLVa:KB]
  14.423  
  14.424 -	//llinfos << "Rezzing object" << llendl;
  14.425 +	LL_DEBUGS("DragAndDrop") << "Rezzing object" << LL_ENDL;
  14.426  	make_ui_sound("UISndObjectRezIn");
  14.427  	LLViewerInventoryItem* item;
  14.428  	LLViewerInventoryCategory* cat;
  14.429  	locateInventory(item, cat);
  14.430 -	if(!item || !item->isComplete()) return;
  14.431 -	
  14.432 -	if (regionp
  14.433 -		&& (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
  14.434 +	if (!item || !item->isFinished()) return;
  14.435 +
  14.436 +	if (regionp && (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
  14.437  	{
  14.438  		LLFirstUse::useSandbox();
  14.439  	}
  14.440 @@ -1425,7 +1345,7 @@
  14.441  	pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
  14.442  
  14.443  	LLUUID folder_id = item->getParentUUID();
  14.444 -	if((SOURCE_LIBRARY == mSource) || (is_in_trash))
  14.445 +	if (mSource == SOURCE_LIBRARY || is_in_trash)
  14.446  	{
  14.447  		// since it's coming from the library or trash, we want to not
  14.448  		// 'take' it back to the same place.
  14.449 @@ -1433,6 +1353,8 @@
  14.450  		// *TODO this code isn't working - the parent (FolderID) is still
  14.451  		// set when the object is "taken".  so code on the "take" side is
  14.452  		// checking for trash and library as well (llviewermenu.cpp)
  14.453 +		LL_DEBUGS("DragAndDrop") << "Rezzed object parent set to a null UUID"
  14.454 +								 << LL_ENDL;
  14.455  	}
  14.456  	if (mSource == SOURCE_NOTECARD)
  14.457  	{
  14.458 @@ -1441,11 +1363,15 @@
  14.459  		msg->addUUIDFast(_PREHASH_ObjectID, mObjectID);
  14.460  		msg->nextBlockFast(_PREHASH_InventoryData);
  14.461  		msg->addUUIDFast(_PREHASH_ItemID, item->getUUID());
  14.462 +		LL_DEBUGS("DragAndDrop") << "Rezzed object parent set to a notecard"
  14.463 +								 << LL_ENDL;
  14.464  	}
  14.465  	else
  14.466  	{
  14.467  		msg->nextBlockFast(_PREHASH_InventoryData);
  14.468  		item->packMessage(msg);
  14.469 +		LL_DEBUGS("DragAndDrop") << "Rezzed object parent set to category: "
  14.470 +								 << folder_id.asString() << LL_ENDL;
  14.471  	}
  14.472  	msg->sendReliable(regionp->getHost());
  14.473  	// back out the change. no actual internal changes take place.
  14.474 @@ -1485,8 +1411,8 @@
  14.475  {
  14.476  	// *HACK: In order to resolve SL-22177, we need to block drags
  14.477  	// from notecards and objects onto other objects.
  14.478 -	if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
  14.479 -	   || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
  14.480 +	if (LLToolDragAndDrop::getInstance()->mSource == SOURCE_WORLD ||
  14.481 +		LLToolDragAndDrop::getInstance()->mSource == SOURCE_NOTECARD)
  14.482  	{
  14.483  		llwarns << "Call to LLToolDragAndDrop::dropInventory() from world"
  14.484  			<< " or notecard." << llendl;
  14.485 @@ -1900,9 +1826,6 @@
  14.486  	BOOL acceptable = TRUE;
  14.487  	switch(item->getType())
  14.488  	{
  14.489 -	case LLAssetType::AT_CALLINGCARD:
  14.490 -		acceptable = FALSE;
  14.491 -		break;
  14.492  	case LLAssetType::AT_OBJECT:
  14.493  		if(my_avatar->isWearingAttachment(item->getUUID()))
  14.494  		{
  14.495 @@ -1973,7 +1896,7 @@
  14.496  	if(!item || !obj) return ACCEPT_NO;
  14.497  	// HACK: downcast
  14.498  	LLViewerInventoryItem* vitem = (LLViewerInventoryItem*)item;
  14.499 -	if(!vitem->isComplete()) return ACCEPT_NO;
  14.500 +	if (!vitem->isFinished()) return ACCEPT_NO;
  14.501  	if (vitem->getIsLinkType()) return ACCEPT_NO; // No giving away links
  14.502  
  14.503  	// deny attempts to drop from an object onto itself. This is to
  14.504 @@ -2006,14 +1929,18 @@
  14.505  			worn = TRUE;
  14.506  		}
  14.507  		break;
  14.508 +	case LLAssetType::AT_CALLINGCARD:
  14.509 +		// Calling Cards in object are disabled for now
  14.510 +		// because of incomplete LSL support. See STORM-1117.
  14.511 +		return ACCEPT_NO;
  14.512  	default:
  14.513 -			break;
  14.514 +		break;
  14.515  	}
  14.516  	const LLPermissions& perm = item->getPermissions();
  14.517  	BOOL modify = (obj->permModify() || obj->flagAllowInventoryAdd());
  14.518  	BOOL transfer = FALSE;
  14.519 -	if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
  14.520 -	   || perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
  14.521 +	if ((obj->permYouOwner() && perm.getOwner() == gAgent.getID()) ||
  14.522 +		perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
  14.523  	{
  14.524  		transfer = TRUE;
  14.525  	}
  14.526 @@ -2074,6 +2001,8 @@
  14.527  	case DAD_BODYPART:
  14.528  	case DAD_ANIMATION:
  14.529  	case DAD_GESTURE:
  14.530 +	case DAD_CALLINGCARD:
  14.531 +	case DAD_MESH:
  14.532  	{
  14.533  		LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
  14.534  		if(gInventory.getItem(inv_item->getUUID())
  14.535 @@ -2118,7 +2047,6 @@
  14.536  		}
  14.537  		break;
  14.538  	}
  14.539 -	case DAD_CALLINGCARD:
  14.540  	default:
  14.541  		*accept = ACCEPT_NO;
  14.542  		break;
  14.543 @@ -2136,14 +2064,15 @@
  14.544  EAcceptance LLToolDragAndDrop::dad3dNULL(
  14.545  	LLViewerObject*, S32, MASK, BOOL)
  14.546  {
  14.547 -	lldebugs << "LLToolDragAndDrop::dad3dNULL()" << llendl;
  14.548 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dNULL()" << LL_ENDL;
  14.549  	return ACCEPT_NO;
  14.550  }
  14.551  
  14.552  EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
  14.553  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.554  {
  14.555 -	lldebugs << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << llendl;
  14.556 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()"
  14.557 +							 << LL_ENDL;
  14.558  	// must be in the user's inventory
  14.559  	if(mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY)
  14.560  	{
  14.561 @@ -2153,7 +2082,7 @@
  14.562  	LLViewerInventoryItem* item;
  14.563  	LLViewerInventoryCategory* cat;
  14.564  	locateInventory(item, cat);
  14.565 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.566 +	if(!item || !item->isFinished()) return ACCEPT_NO;
  14.567  
  14.568  	// must not be in the trash
  14.569  	const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
  14.570 @@ -2224,11 +2153,12 @@
  14.571  		return dad3dRezFromObjectOnLand(obj, face, mask, drop);
  14.572  	}
  14.573  
  14.574 -	lldebugs << "LLToolDragAndDrop::dad3dRezObjectOnLand()" << llendl;
  14.575 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dRezObjectOnLand()"
  14.576 +							 << LL_ENDL;
  14.577  	LLViewerInventoryItem* item;
  14.578  	LLViewerInventoryCategory* cat;
  14.579  	locateInventory(item, cat);
  14.580 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.581 +	if(!item || !item->isFinished()) return ACCEPT_NO;
  14.582  
  14.583  	LLVOAvatar* my_avatar = gAgent.getAvatarObject();
  14.584  	if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
  14.585 @@ -2299,11 +2229,12 @@
  14.586  		return dad3dRezFromObjectOnObject(obj, face, mask, drop);
  14.587  	}
  14.588  
  14.589 -	lldebugs << "LLToolDragAndDrop::dad3dRezObjectOnObject()" << llendl;
  14.590 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dRezObjectOnObject()"
  14.591 +							 << LL_ENDL;
  14.592  	LLViewerInventoryItem* item;
  14.593  	LLViewerInventoryCategory* cat;
  14.594  	locateInventory(item, cat);
  14.595 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.596 +	if(!item || !item->isFinished()) return ACCEPT_NO;
  14.597  	LLVOAvatar* my_avatar = gAgent.getAvatarObject();
  14.598  	if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
  14.599  	{
  14.600 @@ -2371,11 +2302,12 @@
  14.601  EAcceptance LLToolDragAndDrop::dad3dRezScript(
  14.602  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.603  {
  14.604 -	lldebugs << "LLToolDragAndDrop::dad3dRezScript()" << llendl;
  14.605 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dRezScript()"
  14.606 +							 << LL_ENDL;
  14.607  
  14.608  	// *HACK: In order to resolve SL-22177, we need to block drags
  14.609  	// from notecards and objects onto other objects.
  14.610 -	if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
  14.611 +	if (SOURCE_WORLD == mSource || SOURCE_NOTECARD == mSource)
  14.612  	{
  14.613  		return ACCEPT_NO;
  14.614  	}
  14.615 @@ -2383,9 +2315,9 @@
  14.616  	LLViewerInventoryItem* item;
  14.617  	LLViewerInventoryCategory* cat;
  14.618  	locateInventory(item, cat);
  14.619 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.620 +	if (!item || !item->isFinished()) return ACCEPT_NO;
  14.621  	EAcceptance rv = willObjectAcceptInventory(obj, item);
  14.622 -	if(drop && (ACCEPT_YES_SINGLE <= rv))
  14.623 +	if (drop && ACCEPT_YES_SINGLE <= rv)
  14.624  	{
  14.625  		// rez in the script active by default, rez in inactive if the
  14.626  		// control key is being held down.
  14.627 @@ -2410,7 +2342,8 @@
  14.628  												  MASK mask, BOOL drop,
  14.629  												  EDragAndDropType cargo_type)
  14.630  {
  14.631 -	lldebugs << "LLToolDragAndDrop::dad3dApplyToObject()" << llendl;
  14.632 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dApplyToObject()"
  14.633 +							 << LL_ENDL;
  14.634  
  14.635  	// *HACK: In order to resolve SL-22177, we need to block drags
  14.636  	// from notecards and objects onto other objects.
  14.637 @@ -2422,7 +2355,7 @@
  14.638  	LLViewerInventoryItem* item;
  14.639  	LLViewerInventoryCategory* cat;
  14.640  	locateInventory(item, cat);
  14.641 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.642 +	if(!item || !item->isFinished()) return ACCEPT_NO;
  14.643  	EAcceptance rv = willObjectAcceptInventory(obj, item);
  14.644  	if((mask & MASK_CONTROL))
  14.645  	{
  14.646 @@ -2442,7 +2375,7 @@
  14.647  		return ACCEPT_NO;
  14.648  	}
  14.649  
  14.650 -	if(drop && (ACCEPT_YES_SINGLE <= rv))
  14.651 +	if (drop && ACCEPT_YES_SINGLE <= rv)
  14.652  	{
  14.653  		if (cargo_type == DAD_TEXTURE)
  14.654  		{
  14.655 @@ -2507,13 +2440,13 @@
  14.656  EAcceptance LLToolDragAndDrop::dad3dWearItem(
  14.657  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.658  {
  14.659 -	lldebugs << "LLToolDragAndDrop::dad3dWearItem()" << llendl;
  14.660 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dWearItem()" << LL_ENDL;
  14.661  	LLViewerInventoryItem* item;
  14.662  	LLViewerInventoryCategory* cat;
  14.663  	locateInventory(item, cat);
  14.664 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.665 +	if (!item || !item->isFinished()) return ACCEPT_NO;
  14.666  
  14.667 -	if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
  14.668 +	if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
  14.669  	{
  14.670  		// it's in the agent inventory
  14.671  		const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
  14.672 @@ -2569,11 +2502,12 @@
  14.673  EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
  14.674  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.675  {
  14.676 -	lldebugs << "LLToolDragAndDrop::dad3dActivateGesture()" << llendl;
  14.677 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dActivateGesture()"
  14.678 +							 << LL_ENDL;
  14.679  	LLViewerInventoryItem* item;
  14.680  	LLViewerInventoryCategory* cat;
  14.681  	locateInventory(item, cat);
  14.682 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.683 +	if(!item || !item->isFinished()) return ACCEPT_NO;
  14.684  
  14.685  	if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
  14.686  	{
  14.687 @@ -2618,7 +2552,8 @@
  14.688  EAcceptance LLToolDragAndDrop::dad3dWearCategory(
  14.689  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.690  {
  14.691 -	lldebugs << "LLToolDragAndDrop::dad3dWearCategory()" << llendl;
  14.692 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dWearCategory()"
  14.693 +							 << LL_ENDL;
  14.694  	LLViewerInventoryItem* item;
  14.695  	LLViewerInventoryCategory* category;
  14.696  	locateInventory(item, category);
  14.697 @@ -2669,11 +2604,12 @@
  14.698  EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
  14.699  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.700  {
  14.701 -	lldebugs << "LLToolDragAndDrop::dadUpdateInventory()" << llendl;
  14.702 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dadUpdateInventory()"
  14.703 +							 << LL_ENDL;
  14.704  
  14.705  	// *HACK: In order to resolve SL-22177, we need to block drags
  14.706  	// from notecards and objects onto other objects.
  14.707 -	if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
  14.708 +	if (mSource == SOURCE_WORLD || mSource == SOURCE_NOTECARD)
  14.709  	{
  14.710  		return ACCEPT_NO;
  14.711  	}
  14.712 @@ -2681,7 +2617,7 @@
  14.713  	LLViewerInventoryItem* item;
  14.714  	LLViewerInventoryCategory* cat;
  14.715  	locateInventory(item, cat);
  14.716 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.717 +	if(!item || !item->isFinished()) return ACCEPT_NO;
  14.718  	LLViewerObject* root_object = obj;
  14.719  	if (obj && obj->getParent())
  14.720  	{
  14.721 @@ -2693,7 +2629,7 @@
  14.722  	}
  14.723  
  14.724  	EAcceptance rv = willObjectAcceptInventory(root_object, item);
  14.725 -	if(root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
  14.726 +	if (root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
  14.727  	{
  14.728  		dropInventory(root_object, item, mSource, mSourceID);
  14.729  	}
  14.730 @@ -2709,8 +2645,9 @@
  14.731  EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
  14.732  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.733  {
  14.734 -	lldebugs << "LLToolDragAndDrop::dad3dUpdateInventoryCategory()" << llendl;
  14.735 -	if (NULL==obj)
  14.736 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dUpdateInventoryCategory()"
  14.737 +							 << LL_ENDL;
  14.738 +	if (!obj)
  14.739  	{
  14.740  		llwarns << "obj is NULL; aborting func with ACCEPT_NO" << llendl;
  14.741  		return ACCEPT_NO;
  14.742 @@ -2720,12 +2657,17 @@
  14.743  	{
  14.744  		return ACCEPT_NO;
  14.745  	}
  14.746 -	if(obj->isAttachment()) return ACCEPT_NO_LOCKED;
  14.747 +	if (obj->isAttachment())
  14.748 +	{
  14.749 +		return ACCEPT_NO_LOCKED;
  14.750 +	}
  14.751  	LLViewerInventoryItem* item;
  14.752  	LLViewerInventoryCategory* cat;
  14.753  	locateInventory(item, cat);
  14.754 -	if(!cat) return ACCEPT_NO;
  14.755 -	EAcceptance rv = ACCEPT_NO;
  14.756 +	if (!cat) 
  14.757 +	{
  14.758 +		return ACCEPT_NO;
  14.759 +	}
  14.760  
  14.761  	// find all the items in the category
  14.762  	LLDroppableItem droppable(!obj->permYouOwner());
  14.763 @@ -2751,6 +2693,8 @@
  14.764  		}
  14.765  	}
  14.766  
  14.767 +	EAcceptance rv = ACCEPT_NO;
  14.768 +
  14.769  	// Check for accept
  14.770  	S32 i;
  14.771  	S32 count = cats.count();
  14.772 @@ -2759,8 +2703,8 @@
  14.773  		rv = gInventory.isCategoryComplete(cats.get(i)->getUUID()) ? ACCEPT_YES_MULTI : ACCEPT_NO;
  14.774  		if(rv < ACCEPT_YES_SINGLE)
  14.775  		{
  14.776 -			lldebugs << "Category " << cats.get(i)->getUUID()
  14.777 -					 << "is not complete." << llendl;
  14.778 +			LL_DEBUGS("DragAndDrop") << "Category " << cats.get(i)->getUUID()
  14.779 +									 << "is not complete." << LL_ENDL;
  14.780  			break;
  14.781  		}
  14.782  	}
  14.783 @@ -2769,18 +2713,26 @@
  14.784  		count = items.count();
  14.785  		for(i = 0; i < count; ++i)
  14.786  		{
  14.787 +			/*
  14.788 +			// Pass the base objects, not the links.
  14.789 +			if (item && item->getIsLinkType())
  14.790 +			{
  14.791 +				item = item->getLinkedItem();
  14.792 +				(*item_iter) = item;
  14.793 +			}
  14.794 +			*/
  14.795  			rv = willObjectAcceptInventory(root_object, items.get(i));
  14.796  			if(rv < ACCEPT_YES_COPY_SINGLE)
  14.797  			{
  14.798 -				lldebugs << "Object will not accept "
  14.799 -						 << items.get(i)->getUUID() << llendl;
  14.800 +				LL_DEBUGS("DragAndDrop") << "Object will not accept "
  14.801 +										 << items.get(i)->getUUID() << LL_ENDL;
  14.802  				break;
  14.803  			}
  14.804  		}
  14.805  	}
  14.806  
  14.807 -	// if every item is accepted, go ahead and send it on.
  14.808 -	if(drop && (ACCEPT_YES_COPY_SINGLE <= rv))
  14.809 +	// if every item is accepted, send it on.
  14.810 +	if (drop && ACCEPT_YES_COPY_SINGLE <= rv)
  14.811  	{
  14.812  		S32 count = items.count();
  14.813  		LLInventoryFetchObserver::item_ref_t ids;
  14.814 @@ -2792,7 +2744,7 @@
  14.815  		LLCategoryDropObserver* dropper;
  14.816  		dropper = new LLCategoryDropObserver(obj->getID(), mSource);
  14.817  		dropper->fetchItems(ids);
  14.818 -		if(dropper->isEverythingComplete())
  14.819 +		if (dropper->isFinished())
  14.820  		{
  14.821  			dropper->done();
  14.822  		}
  14.823 @@ -2814,7 +2766,8 @@
  14.824  EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
  14.825  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.826  {
  14.827 -	lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << llendl;
  14.828 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dGiveInventoryObject()"
  14.829 +							 << LL_ENDL;
  14.830  
  14.831  	// item has to be in agent inventory.
  14.832  	if(mSource != SOURCE_AGENT) return ACCEPT_NO;
  14.833 @@ -2823,8 +2776,8 @@
  14.834  	LLViewerInventoryItem* item;
  14.835  	LLViewerInventoryCategory* cat;
  14.836  	locateInventory(item, cat);
  14.837 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.838 -	if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
  14.839 +	if (!item || !item->isFinished()) return ACCEPT_NO;
  14.840 +	if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
  14.841  	{
  14.842  		// cannot give away no-transfer objects
  14.843  		return ACCEPT_NO;
  14.844 @@ -2852,14 +2805,15 @@
  14.845  EAcceptance LLToolDragAndDrop::dad3dGiveInventory(
  14.846  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.847  {
  14.848 -	lldebugs << "LLToolDragAndDrop::dad3dGiveInventory()" << llendl;
  14.849 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dGiveInventory()"
  14.850 +							 << LL_ENDL;
  14.851  	// item has to be in agent inventory.
  14.852  	if(mSource != SOURCE_AGENT) return ACCEPT_NO;
  14.853  	LLViewerInventoryItem* item;
  14.854  	LLViewerInventoryCategory* cat;
  14.855  	locateInventory(item, cat);
  14.856 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.857 -	if(!isInventoryGiveAcceptable(item))
  14.858 +	if (!item || !item->isFinished()) return ACCEPT_NO;
  14.859 +	if (!isInventoryGiveAcceptable(item))
  14.860  	{
  14.861  		return ACCEPT_NO;
  14.862  	}
  14.863 @@ -2875,7 +2829,8 @@
  14.864  EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory(
  14.865  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.866  {
  14.867 -	lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << llendl;
  14.868 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dGiveInventoryCategory()"
  14.869 +							 << LL_ENDL;
  14.870  	if(drop && obj)
  14.871  	{
  14.872  		LLViewerInventoryItem* item;
  14.873 @@ -2893,11 +2848,12 @@
  14.874  EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand(
  14.875  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.876  {
  14.877 -	lldebugs << "LLToolDragAndDrop::dad3dRezFromObjectOnLand()" << llendl;
  14.878 -	LLViewerInventoryItem* item = NULL;
  14.879 -	LLViewerInventoryCategory* cat = NULL;
  14.880 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dRezFromObjectOnLand()"
  14.881 +							 << LL_ENDL;
  14.882 +	LLViewerInventoryItem* item;
  14.883 +	LLViewerInventoryCategory* cat;
  14.884  	locateInventory(item, cat);
  14.885 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.886 +	if(!item || !item->isFinished()) return ACCEPT_NO;
  14.887  
  14.888  	if(!gAgent.allowOperation(PERM_COPY, item->getPermissions())
  14.889  		|| !item->getPermissions().allowTransferTo(LLUUID::null))
  14.890 @@ -2914,11 +2870,12 @@
  14.891  EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject(
  14.892  	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
  14.893  {
  14.894 -	lldebugs << "LLToolDragAndDrop::dad3dRezFromObjectOnObject()" << llendl;
  14.895 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dRezFromObjectOnObject()"
  14.896 +							 << LL_ENDL;
  14.897  	LLViewerInventoryItem* item;
  14.898  	LLViewerInventoryCategory* cat;
  14.899  	locateInventory(item, cat);
  14.900 -	if(!item || !item->isComplete()) return ACCEPT_NO;
  14.901 +	if(!item || !item->isFinished()) return ACCEPT_NO;
  14.902  	if((mask & MASK_CONTROL))
  14.903  	{
  14.904  		// *HACK: In order to resolve SL-22177, we need to block drags
  14.905 @@ -2951,7 +2908,8 @@
  14.906  {
  14.907  	return ACCEPT_NO;
  14.908  	/*
  14.909 -	lldebugs << "LLToolDragAndDrop::dad3dCategoryOnLand()" << llendl;
  14.910 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dCategoryOnLand()"
  14.911 +							 << LL_ENDL;
  14.912  	LLInventoryItem* item;
  14.913  	LLInventoryCategory* cat;
  14.914  	locateInventory(item, cat);
  14.915 @@ -2989,7 +2947,8 @@
  14.916  {
  14.917  	return ACCEPT_NO;
  14.918  	/*
  14.919 -	lldebugs << "LLToolDragAndDrop::dad3dAssetOnLand()" << llendl;
  14.920 +	LL_DEBUGS("DragAndDrop") << "LLToolDragAndDrop::dad3dAssetOnLand()"
  14.921 +							 << LL_ENDL;
  14.922  	LLViewerInventoryCategory::cat_array_t cats;
  14.923  	LLViewerInventoryItem::item_array_t items;
  14.924  	LLViewerInventoryItem::item_array_t copyable_items;
  14.925 @@ -3021,8 +2980,8 @@
  14.926  {
  14.927  	item = NULL;
  14.928  	cat = NULL;
  14.929 -	if(mCargoIDs.empty()) return NULL;
  14.930 -	if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
  14.931 +	if (mCargoIDs.empty()) return NULL;
  14.932 +	if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
  14.933  	{
  14.934  		// The object should be in user inventory.
  14.935  		item = (LLViewerInventoryItem*)gInventory.getItem(mCargoIDs[mCurItemIndex]);
  14.936 @@ -3063,8 +3022,8 @@
  14.937  LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryCategory::cat_array_t& cats,
  14.938  															  LLViewerInventoryItem::item_array_t& items)
  14.939  {
  14.940 -	if(mCargoIDs.count() == 0) return NULL;
  14.941 -	if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
  14.942 +	if (mCargoIDs.count() == 0) return NULL;
  14.943 +	if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
  14.944  	{
  14.945  		// The object should be in user inventory.
  14.946  		for (S32 i = 0; i < mCargoIDs.count(); i++)
    15.1 --- a/indra/newview/lltooldraganddrop.h	Sat Jan 07 17:05:31 2012 +0100
    15.2 +++ b/indra/newview/lltooldraganddrop.h	Sun Jan 15 13:43:22 2012 +0100
    15.3 @@ -33,15 +33,18 @@
    15.4  #ifndef LL_TOOLDRAGANDDROP_H
    15.5  #define LL_TOOLDRAGANDDROP_H
    15.6  
    15.7 -#include "lltool.h"
    15.8 -#include "llview.h"
    15.9 -#include "lluuid.h"
   15.10  #include "stdenums.h"
   15.11 +
   15.12  #include "llassetstorage.h"
   15.13  #include "lldarray.h"
   15.14 +#include "lldictionary.h"
   15.15  #include "llpermissions.h"
   15.16 +#include "lltool.h"
   15.17 +#include "lluuid.h"
   15.18 +#include "llview.h"
   15.19 +
   15.20 +#include "llviewerinventory.h"
   15.21  #include "llwindow.h"
   15.22 -#include "llviewerinventory.h"
   15.23  
   15.24  class LLToolDragAndDrop;
   15.25  class LLViewerRegion;
   15.26 @@ -131,10 +134,6 @@
   15.27  	S32				mCurItemIndex;
   15.28  	std::string		mToolTipMsg;
   15.29  
   15.30 -	// array of pointers to functions that implement the logic to
   15.31 -	// dragging and dropping into the simulator.
   15.32 -	static dragOrDrop3dImpl sDragAndDrop3d[DAD_COUNT][DT_COUNT];
   15.33 -
   15.34  protected:
   15.35  	// 3d drop functions. these call down into the static functions
   15.36  	// named drop<ThingToDrop> if drop is TRUE and permissions allow
   15.37 @@ -278,6 +277,25 @@
   15.38  									  EDragAndDropType cargo_type,
   15.39  									  void* cargo_data,
   15.40  									  EAcceptance* accept);
   15.41 +
   15.42 +	// Classes used for determining 3d drag and drop types.
   15.43 +private:
   15.44 +	struct DragAndDropEntry : public LLDictionaryEntry
   15.45 +	{
   15.46 +		DragAndDropEntry(dragOrDrop3dImpl f_none,
   15.47 +						 dragOrDrop3dImpl f_self,
   15.48 +						 dragOrDrop3dImpl f_avatar,
   15.49 +						 dragOrDrop3dImpl f_object,
   15.50 +						 dragOrDrop3dImpl f_land);
   15.51 +		dragOrDrop3dImpl mFunctions[DT_COUNT];
   15.52 +	};
   15.53 +	class LLDragAndDropDictionary : public LLSingleton<LLDragAndDropDictionary>,
   15.54 +									public LLDictionary<EDragAndDropType, DragAndDropEntry>
   15.55 +	{
   15.56 +	public:
   15.57 +		LLDragAndDropDictionary();
   15.58 +		dragOrDrop3dImpl get(EDragAndDropType dad_type, EDropTarget drop_target);
   15.59 +	};
   15.60  };
   15.61  
   15.62  // utility functions
    16.1 --- a/indra/newview/llurldispatcher.cpp	Sat Jan 07 17:05:31 2012 +0100
    16.2 +++ b/indra/newview/llurldispatcher.cpp	Sun Jan 15 13:43:22 2012 +0100
    16.3 @@ -50,15 +50,15 @@
    16.4  // library includes
    16.5  #include "llsd.h"
    16.6  
    16.7 -const std::string SLURL_SL_HELP_PREFIX		= "secondlife://app.";
    16.8 -const std::string SLURL_SL_PREFIX			= "sl://";
    16.9 -const std::string SLURL_SECONDLIFE_PREFIX	= "secondlife://";
   16.10 -const std::string SLURL_SLURL_PREFIX		= "http://slurl.com/secondlife/";
   16.11 -const std::string SLURL_SLURL_ALT_PREFIX	= "http://maps.secondlife.com/secondlife/";
   16.12 -const std::string SLURL_SLMARKETPLACE_PREFIX	= "https://marketplace.secondlife.com/";
   16.13 -const std::string SLURL_SLMARKETPLACE_ALT_PREFIX	= "http://marketplace.secondlife.com/";
   16.14 +const std::string LLURLDispatcher::SL_HELP_PREFIX		= "secondlife://app.";
   16.15 +const std::string LLURLDispatcher::SL_PREFIX			= "sl://";
   16.16 +const std::string LLURLDispatcher::SECONDLIFE_PREFIX	= "secondlife://";
   16.17 +const std::string LLURLDispatcher::SLURL_PREFIX		= "http://slurl.com/secondlife/";
   16.18 +const std::string LLURLDispatcher::SLURL_ALT_PREFIX	= "http://maps.secondlife.com/secondlife/";
   16.19 +const std::string LLURLDispatcher::SLMARKETPLACE_PREFIX	= "https://marketplace.secondlife.com/";
   16.20 +const std::string LLURLDispatcher::SLMARKETPLACE_ALT_PREFIX	= "http://marketplace.secondlife.com/";
   16.21  
   16.22 -const std::string SLURL_APP_TOKEN = "app/";
   16.23 +const std::string LLURLDispatcher::APP_TOKEN = "app/";
   16.24  
   16.25  class LLURLDispatcherImpl
   16.26  {
   16.27 @@ -122,21 +122,21 @@
   16.28  // static
   16.29  bool LLURLDispatcherImpl::isSLURL(const std::string& url)
   16.30  {
   16.31 -	if (matchPrefix(url, SLURL_SL_HELP_PREFIX)) return true;
   16.32 -	if (matchPrefix(url, SLURL_SL_PREFIX)) return true;
   16.33 -	if (matchPrefix(url, SLURL_SECONDLIFE_PREFIX)) return true;
   16.34 -	if (matchPrefix(url, SLURL_SLURL_PREFIX)) return true;
   16.35 -	if (matchPrefix(url, SLURL_SLURL_ALT_PREFIX)) return true;
   16.36 +	if (matchPrefix(url, LLURLDispatcher::SL_HELP_PREFIX)) return true;
   16.37 +	if (matchPrefix(url, LLURLDispatcher::SL_PREFIX)) return true;
   16.38 +	if (matchPrefix(url, LLURLDispatcher::SECONDLIFE_PREFIX)) return true;
   16.39 +	if (matchPrefix(url, LLURLDispatcher::SLURL_PREFIX)) return true;
   16.40 +	if (matchPrefix(url, LLURLDispatcher::SLURL_ALT_PREFIX)) return true;
   16.41  	return false;
   16.42  }
   16.43  
   16.44  // static
   16.45  bool LLURLDispatcherImpl::isSLURLCommand(const std::string& url)
   16.46  { 
   16.47 -	if (matchPrefix(url, SLURL_SL_PREFIX + SLURL_APP_TOKEN)
   16.48 -		|| matchPrefix(url, SLURL_SECONDLIFE_PREFIX + "/" + SLURL_APP_TOKEN)
   16.49 -		|| matchPrefix(url, SLURL_SLURL_PREFIX + SLURL_APP_TOKEN)
   16.50 -		|| matchPrefix(url, SLURL_SLURL_ALT_PREFIX + SLURL_APP_TOKEN))
   16.51 +	if (matchPrefix(url, LLURLDispatcher::SL_PREFIX + LLURLDispatcher::APP_TOKEN)
   16.52 +		|| matchPrefix(url, LLURLDispatcher::SECONDLIFE_PREFIX + "/" + LLURLDispatcher::APP_TOKEN)
   16.53 +		|| matchPrefix(url, LLURLDispatcher::SLURL_PREFIX + LLURLDispatcher::APP_TOKEN)
   16.54 +		|| matchPrefix(url, LLURLDispatcher::SLURL_ALT_PREFIX + LLURLDispatcher::APP_TOKEN))
   16.55  	{
   16.56  		return true;
   16.57  	}
   16.58 @@ -145,8 +145,8 @@
   16.59  
   16.60  bool LLURLDispatcherImpl::isMarketPlaceURL(const std::string& url)
   16.61  {
   16.62 -	if (matchPrefix(url, SLURL_SLMARKETPLACE_PREFIX)) return true;
   16.63 -	if (matchPrefix(url, SLURL_SLMARKETPLACE_ALT_PREFIX)) return true;
   16.64 +	if (matchPrefix(url, LLURLDispatcher::SLMARKETPLACE_PREFIX)) return true;
   16.65 +	if (matchPrefix(url, LLURLDispatcher::SLMARKETPLACE_ALT_PREFIX)) return true;
   16.66  	return false;
   16.67  }
   16.68  
   16.69 @@ -199,7 +199,7 @@
   16.70  bool LLURLDispatcherImpl::dispatchHelp(const std::string& url, bool right_mouse)
   16.71  {
   16.72  #if LL_LIBXUL_ENABLED
   16.73 -	if (matchPrefix(url, SLURL_SL_HELP_PREFIX))
   16.74 +	if (matchPrefix(url, LLURLDispatcher::SL_HELP_PREFIX))
   16.75  	{
   16.76  		gViewerHtmlHelp.show();
   16.77  		return true;
   16.78 @@ -382,25 +382,25 @@
   16.79  std::string LLURLDispatcherImpl::stripProtocol(const std::string& url)
   16.80  {
   16.81  	std::string stripped = url;
   16.82 -	if (matchPrefix(stripped, SLURL_SL_HELP_PREFIX))
   16.83 +	if (matchPrefix(stripped, LLURLDispatcher::SL_HELP_PREFIX))
   16.84  	{
   16.85 -		stripped.erase(0, SLURL_SL_HELP_PREFIX.length());
   16.86 +		stripped.erase(0, LLURLDispatcher::SL_HELP_PREFIX.length());
   16.87  	}
   16.88 -	else if (matchPrefix(stripped, SLURL_SL_PREFIX))
   16.89 +	else if (matchPrefix(stripped, LLURLDispatcher::SL_PREFIX))
   16.90  	{
   16.91 -		stripped.erase(0, SLURL_SL_PREFIX.length());
   16.92 +		stripped.erase(0, LLURLDispatcher::SL_PREFIX.length());
   16.93  	}
   16.94 -	else if (matchPrefix(stripped, SLURL_SECONDLIFE_PREFIX))
   16.95 +	else if (matchPrefix(stripped, LLURLDispatcher::SECONDLIFE_PREFIX))
   16.96  	{
   16.97 -		stripped.erase(0, SLURL_SECONDLIFE_PREFIX.length());
   16.98 +		stripped.erase(0, LLURLDispatcher::SECONDLIFE_PREFIX.length());
   16.99  	}
  16.100 -	else if (matchPrefix(stripped, SLURL_SLURL_PREFIX))
  16.101 +	else if (matchPrefix(stripped, LLURLDispatcher::SLURL_PREFIX))
  16.102  	{
  16.103 -		stripped.erase(0, SLURL_SLURL_PREFIX.length());
  16.104 +		stripped.erase(0, LLURLDispatcher::SLURL_PREFIX.length());
  16.105  	}
  16.106 -	else if (matchPrefix(stripped, SLURL_SLURL_ALT_PREFIX))
  16.107 +	else if (matchPrefix(stripped, LLURLDispatcher::SLURL_ALT_PREFIX))
  16.108  	{
  16.109 -		stripped.erase(0, SLURL_SLURL_ALT_PREFIX.length());
  16.110 +		stripped.erase(0, LLURLDispatcher::SLURL_ALT_PREFIX.length());
  16.111  	}
  16.112  	return stripped;
  16.113  }
  16.114 @@ -427,7 +427,7 @@
  16.115  		std::string region_name = LLURLSimString::unescapeRegionName(tokens[0]);
  16.116  
  16.117  		// build secondlife://De%20Haro/123/45/67 for use in callback
  16.118 -		std::string url = SLURL_SECONDLIFE_PREFIX;
  16.119 +		std::string url = LLURLDispatcher::SECONDLIFE_PREFIX;
  16.120  		for (int i = 0; i < tokens.size(); ++i)
  16.121  		{
  16.122  			url += tokens[i].asString() + "/";
  16.123 @@ -495,7 +495,7 @@
  16.124  std::string LLURLDispatcher::buildSLURL(const std::string& regionname,
  16.125  										S32 x, S32 y, S32 z)
  16.126  {
  16.127 -	std::string slurl = SLURL_SLURL_PREFIX + regionname + llformat("/%d/%d/%d",x,y,z); 
  16.128 +	std::string slurl = LLURLDispatcher::SLURL_PREFIX + regionname + llformat("/%d/%d/%d",x,y,z); 
  16.129  	slurl = LLWeb::escapeURL( slurl );
  16.130  	return slurl;
  16.131  }
    17.1 --- a/indra/newview/llurldispatcher.h	Sat Jan 07 17:05:31 2012 +0100
    17.2 +++ b/indra/newview/llurldispatcher.h	Sun Jan 15 13:43:22 2012 +0100
    17.3 @@ -66,6 +66,15 @@
    17.4  
    17.5  	static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
    17.6  		//   builds: http://slurl.com/secondlife/RegionName/x/y/z/
    17.7 +
    17.8 +	static const std::string SL_HELP_PREFIX;
    17.9 +	static const std::string SL_PREFIX;
   17.10 +	static const std::string SECONDLIFE_PREFIX;
   17.11 +	static const std::string SLURL_PREFIX;
   17.12 +	static const std::string SLURL_ALT_PREFIX;
   17.13 +	static const std::string SLMARKETPLACE_PREFIX;
   17.14 +	static const std::string SLMARKETPLACE_ALT_PREFIX;
   17.15 +	static const std::string APP_TOKEN;
   17.16  };
   17.17  
   17.18  #endif
    18.1 --- a/indra/newview/llviewerinventory.cpp	Sat Jan 07 17:05:31 2012 +0100
    18.2 +++ b/indra/newview/llviewerinventory.cpp	Sun Jan 15 13:43:22 2012 +0100
    18.3 @@ -197,19 +197,30 @@
    18.4  
    18.5  void LLViewerInventoryItem::fetchFromServer(void) const
    18.6  {
    18.7 -	if(!mIsComplete)
    18.8 +	if (!mIsComplete)
    18.9  	{
   18.10 -		std::string url; 
   18.11 -
   18.12 -		if( ALEXANDRIA_LINDEN_ID.getString() == mPermissions.getOwner().getString())
   18.13 -			url = gAgent.getRegion()->getCapability("FetchLib");
   18.14 -		else	
   18.15 -			url = gAgent.getRegion()->getCapability("FetchInventory");
   18.16 +		std::string url;
   18.17 +		if (gAgent.getID() != mPermissions.getOwner())
   18.18 +		{
   18.19 +			url = gAgent.getRegion()->getCapability("FetchLib2");
   18.20 +			if (url.empty())
   18.21 +			{
   18.22 +				url = gAgent.getRegion()->getCapability("FetchLib");
   18.23 +			}
   18.24 +		}
   18.25 +		else
   18.26 +		{
   18.27 +			url = gAgent.getRegion()->getCapability("FetchInventory2");
   18.28 +			if (url.empty())
   18.29 +			{
   18.30 +				url = gAgent.getRegion()->getCapability("FetchInventory");
   18.31 +			}
   18.32 +		}
   18.33  
   18.34  		if (!url.empty())
   18.35  		{
   18.36  			LLSD body;
   18.37 -			body["agent_id"]	= gAgent.getID();
   18.38 +			body["agent_id"]				= gAgent.getID();
   18.39  			body["items"][0]["owner_id"]	= mPermissions.getOwner();
   18.40  			body["items"][0]["item_id"]		= mUUID;
   18.41  
    19.1 --- a/indra/newview/llviewerinventory.h	Sat Jan 07 17:05:31 2012 +0100
    19.2 +++ b/indra/newview/llviewerinventory.h	Sun Jan 15 13:43:22 2012 +0100
    19.3 @@ -122,7 +122,7 @@
    19.4  	bool importFileLocal(LLFILE* fp);
    19.5  
    19.6  	// new methods
    19.7 -	BOOL isComplete() const { return mIsComplete; }
    19.8 +	BOOL isFinished() const { return mIsComplete; }
    19.9  	void setComplete(BOOL complete) { mIsComplete = complete; }
   19.10  	//void updateAssetOnServer() const;
   19.11  // [RLVa:KB] - Checked: 2010-09-27 (RLVa-1.1.3a) | Added: RLVa-1.1.3a
    20.1 --- a/indra/newview/llviewermenu.cpp	Sat Jan 07 17:05:31 2012 +0100
    20.2 +++ b/indra/newview/llviewermenu.cpp	Sun Jan 15 13:43:22 2012 +0100
    20.3 @@ -4528,9 +4528,12 @@
    20.4  		return;
    20.5  	}
    20.6  	
    20.7 -	BOOL you_own_everything = TRUE;
    20.8 -	BOOL locked_but_takeable_object = FALSE;
    20.9 -	LLUUID category_id;
   20.10 +	bool you_own_everything = true;
   20.11 +	bool locked_but_takeable_object = false;
   20.12 +	bool ambiguous_destination = false;
   20.13 +	LLUUID category_id, new_cat_id;
   20.14 +	LLUUID trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
   20.15 +	LLUUID library = gInventory.getLibraryRootFolderID();
   20.16  	
   20.17  	for (LLObjectSelection::root_iterator iter = LLSelectMgr::getInstance()->getSelection()->root_begin();
   20.18  		 iter != LLSelectMgr::getInstance()->getSelection()->root_end(); iter++)
   20.19 @@ -4541,69 +4544,45 @@
   20.20  		{
   20.21  			if(!object->permYouOwner())
   20.22  			{
   20.23 -				you_own_everything = FALSE;
   20.24 +				you_own_everything = false;
   20.25  			}
   20.26  
   20.27  			if(!object->permMove())
   20.28  			{
   20.29 -				locked_but_takeable_object = TRUE;
   20.30 +				locked_but_takeable_object = true;
   20.31  			}
   20.32  		}
   20.33 -		if(node->mFolderID.notNull())
   20.34 +		new_cat_id = node->mFolderID;
   20.35 +		// Check that the category exists and is not inside the trash
   20.36 +		// neither inside the library...
   20.37 +		if (!ambiguous_destination && new_cat_id.notNull() &&
   20.38 +			gInventory.getCategory(new_cat_id) && new_cat_id != trash &&
   20.39 +			!gInventory.isObjectDescendentOf(new_cat_id, trash) &&
   20.40 +			!gInventory.isObjectDescendentOf(new_cat_id, library))
   20.41  		{
   20.42  			if(category_id.isNull())
   20.43  			{
   20.44 -				category_id = node->mFolderID;
   20.45 +				category_id = new_cat_id;
   20.46  			}
   20.47  			else if(category_id != node->mFolderID)
   20.48  			{
   20.49 -				// we have found two potential destinations. break out
   20.50 -				// now and send to the default location.
   20.51 -				category_id.setNull();
   20.52 -				break;
   20.53 +				// We have found two potential destinations.
   20.54 +				ambiguous_destination = true;
   20.55  			}
   20.56  		}
   20.57  	}
   20.58 -	if(category_id.notNull())
   20.59 -	{
   20.60 -		// there is an unambiguous destination. See if this agent has
   20.61 -		// such a location and it is not in the trash or library
   20.62 -		if(!gInventory.getCategory(category_id))
   20.63 -		{
   20.64 -			// nope, set to NULL.
   20.65 -			category_id.setNull();
   20.66 -		}
   20.67 -		if(category_id.notNull())
   20.68 -		{
   20.69 -		        // check trash
   20.70 -			LLUUID trash;
   20.71 -			trash = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
   20.72 -			if(category_id == trash || gInventory.isObjectDescendentOf(category_id, trash))
   20.73 -			{
   20.74 -				category_id.setNull();
   20.75 -			}
   20.76 -
   20.77 -			// check library
   20.78 -			if (gInventory.isObjectDescendentOf(category_id, gInventory.getRootFolderID()))
   20.79 -			{
   20.80 -				category_id.setNull();
   20.81 -			}
   20.82 -
   20.83 -		}
   20.84 -	}
   20.85 -	if(category_id.isNull())
   20.86 -	{
   20.87 +	if (ambiguous_destination || category_id.isNull())
   20.88 +	{
   20.89 +		// Use the default "Objects" category.
   20.90  		category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
   20.91  	}
   20.92 +
   20.93  	LLSD payload;
   20.94  	payload["folder_id"] = category_id;
   20.95  
   20.96  	LLNotification::Params params("ConfirmObjectTakeLock");
   20.97 -	params.payload(payload)
   20.98 -		.functor(confirm_take);
   20.99 -
  20.100 -	if(locked_but_takeable_object ||
  20.101 -	   !you_own_everything)
  20.102 +	params.payload(payload).functor(confirm_take);
  20.103 +	if (locked_but_takeable_object || !you_own_everything)
  20.104  	{
  20.105  		if(locked_but_takeable_object && you_own_everything)
  20.106  		{
    21.1 --- a/indra/newview/llviewermessage.cpp	Sat Jan 07 17:05:31 2012 +0100
    21.2 +++ b/indra/newview/llviewermessage.cpp	Sun Jan 15 13:43:22 2012 +0100
    21.3 @@ -968,7 +968,6 @@
    21.4  		}
    21.5  
    21.6  		LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
    21.7 -		//BOOL inventory_has_focus = gFocusMgr.childHasKeyboardFocus(view);
    21.8  		BOOL user_is_away = gAwayTimer.getStarted();
    21.9  
   21.10  		// don't select lost and found items if the user is active
   21.11 @@ -979,6 +978,7 @@
   21.12  
   21.13  		//Not sure about this check.  Could make it easy to miss incoming items.
   21.14  		//don't dick with highlight while the user is working
   21.15 +		//BOOL inventory_has_focus = gFocusMgr.childHasKeyboardFocus(view);
   21.16  		//if(inventory_has_focus && !user_is_away)
   21.17  		//	break;
   21.18  		LL_DEBUGS("Messaging") << "Highlighting" << item->getUUID()  << LL_ENDL;
   21.19 @@ -1272,7 +1272,7 @@
   21.20  				LLInventoryFetchComboObserver::folder_ref_t folders;
   21.21  				folders.push_back(mObjectID);
   21.22  				pOffer->fetchDescendents(folders);
   21.23 -				if (pOffer->isEverythingComplete())
   21.24 +				if (pOffer->isFinished())
   21.25  					pOffer->done();
   21.26  				else
   21.27  					gInventory.addObserver(pOffer);
   21.28 @@ -1284,7 +1284,7 @@
   21.29  			items.push_back(mObjectID);
   21.30  			LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string);
   21.31  			open_agent_offer->fetchItems(items);
   21.32 -			if(catp || (itemp && itemp->isComplete()))
   21.33 +			if(catp || (itemp && itemp->isFinished()))
   21.34  			{
   21.35  				open_agent_offer->done();
   21.36  			}
   21.37 @@ -1324,7 +1324,7 @@
   21.38  		items.push_back(mObjectID);
   21.39  		LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string);
   21.40  		open_agent_offer->fetchItems(items);
   21.41 -		if(catp || (itemp && itemp->isComplete()))
   21.42 +		if(catp || (itemp && itemp->isFinished()))
   21.43  		{
   21.44  			open_agent_offer->done();
   21.45  		}
   21.46 @@ -1384,7 +1384,7 @@
   21.47  			LLDiscardAgentOffer* discard_agent_offer;
   21.48  			discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID);
   21.49  			discard_agent_offer->fetch(folders, items);
   21.50 -			if(catp || (itemp && itemp->isComplete()))
   21.51 +			if(catp || (itemp && itemp->isFinished()))
   21.52  			{
   21.53  				discard_agent_offer->done();
   21.54  			}
   21.55 @@ -3819,7 +3819,7 @@
   21.56  		{
   21.57  			LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea;
   21.58  			fetcher->fetchDescendents(folders);
   21.59 -			if(fetcher->isEverythingComplete())
   21.60 +			if(fetcher->isFinished())
   21.61  			{
   21.62  				fetcher->done();
   21.63  			}
    22.1 --- a/indra/newview/llviewerregion.cpp	Sat Jan 07 17:05:31 2012 +0100
    22.2 +++ b/indra/newview/llviewerregion.cpp	Sun Jan 15 13:43:22 2012 +0100
    22.3 @@ -1427,19 +1427,27 @@
    22.4  	LLSD capabilityNames = LLSD::emptyArray();
    22.5  	capabilityNames.append("ChatSessionRequest");
    22.6  	capabilityNames.append("CopyInventoryFromNotecard");
    22.7 +	capabilityNames.append("CreateInventoryCategory");
    22.8  	capabilityNames.append("DispatchRegionInfo");
    22.9  	capabilityNames.append("EstateChangeInfo");
   22.10  	capabilityNames.append("EventQueueGet");
   22.11  	capabilityNames.append("EnvironmentSettings");
   22.12 -	capabilityNames.append("FetchInventory");
   22.13 -	capabilityNames.append("FetchLib");
   22.14 -	capabilityNames.append("FetchLibDescendents");
   22.15  	if (gSavedSettings.getBOOL("UseHTTPInventory"))
   22.16  	{
   22.17 +		// Legacy capabilities: deprecate ? May be still used by OpenSim...
   22.18 +		capabilityNames.append("FetchInventory");
   22.19 +		capabilityNames.append("FetchLib");
   22.20 +		capabilityNames.append("FetchLibDescendents");
   22.21 +		// OGPX : since this is asking the region leave the old naming in
   22.22 +		// place, on agent domain it is now called agent/inventory. Both
   22.23 +		// caps have the same LLSD returned.
   22.24 +		capabilityNames.append("WebFetchInventoryDescendents");
   22.25 +
   22.26 +		// New SL capabilities
   22.27 +		capabilityNames.append("FetchInventory2");
   22.28 +		capabilityNames.append("FetchInventoryDescendents2");
   22.29  		capabilityNames.append("FetchLib2");
   22.30  		capabilityNames.append("FetchLibDescendents2");
   22.31 -		capabilityNames.append("FetchInventory2");
   22.32 -		capabilityNames.append("FetchInventoryDescendents2");
   22.33  	}
   22.34  	capabilityNames.append("GetMesh");
   22.35  	capabilityNames.append("GetObjectCost");
   22.36 @@ -1484,10 +1492,6 @@
   22.37  	capabilityNames.append("UploadBakedTexture");
   22.38  	capabilityNames.append("ViewerStartAuction");
   22.39  	capabilityNames.append("ViewerStats");
   22.40 -	capabilityNames.append("WebFetchInventoryDescendents"); // OGPX : since this is asking the region
   22.41 -															// leave the old naming in place, on agent domain
   22.42 -															// it is now called agent/inventory. Both
   22.43 -															// caps have the same LLSD returned.
   22.44  	// Please add new capabilities alphabetically to reduce
   22.45  	// merge conflicts.
   22.46  
    23.1 --- a/indra/newview/llwearable.cpp	Sat Jan 07 17:05:31 2012 +0100
    23.2 +++ b/indra/newview/llwearable.cpp	Sun Jan 15 13:43:22 2012 +0100
    23.3 @@ -717,7 +717,7 @@
    23.4  		if(item)
    23.5  		{
    23.6  			perm_mask = item->getPermissions().getMaskOwner();
    23.7 -			is_complete = item->isComplete();
    23.8 +			is_complete = item->isFinished();
    23.9  			if(!is_complete)
   23.10  			{
   23.11  				item->fetchFromServer();
    24.1 --- a/indra/newview/rlvinventory.cpp	Sat Jan 07 17:05:31 2012 +0100
    24.2 +++ b/indra/newview/rlvinventory.cpp	Sun Jan 15 13:43:22 2012 +0100
    24.3 @@ -118,7 +118,7 @@
    24.4  	pFetcher->fetchDescendents(fetchFolders);
    24.5  	m_fFetchStarted = true;
    24.6  
    24.7 -	if (pFetcher->isEverythingComplete())
    24.8 +	if (pFetcher->isFinished())
    24.9  		pFetcher->done();
   24.10  	else
   24.11  		gInventory.addObserver(pFetcher);
    25.1 --- a/indra/newview/rlvviewer2.cpp	Sat Jan 07 17:05:31 2012 +0100
    25.2 +++ b/indra/newview/rlvviewer2.cpp	Sun Jan 15 13:43:22 2012 +0100
    25.3 @@ -73,7 +73,7 @@
    25.4  		{
    25.5  			const LLUUID& item_id = (*it);
    25.6  			LLViewerInventoryItem* item = gInventory.getItem(item_id);
    25.7 -			if (item && item->isComplete())
    25.8 +			if (item && item->isFinished())
    25.9  			{
   25.10  				mComplete.push_back(item_id);
   25.11  				it = mIncomplete.erase(it);
   25.12 @@ -115,7 +115,7 @@
   25.13  		LLViewerInventoryItem* item = gInventory.getItem(*it);
   25.14  		if (item)
   25.15  		{
   25.16 -			if (item->isComplete())
   25.17 +			if (item->isFinished())
   25.18  			{
   25.19  				// It's complete, so put it on the complete container.
   25.20  				mComplete.push_back(*it);

mercurial