From a00af78b95a62c613f9a2ac4a28a0017086c5ffa Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Wed, 24 Jun 2009 21:36:42 +0000
Subject: merge -r125267:125272
 svn+ssh://svn.lindenlab.com/svn/linden/branches/avatar-pipeline/inventory-links__merge__viewer2.0.0-3-r125202
 to svn+ssh://svn.lindenlab.com/svn/linden/branches/viewer/viewer-2.0.0-3

---
 indra/llinventory/llinventory.cpp     | 27 +++++++++++++++++++++++++++
 indra/llinventory/llinventory.h       | 22 +++++++++++++---------
 indra/llinventory/llinventorytype.cpp |  4 +++-
 3 files changed, 43 insertions(+), 10 deletions(-)

(limited to 'indra/llinventory')

diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index adc80b2ed3..597e19e7ea 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -126,6 +126,20 @@ const std::string& LLInventoryObject::getName() const
 	return mName;
 }
 
+// To bypass linked items, since llviewerinventory's getType
+// will return the linked-to item's type instead of this object's type.
+LLAssetType::EType LLInventoryObject::getActualType() const
+{
+	return mType;
+}
+
+// See LLInventoryItem override.
+// virtual
+const LLUUID& LLInventoryObject::getLinkedUUID() const
+{
+	return mUUID;
+}
+
 LLAssetType::EType LLInventoryObject::getType() const
 {
 	return mType;
@@ -333,6 +347,19 @@ void LLInventoryItem::copyItem(const LLInventoryItem* other)
 	mCreationDate = other->mCreationDate;
 }
 
+// If this is a linked item, then the UUID of the base object is
+// this item's assetID.
+// virtual
+const LLUUID& LLInventoryItem::getLinkedUUID() const
+{
+	if (LLAssetType::lookupIsLinkType(getActualType()))
+	{
+		return mAssetUUID;
+	}
+
+	return LLInventoryObject::getLinkedUUID();
+}
+
 const LLPermissions& LLInventoryItem::getPermissions() const
 {
 	return mPermissions;
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index 3f79cedc23..ce64317f48 100644
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -92,9 +92,12 @@ public:
 	// accessors
 	virtual const LLUUID& getUUID() const;
 	const LLUUID& getParentUUID() const;
+	virtual const LLUUID& getLinkedUUID() const; // get the inventoryID that this item points to, else this item's inventoryID
+
 	virtual const std::string& getName() const;
 	virtual LLAssetType::EType getType() const;
-	LLAssetType::EType getActualType() const { return mType; }
+	LLAssetType::EType getActualType() const; // bypasses indirection for linked items
+
 	// mutators - will not call updateServer();
 	void setUUID(const LLUUID& new_uuid);
 	void rename(const std::string& new_name);
@@ -240,15 +243,16 @@ public:
 	void generateUUID() { mUUID.generate(); }
 	
 	// accessors
-	const LLPermissions& getPermissions() const;
-	const LLUUID& getCreatorUUID() const;
+	virtual const LLUUID& getLinkedUUID() const;
+	virtual const LLPermissions& getPermissions() const;
+	virtual const LLUUID& getCreatorUUID() const;
 	virtual const LLUUID& getAssetUUID() const;
-	const std::string& getDescription() const;
-	const LLSaleInfo& getSaleInfo() const;
-	LLInventoryType::EType getInventoryType() const;
-	U32 getFlags() const;
-	time_t getCreationDate() const;
-	U32 getCRC32() const; // really more of a checksum.
+	virtual const std::string& getDescription() const;
+	virtual const LLSaleInfo& getSaleInfo() const;
+	virtual LLInventoryType::EType getInventoryType() const;
+	virtual U32 getFlags() const;
+	virtual time_t getCreationDate() const;
+	virtual U32 getCRC32() const; // really more of a checksum.
 	
 	// mutators - will not call updateServer(), and will never fail
 	// (though it may correct to sane values)
diff --git a/indra/llinventory/llinventorytype.cpp b/indra/llinventory/llinventorytype.cpp
index ff9c698943..2dc229226f 100644
--- a/indra/llinventory/llinventorytype.cpp
+++ b/indra/llinventory/llinventorytype.cpp
@@ -113,8 +113,10 @@ DEFAULT_ASSET_FOR_INV_TYPE[LLAssetType::AT_COUNT] =
 	LLInventoryType::IT_NONE,			// AT_IMAGE_JPEG
 	LLInventoryType::IT_ANIMATION,		// AT_ANIMATION
 	LLInventoryType::IT_GESTURE,		// AT_GESTURE
-	LLInventoryType::IT_NONE,			// AT_LINK
+	LLInventoryType::IT_NONE,			// AT_SIMSTATE
 	LLInventoryType::IT_FAVORITE,		// AT_FAVORITE
+	LLInventoryType::IT_NONE,			// AT_LINK
+	LLInventoryType::IT_NONE,			// AT_LINK_FOLDER
 };
 
 InventoryEntry::InventoryEntry(const std::string &name,
-- 
cgit v1.2.3