diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llinventory/llinventory.cpp | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/llinventory/llinventory.cpp')
-rw-r--r-- | linden/indra/llinventory/llinventory.cpp | 70 |
1 files changed, 57 insertions, 13 deletions
diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp index 3e3290c..e6c1175 100644 --- a/linden/indra/llinventory/llinventory.cpp +++ b/linden/indra/llinventory/llinventory.cpp | |||
@@ -54,6 +54,7 @@ static const std::string INV_INVENTORY_TYPE_LABEL("inv_type"); | |||
54 | static const std::string INV_NAME_LABEL("name"); | 54 | static const std::string INV_NAME_LABEL("name"); |
55 | static const std::string INV_DESC_LABEL("desc"); | 55 | static const std::string INV_DESC_LABEL("desc"); |
56 | static const std::string INV_PERMISSIONS_LABEL("permissions"); | 56 | static const std::string INV_PERMISSIONS_LABEL("permissions"); |
57 | static const std::string INV_SHADOW_ID_LABEL("shadow_id"); | ||
57 | static const std::string INV_ASSET_ID_LABEL("asset_id"); | 58 | static const std::string INV_ASSET_ID_LABEL("asset_id"); |
58 | static const std::string INV_SALE_INFO_LABEL("sale_info"); | 59 | static const std::string INV_SALE_INFO_LABEL("sale_info"); |
59 | static const std::string INV_FLAGS_LABEL("flags"); | 60 | static const std::string INV_FLAGS_LABEL("flags"); |
@@ -927,34 +928,34 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu | |||
927 | LLSD LLInventoryItem::asLLSD() const | 928 | LLSD LLInventoryItem::asLLSD() const |
928 | { | 929 | { |
929 | LLSD sd = LLSD(); | 930 | LLSD sd = LLSD(); |
930 | sd["item_id"] = mUUID; | 931 | sd[INV_ITEM_ID_LABEL] = mUUID; |
931 | sd["parent_id"] = mParentUUID; | 932 | sd[INV_PARENT_ID_LABEL] = mParentUUID; |
932 | sd["permissions"] = ll_create_sd_from_permissions(mPermissions); | 933 | sd[INV_PERMISSIONS_LABEL] = ll_create_sd_from_permissions(mPermissions); |
933 | 934 | ||
934 | U32 mask = mPermissions.getMaskBase(); | 935 | U32 mask = mPermissions.getMaskBase(); |
935 | if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) | 936 | if(((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) |
936 | || (mAssetUUID.isNull())) | 937 | || (mAssetUUID.isNull())) |
937 | { | 938 | { |
938 | sd["asset_id"] = mAssetUUID; | 939 | sd[INV_ASSET_ID_LABEL] = mAssetUUID; |
939 | } | 940 | } |
940 | else | 941 | else |
941 | { | 942 | { |
942 | LLUUID shadow_id(mAssetUUID); | 943 | LLUUID shadow_id(mAssetUUID); |
943 | LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); | 944 | LLXORCipher cipher(MAGIC_ID.mData, UUID_BYTES); |
944 | cipher.encrypt(shadow_id.mData, UUID_BYTES); | 945 | cipher.encrypt(shadow_id.mData, UUID_BYTES); |
945 | sd["shadow_id"] = shadow_id; | 946 | sd[INV_SHADOW_ID_LABEL] = shadow_id; |
946 | } | 947 | } |
947 | sd["type"] = LLAssetType::lookup(mType); | 948 | sd[INV_ASSET_TYPE_LABEL] = LLAssetType::lookup(mType); |
948 | const char* inv_type_str = LLInventoryType::lookup(mInventoryType); | 949 | const char* inv_type_str = LLInventoryType::lookup(mInventoryType); |
949 | if(inv_type_str) | 950 | if(inv_type_str) |
950 | { | 951 | { |
951 | sd["inv_type"] = inv_type_str; | 952 | sd[INV_INVENTORY_TYPE_LABEL] = inv_type_str; |
952 | } | 953 | } |
953 | sd["flags"] = ll_sd_from_U32(mFlags); | 954 | sd[INV_FLAGS_LABEL] = ll_sd_from_U32(mFlags); |
954 | sd["sale_info"] = mSaleInfo; | 955 | sd[INV_SALE_INFO_LABEL] = mSaleInfo; |
955 | sd["name"] = mName; | 956 | sd[INV_NAME_LABEL] = mName; |
956 | sd["desc"] = mDescription; | 957 | sd[INV_DESC_LABEL] = mDescription; |
957 | sd["creation_date"] = mCreationDate; | 958 | sd[INV_CREATION_DATE_LABEL] = mCreationDate; |
958 | 959 | ||
959 | return sd; | 960 | return sd; |
960 | } | 961 | } |
@@ -1007,7 +1008,7 @@ bool LLInventoryItem::fromLLSD(LLSD& sd) | |||
1007 | mPermissions.setMaskNext(perm_mask); | 1008 | mPermissions.setMaskNext(perm_mask); |
1008 | } | 1009 | } |
1009 | } | 1010 | } |
1010 | w = "shadow_id"; | 1011 | w = INV_SHADOW_ID_LABEL; |
1011 | if (sd.has(w)) | 1012 | if (sd.has(w)) |
1012 | { | 1013 | { |
1013 | mAssetUUID = sd[w]; | 1014 | mAssetUUID = sd[w]; |
@@ -1357,6 +1358,19 @@ void LLInventoryCategory::setPreferredType(LLAssetType::EType type) | |||
1357 | mPreferredType = type; | 1358 | mPreferredType = type; |
1358 | } | 1359 | } |
1359 | 1360 | ||
1361 | LLSD LLInventoryCategory::asLLSD() const | ||
1362 | { | ||
1363 | LLSD sd = LLSD(); | ||
1364 | sd["item_id"] = mUUID; | ||
1365 | sd["parent_id"] = mParentUUID; | ||
1366 | S8 type = static_cast<S8>(mPreferredType); | ||
1367 | sd["type"] = type; | ||
1368 | sd["name"] = mName; | ||
1369 | |||
1370 | return sd; | ||
1371 | } | ||
1372 | |||
1373 | |||
1360 | // virtual | 1374 | // virtual |
1361 | void LLInventoryCategory::packMessage(LLMessageSystem* msg) const | 1375 | void LLInventoryCategory::packMessage(LLMessageSystem* msg) const |
1362 | { | 1376 | { |
@@ -1367,6 +1381,36 @@ void LLInventoryCategory::packMessage(LLMessageSystem* msg) const | |||
1367 | msg->addStringFast(_PREHASH_Name, mName); | 1381 | msg->addStringFast(_PREHASH_Name, mName); |
1368 | } | 1382 | } |
1369 | 1383 | ||
1384 | bool LLInventoryCategory::fromLLSD(LLSD& sd) | ||
1385 | { | ||
1386 | std::string w; | ||
1387 | |||
1388 | w = INV_ITEM_ID_LABEL; | ||
1389 | if (sd.has(w)) | ||
1390 | { | ||
1391 | mUUID = sd[w]; | ||
1392 | } | ||
1393 | w = INV_PARENT_ID_LABEL; | ||
1394 | if (sd.has(w)) | ||
1395 | { | ||
1396 | mParentUUID = sd[w]; | ||
1397 | } | ||
1398 | w = INV_ASSET_TYPE_LABEL; | ||
1399 | if (sd.has(w)) | ||
1400 | { | ||
1401 | S8 type = (U8)sd[w].asInteger(); | ||
1402 | mPreferredType = static_cast<LLAssetType::EType>(type); | ||
1403 | } | ||
1404 | w = INV_NAME_LABEL; | ||
1405 | if (sd.has(w)) | ||
1406 | { | ||
1407 | mName = sd[w].asString(); | ||
1408 | LLString::replaceNonstandardASCII(mName, ' '); | ||
1409 | LLString::replaceChar(mName, '|', ' '); | ||
1410 | } | ||
1411 | return true; | ||
1412 | } | ||
1413 | |||
1370 | // virtual | 1414 | // virtual |
1371 | void LLInventoryCategory::unpackMessage(LLMessageSystem* msg, | 1415 | void LLInventoryCategory::unpackMessage(LLMessageSystem* msg, |
1372 | const char* block, | 1416 | const char* block, |