diff options
Diffstat (limited to 'indra/llinventory/llinventory.cpp')
-rw-r--r-- | indra/llinventory/llinventory.cpp | 147 |
1 files changed, 14 insertions, 133 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index fe60800700..075abf9536 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -46,7 +46,6 @@ static const std::string INV_ITEM_ID_LABEL("item_id"); static const std::string INV_FOLDER_ID_LABEL("cat_id"); static const std::string INV_PARENT_ID_LABEL("parent_id"); static const std::string INV_THUMBNAIL_LABEL("thumbnail"); -static const std::string INV_FAVORITE_LABEL("favorite"); static const std::string INV_THUMBNAIL_ID_LABEL("thumbnail_id"); static const std::string INV_ASSET_TYPE_LABEL("type"); static const std::string INV_PREFERRED_TYPE_LABEL("preferred_type"); @@ -60,7 +59,6 @@ static const std::string INV_LINKED_ID_LABEL("linked_id"); static const std::string INV_SALE_INFO_LABEL("sale_info"); static const std::string INV_FLAGS_LABEL("flags"); static const std::string INV_CREATION_DATE_LABEL("created_at"); -static const std::string INV_TOGGLED_LABEL("toggled"); // key used by agent-inventory-service static const std::string INV_ASSET_TYPE_LABEL_WS("type_default"); @@ -84,16 +82,14 @@ LLInventoryObject::LLInventoryObject(const LLUUID& uuid, mParentUUID(parent_uuid), mType(type), mName(name), - mCreationDate(0), - mFavorite(false) + mCreationDate(0) { correctInventoryName(mName); } LLInventoryObject::LLInventoryObject() : mType(LLAssetType::AT_NONE), - mCreationDate(0), - mFavorite(false) + mCreationDate(0) { } @@ -108,7 +104,6 @@ void LLInventoryObject::copyObject(const LLInventoryObject* other) mType = other->mType; mName = other->mName; mThumbnailUUID = other->mThumbnailUUID; - mFavorite = other->mFavorite; } const LLUUID& LLInventoryObject::getUUID() const @@ -126,11 +121,6 @@ const LLUUID& LLInventoryObject::getThumbnailUUID() const return mThumbnailUUID; } -bool LLInventoryObject::getIsFavorite() const -{ - return mFavorite; -} - const std::string& LLInventoryObject::getName() const { return mName; @@ -185,11 +175,6 @@ void LLInventoryObject::setThumbnailUUID(const LLUUID& thumbnail_uuid) mThumbnailUUID = thumbnail_uuid; } -void LLInventoryObject::setFavorite(bool favorite) -{ - mFavorite = favorite; -} - void LLInventoryObject::setType(LLAssetType::EType type) { mType = type; @@ -262,23 +247,6 @@ bool LLInventoryObject::importLegacyStream(std::istream& input_stream) { setThumbnailUUID(LLUUID::null); } - - if (metadata.has("favorite")) - { - const LLSD& favorite = metadata["favorite"]; - if (favorite.has("toggled")) - { - setFavorite(favorite["toggled"].asBoolean()); - } - else - { - setFavorite(false); - } - } - else - { - setFavorite(false); - } } else if(0 == strcmp("name", keyword)) { @@ -767,23 +735,6 @@ bool LLInventoryItem::importLegacyStream(std::istream& input_stream) { setThumbnailUUID(LLUUID::null); } - - if (metadata.has("favorite")) - { - const LLSD& favorite = metadata["favorite"]; - if (favorite.has("toggled")) - { - setFavorite(favorite["toggled"].asBoolean()); - } - else - { - setFavorite(false); - } - } - else - { - setFavorite(false); - } } else if(0 == strcmp("inv_type", keyword)) { @@ -928,7 +879,7 @@ bool LLInventoryItem::exportLegacyStream(std::ostream& output_stream, bool inclu LLSD LLInventoryItem::asLLSD() const { - LLSD sd; + LLSD sd = LLSD(); asLLSD(sd); return sd; } @@ -937,18 +888,13 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const { sd[INV_ITEM_ID_LABEL] = mUUID; sd[INV_PARENT_ID_LABEL] = mParentUUID; - ll_fill_sd_from_permissions(sd[INV_PERMISSIONS_LABEL], mPermissions); + sd[INV_PERMISSIONS_LABEL] = ll_create_sd_from_permissions(mPermissions); if (mThumbnailUUID.notNull()) { sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); } - if (mFavorite) - { - sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); - } - U32 mask = mPermissions.getMaskBase(); if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) || (mAssetUUID.isNull())) @@ -963,22 +909,19 @@ void LLInventoryItem::asLLSD( LLSD& sd ) const cipher.encrypt(shadow_id.mData, UUID_BYTES); sd[INV_SHADOW_ID_LABEL] = shadow_id; } - sd[INV_ASSET_TYPE_LABEL] = std::string(LLAssetType::lookup(mType)); + sd[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType); + sd[INV_INVENTORY_TYPE_LABEL] = mInventoryType; const std::string inv_type_str = LLInventoryType::lookup(mInventoryType); if(!inv_type_str.empty()) { sd[INV_INVENTORY_TYPE_LABEL] = inv_type_str; } - else - { - sd[INV_INVENTORY_TYPE_LABEL] = (LLSD::Integer)mInventoryType; - } //sd[INV_FLAGS_LABEL] = (S32)mFlags; sd[INV_FLAGS_LABEL] = ll_sd_from_U32(mFlags); - mSaleInfo.asLLSD(sd[INV_SALE_INFO_LABEL]); + sd[INV_SALE_INFO_LABEL] = mSaleInfo.asLLSD(); sd[INV_NAME_LABEL] = mName; sd[INV_DESC_LABEL] = mDescription; - sd[INV_CREATION_DATE_LABEL] = (LLSD::Integer)mCreationDate; + sd[INV_CREATION_DATE_LABEL] = (S32) mCreationDate; } bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) @@ -994,7 +937,6 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) // TODO - figure out if this should be moved into the noclobber fields above mThumbnailUUID.setNull(); - mFavorite = false; // iterate as map to avoid making unnecessary temp copies of everything LLSD::map_const_iterator i, end; @@ -1040,17 +982,6 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd, bool is_new) continue; } - if (i->first == INV_FAVORITE_LABEL) - { - const LLSD& favorite_map = i->second; - const std::string w = INV_TOGGLED_LABEL; - if (favorite_map.has(w)) - { - mFavorite = favorite_map[w].asBoolean(); - } - continue; - } - if (i->first == INV_PERMISSIONS_LABEL) { mPermissions = ll_permissions_from_sd(i->second); @@ -1246,11 +1177,6 @@ LLSD LLInventoryCategory::asLLSD() const sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); } - if (mFavorite) - { - sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); - } - return sd; } @@ -1262,17 +1188,11 @@ LLSD LLInventoryCategory::asAISCreateCatLLSD() const S8 type = static_cast<S8>(mPreferredType); sd[INV_ASSET_TYPE_LABEL_WS] = type; sd[INV_NAME_LABEL] = mName; - if (mThumbnailUUID.notNull()) { sd[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); } - if (mFavorite) - { - sd[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); - } - return sd; } @@ -1320,17 +1240,6 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd) mThumbnailUUID = sd[w]; } } - mFavorite = false; - w = INV_FAVORITE_LABEL; - if (sd.has(w)) - { - const LLSD& favorite_map = sd[w]; - w = INV_TOGGLED_LABEL; - if (favorite_map.has(w)) - { - mFavorite = favorite_map[w].asBoolean(); - } - } w = INV_ASSET_TYPE_LABEL; if (sd.has(w)) { @@ -1453,23 +1362,6 @@ bool LLInventoryCategory::importLegacyStream(std::istream& input_stream) { setThumbnailUUID(LLUUID::null); } - - if (metadata.has("favorite")) - { - const LLSD& favorite = metadata["favorite"]; - if (favorite.has("toggled")) - { - setFavorite(favorite["toggled"].asBoolean()); - } - else - { - setFavorite(false); - } - } - else - { - setFavorite(false); - } } else { @@ -1504,11 +1396,12 @@ bool LLInventoryCategory::exportLegacyStream(std::ostream& output_stream, bool) return true; } -void LLInventoryCategory::exportLLSD(LLSD& cat_data) const +LLSD LLInventoryCategory::exportLLSD() const { + LLSD cat_data; cat_data[INV_FOLDER_ID_LABEL] = mUUID; cat_data[INV_PARENT_ID_LABEL] = mParentUUID; - cat_data[INV_ASSET_TYPE_LABEL] = std::string(LLAssetType::lookup(mType)); + cat_data[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType); cat_data[INV_PREFERRED_TYPE_LABEL] = LLFolderType::lookup(mPreferredType); cat_data[INV_NAME_LABEL] = mName; @@ -1516,10 +1409,8 @@ void LLInventoryCategory::exportLLSD(LLSD& cat_data) const { cat_data[INV_THUMBNAIL_LABEL] = LLSD().with(INV_ASSET_ID_LABEL, mThumbnailUUID); } - if (mFavorite) - { - cat_data[INV_FAVORITE_LABEL] = LLSD().with(INV_TOGGLED_LABEL, mFavorite); - } + + return cat_data; } bool LLInventoryCategory::importLLSD(const LLSD& cat_data) @@ -1550,16 +1441,6 @@ bool LLInventoryCategory::importLLSD(const LLSD& cat_data) } setThumbnailUUID(thumbnail_uuid); } - if (cat_data.has(INV_FAVORITE_LABEL)) - { - bool favorite = false; - const LLSD& favorite_data = cat_data[INV_FAVORITE_LABEL]; - if (favorite_data.has(INV_TOGGLED_LABEL)) - { - favorite = favorite_data[INV_TOGGLED_LABEL].asBoolean(); - } - setFavorite(favorite); - } if (cat_data.has(INV_NAME_LABEL)) { mName = cat_data[INV_NAME_LABEL].asString(); @@ -1570,7 +1451,7 @@ bool LLInventoryCategory::importLLSD(const LLSD& cat_data) return true; } ///---------------------------------------------------------------------------- -/// Local function definitions for testing purposes +/// Local function definitions ///---------------------------------------------------------------------------- LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item) |