summaryrefslogtreecommitdiff
path: root/indra/llinventory/llinventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llinventory/llinventory.cpp')
-rw-r--r--indra/llinventory/llinventory.cpp62
1 files changed, 47 insertions, 15 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index d665deb605..5d3fbe5128 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -1324,7 +1324,7 @@ BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b )
LLInventoryCategory::LLInventoryCategory(
const LLUUID& uuid,
const LLUUID& parent_uuid,
- LLFolderType::EType preferred_type,
+ LLAssetType::EType preferred_type,
const std::string& name) :
LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name),
mPreferredType(preferred_type)
@@ -1332,7 +1332,7 @@ LLInventoryCategory::LLInventoryCategory(
}
LLInventoryCategory::LLInventoryCategory() :
- mPreferredType(LLFolderType::FT_NONE)
+ mPreferredType(LLAssetType::AT_NONE)
{
mType = LLAssetType::AT_CATEGORY;
}
@@ -1354,12 +1354,12 @@ void LLInventoryCategory::copyCategory(const LLInventoryCategory* other)
mPreferredType = other->mPreferredType;
}
-LLFolderType::EType LLInventoryCategory::getPreferredType() const
+LLAssetType::EType LLInventoryCategory::getPreferredType() const
{
return mPreferredType;
}
-void LLInventoryCategory::setPreferredType(LLFolderType::EType type)
+void LLInventoryCategory::setPreferredType(LLAssetType::EType type)
{
mPreferredType = type;
}
@@ -1405,13 +1405,13 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd)
if (sd.has(w))
{
S8 type = (U8)sd[w].asInteger();
- mPreferredType = static_cast<LLFolderType::EType>(type);
+ mPreferredType = static_cast<LLAssetType::EType>(type);
}
w = INV_ASSET_TYPE_LABEL_WS;
if (sd.has(w))
{
S8 type = (U8)sd[w].asInteger();
- mPreferredType = static_cast<LLFolderType::EType>(type);
+ mPreferredType = static_cast<LLAssetType::EType>(type);
}
w = INV_NAME_LABEL;
@@ -1433,7 +1433,7 @@ void LLInventoryCategory::unpackMessage(LLMessageSystem* msg,
msg->getUUIDFast(block, _PREHASH_ParentID, mParentUUID, block_num);
S8 type;
msg->getS8Fast(block, _PREHASH_Type, type, block_num);
- mPreferredType = static_cast<LLFolderType::EType>(type);
+ mPreferredType = static_cast<LLAssetType::EType>(type);
msg->getStringFast(block, _PREHASH_Name, mName, block_num);
LLStringUtil::replaceNonstandardASCII(mName, ' ');
}
@@ -1482,7 +1482,7 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp)
}
else if(0 == strcmp("pref_type", keyword))
{
- mPreferredType = LLFolderType::lookup(valuestr);
+ mPreferredType = LLAssetType::lookup(valuestr);
}
else if(0 == strcmp("name", keyword))
{
@@ -1514,7 +1514,7 @@ BOOL LLInventoryCategory::exportFile(LLFILE* fp, BOOL) const
mParentUUID.toString(uuid_str);
fprintf(fp, "\t\tparent_id\t%s\n", uuid_str.c_str());
fprintf(fp, "\t\ttype\t%s\n", LLAssetType::lookup(mType));
- fprintf(fp, "\t\tpref_type\t%s\n", LLFolderType::lookup(mPreferredType).c_str());
+ fprintf(fp, "\t\tpref_type\t%s\n", LLAssetType::lookup(mPreferredType));
fprintf(fp, "\t\tname\t%s|\n", mName.c_str());
fprintf(fp,"\t}\n");
return TRUE;
@@ -1561,7 +1561,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream)
}
else if(0 == strcmp("pref_type", keyword))
{
- mPreferredType = LLFolderType::lookup(valuestr);
+ mPreferredType = LLAssetType::lookup(valuestr);
}
else if(0 == strcmp("name", keyword))
{
@@ -1593,7 +1593,7 @@ BOOL LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, BOOL)
mParentUUID.toString(uuid_str);
output_stream << "\t\tparent_id\t" << uuid_str << "\n";
output_stream << "\t\ttype\t" << LLAssetType::lookup(mType) << "\n";
- output_stream << "\t\tpref_type\t" << LLFolderType::lookup(mPreferredType) << "\n";
+ output_stream << "\t\tpref_type\t" << LLAssetType::lookup(mPreferredType) << "\n";
output_stream << "\t\tname\t" << mName.c_str() << "|\n";
output_stream << "\t}\n";
return TRUE;
@@ -1629,6 +1629,38 @@ LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item)
return rv;
}
+/* deprecated, use LLInventoryItem::fromLLSD() instead
+LLPointer<LLInventoryItem> ll_create_item_from_sd(const LLSD& sd_item)
+{
+ LLPointer<LLInventoryItem> rv = new LLInventoryItem;
+ rv->setUUID(sd_item[INV_ITEM_ID_LABEL].asUUID());
+ rv->setParent(sd_item[INV_PARENT_ID_LABEL].asUUID());
+ rv->rename(sd_item[INV_NAME_LABEL].asString());
+ rv->setType(
+ LLAssetType::lookup(sd_item[INV_ASSET_TYPE_LABEL].asString()));
+ if (sd_item.has("shadow_id"))
+ {
+ LLUUID asset_id = sd_item["shadow_id"];
+ LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES);
+ cipher.decrypt(asset_id.mData, UUID_BYTES);
+ rv->setAssetUUID(asset_id);
+ }
+ if (sd_item.has(INV_ASSET_ID_LABEL))
+ {
+ rv->setAssetUUID(sd_item[INV_ASSET_ID_LABEL].asUUID());
+ }
+ rv->setDescription(sd_item[INV_DESC_LABEL].asString());
+ rv->setSaleInfo(ll_sale_info_from_sd(sd_item[INV_SALE_INFO_LABEL]));
+ rv->setPermissions(ll_permissions_from_sd(sd_item[INV_PERMISSIONS_LABEL]));
+ rv->setInventoryType(
+ LLInventoryType::lookup(
+ sd_item[INV_INVENTORY_TYPE_LABEL].asString()));
+ rv->setFlags((U32)(sd_item[INV_FLAGS_LABEL].asInteger()));
+ rv->setCreationDate(sd_item[INV_CREATION_DATE_LABEL].asInteger());
+ return rv;
+}
+*/
+
LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat)
{
LLSD rv;
@@ -1643,10 +1675,10 @@ LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat)
rv[INV_PARENT_ID_LABEL] = cat->getParentUUID();
rv[INV_NAME_LABEL] = cat->getName();
rv[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(cat->getType());
- if(LLFolderType::lookupIsProtectedType(cat->getPreferredType()))
+ if(LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType()))
{
rv[INV_PREFERRED_TYPE_LABEL] =
- LLFolderType::lookup(cat->getPreferredType()).c_str();
+ LLAssetType::lookup(cat->getPreferredType());
}
return rv;
}
@@ -1660,7 +1692,7 @@ LLPointer<LLInventoryCategory> ll_create_category_from_sd(const LLSD& sd_cat)
rv->setType(
LLAssetType::lookup(sd_cat[INV_ASSET_TYPE_LABEL].asString()));
rv->setPreferredType(
- LLFolderType::lookup(
- sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
+ LLAssetType::lookup(
+ sd_cat[INV_PREFERRED_TYPE_LABEL].asString()));
return rv;
}