diff options
Diffstat (limited to 'indra/llinventory/llinventory.cpp')
-rw-r--r-- | indra/llinventory/llinventory.cpp | 95 |
1 files changed, 48 insertions, 47 deletions
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index e2a77f1d1e..d665deb605 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -458,6 +458,39 @@ void LLInventoryItem::setCreationDate(time_t creation_date_utc) mCreationDate = creation_date_utc; } +void LLInventoryItem::accumulatePermissionSlamBits(const LLInventoryItem& old_item) +{ + // Remove any pre-existing II_FLAGS_PERM_OVERWRITE_MASK flags + // because we now detect when they should be set. + setFlags( old_item.getFlags() | (getFlags() & ~(LLInventoryItem::II_FLAGS_PERM_OVERWRITE_MASK)) ); + + // Enforce the PERM_OVERWRITE flags for any masks that are different + // but only for AT_OBJECT's since that is the only asset type that can + // exist in-world (instead of only in-inventory or in-object-contents). + if (LLAssetType::AT_OBJECT == getType()) + { + LLPermissions old_permissions = old_item.getPermissions(); + U32 flags_to_be_set = 0; + if(old_permissions.getMaskNextOwner() != getPermissions().getMaskNextOwner()) + { + flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM; + } + if(old_permissions.getMaskEveryone() != getPermissions().getMaskEveryone()) + { + flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE; + } + if(old_permissions.getMaskGroup() != getPermissions().getMaskGroup()) + { + flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP; + } + LLSaleInfo old_sale_info = old_item.getSaleInfo(); + if(old_sale_info != getSaleInfo()) + { + flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_SALE; + } + setFlags(getFlags() | flags_to_be_set); + } +} const LLSaleInfo& LLInventoryItem::getSaleInfo() const { @@ -1291,7 +1324,7 @@ BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b ) LLInventoryCategory::LLInventoryCategory( const LLUUID& uuid, const LLUUID& parent_uuid, - LLAssetType::EType preferred_type, + LLFolderType::EType preferred_type, const std::string& name) : LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name), mPreferredType(preferred_type) @@ -1299,7 +1332,7 @@ LLInventoryCategory::LLInventoryCategory( } LLInventoryCategory::LLInventoryCategory() : - mPreferredType(LLAssetType::AT_NONE) + mPreferredType(LLFolderType::FT_NONE) { mType = LLAssetType::AT_CATEGORY; } @@ -1321,12 +1354,12 @@ void LLInventoryCategory::copyCategory(const LLInventoryCategory* other) mPreferredType = other->mPreferredType; } -LLAssetType::EType LLInventoryCategory::getPreferredType() const +LLFolderType::EType LLInventoryCategory::getPreferredType() const { return mPreferredType; } -void LLInventoryCategory::setPreferredType(LLAssetType::EType type) +void LLInventoryCategory::setPreferredType(LLFolderType::EType type) { mPreferredType = type; } @@ -1372,13 +1405,13 @@ bool LLInventoryCategory::fromLLSD(const LLSD& sd) if (sd.has(w)) { S8 type = (U8)sd[w].asInteger(); - mPreferredType = static_cast<LLAssetType::EType>(type); + mPreferredType = static_cast<LLFolderType::EType>(type); } w = INV_ASSET_TYPE_LABEL_WS; if (sd.has(w)) { S8 type = (U8)sd[w].asInteger(); - mPreferredType = static_cast<LLAssetType::EType>(type); + mPreferredType = static_cast<LLFolderType::EType>(type); } w = INV_NAME_LABEL; @@ -1400,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<LLAssetType::EType>(type); + mPreferredType = static_cast<LLFolderType::EType>(type); msg->getStringFast(block, _PREHASH_Name, mName, block_num); LLStringUtil::replaceNonstandardASCII(mName, ' '); } @@ -1449,7 +1482,7 @@ BOOL LLInventoryCategory::importFile(LLFILE* fp) } else if(0 == strcmp("pref_type", keyword)) { - mPreferredType = LLAssetType::lookup(valuestr); + mPreferredType = LLFolderType::lookup(valuestr); } else if(0 == strcmp("name", keyword)) { @@ -1481,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", LLAssetType::lookup(mPreferredType)); + fprintf(fp, "\t\tpref_type\t%s\n", LLFolderType::lookup(mPreferredType).c_str()); fprintf(fp, "\t\tname\t%s|\n", mName.c_str()); fprintf(fp,"\t}\n"); return TRUE; @@ -1528,7 +1561,7 @@ BOOL LLInventoryCategory::importLegacyStream(std::istream& input_stream) } else if(0 == strcmp("pref_type", keyword)) { - mPreferredType = LLAssetType::lookup(valuestr); + mPreferredType = LLFolderType::lookup(valuestr); } else if(0 == strcmp("name", keyword)) { @@ -1560,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" << LLAssetType::lookup(mPreferredType) << "\n"; + output_stream << "\t\tpref_type\t" << LLFolderType::lookup(mPreferredType) << "\n"; output_stream << "\t\tname\t" << mName.c_str() << "|\n"; output_stream << "\t}\n"; return TRUE; @@ -1596,38 +1629,6 @@ 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; @@ -1642,10 +1643,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(LLAssetType::lookupIsProtectedCategoryType(cat->getPreferredType())) + if(LLFolderType::lookupIsProtectedType(cat->getPreferredType())) { rv[INV_PREFERRED_TYPE_LABEL] = - LLAssetType::lookup(cat->getPreferredType()); + LLFolderType::lookup(cat->getPreferredType()).c_str(); } return rv; } @@ -1659,7 +1660,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( - LLAssetType::lookup( - sd_cat[INV_PREFERRED_TYPE_LABEL].asString())); + LLFolderType::lookup( + sd_cat[INV_PREFERRED_TYPE_LABEL].asString())); return rv; } |