diff options
Diffstat (limited to 'indra/newview/llviewerinventory.cpp')
-rw-r--r-- | indra/newview/llviewerinventory.cpp | 104 |
1 files changed, 86 insertions, 18 deletions
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 8a891b1462..49748c59e8 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -36,7 +36,6 @@ #include "llnotificationsutil.h" #include "llsdserialize.h" #include "message.h" -#include "indra_constants.h" #include "llagent.h" #include "llagentcamera.h" @@ -67,6 +66,40 @@ #include "llviewermessage.h" ///---------------------------------------------------------------------------- +/// Helper class to store special inventory item names +///---------------------------------------------------------------------------- +class LLLocalizedInventoryItemsDictionary : public LLSingleton<LLLocalizedInventoryItemsDictionary> +{ +public: + std::map<std::string, std::string> mInventoryItemsDict; + + LLLocalizedInventoryItemsDictionary() + { + mInventoryItemsDict["New Shape"] = LLTrans::getString("New Shape"); + mInventoryItemsDict["New Skin"] = LLTrans::getString("New Skin"); + mInventoryItemsDict["New Hair"] = LLTrans::getString("New Hair"); + mInventoryItemsDict["New Eyes"] = LLTrans::getString("New Eyes"); + mInventoryItemsDict["New Shirt"] = LLTrans::getString("New Shirt"); + mInventoryItemsDict["New Pants"] = LLTrans::getString("New Pants"); + mInventoryItemsDict["New Shoes"] = LLTrans::getString("New Shoes"); + mInventoryItemsDict["New Socks"] = LLTrans::getString("New Socks"); + mInventoryItemsDict["New Jacket"] = LLTrans::getString("New Jacket"); + mInventoryItemsDict["New Gloves"] = LLTrans::getString("New Gloves"); + mInventoryItemsDict["New Undershirt"] = LLTrans::getString("New Undershirt"); + mInventoryItemsDict["New Underpants"] = LLTrans::getString("New Underpants"); + mInventoryItemsDict["New Skirt"] = LLTrans::getString("New Skirt"); + mInventoryItemsDict["New Alpha"] = LLTrans::getString("New Alpha"); + mInventoryItemsDict["New Tattoo"] = LLTrans::getString("New Tattoo"); + mInventoryItemsDict["Invalid Wearable"] = LLTrans::getString("Invalid Wearable"); + + mInventoryItemsDict["New Script"] = LLTrans::getString("New Script"); + mInventoryItemsDict["New Folder"] = LLTrans::getString("New Folder"); + mInventoryItemsDict["Contents"] = LLTrans::getString("Contents"); + } +}; + + +///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs ///---------------------------------------------------------------------------- @@ -265,10 +298,14 @@ void LLViewerInventoryItem::fetchFromServer(void) const // we have to check region. It can be null after region was destroyed. See EXT-245 if (region) { - if( ALEXANDRIA_LINDEN_ID.getString() == mPermissions.getOwner().getString()) - url = region->getCapability("FetchLib"); - else - url = region->getCapability("FetchInventory"); + if(gAgent.getID() != mPermissions.getOwner()) + { + url = region->getCapability("FetchLib"); + } + else + { + url = region->getCapability("FetchInventory"); + } } else { @@ -316,6 +353,18 @@ BOOL LLViewerInventoryItem::unpackMessage(LLSD item) BOOL LLViewerInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num) { BOOL rv = LLInventoryItem::unpackMessage(msg, block, block_num); + + std::string localized_str; + + std::map<std::string, std::string>::const_iterator dictionary_iter; + + dictionary_iter = LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.find(mName); + + if(dictionary_iter != LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.end()) + { + mName = dictionary_iter->second; + } + mIsComplete = TRUE; return rv; } @@ -541,7 +590,7 @@ bool LLViewerInventoryCategory::fetch() std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents"); if (!url.empty()) //Capability found. Build up LLSD and use it. { - LLInventoryModelBackgroundFetch::instance().start(mUUID); + LLInventoryModelBackgroundFetch::instance().start(mUUID, false); } else { //Deprecated, but if we don't have a capability, use the old system. @@ -678,8 +727,8 @@ void LLViewerInventoryCategory::determineFolderType() return; if (item->isWearableType()) { - const EWearableType wearable_type = item->getWearableType(); - const std::string& wearable_name = LLWearableDictionary::getTypeName(wearable_type); + const LLWearableType::EType wearable_type = item->getWearableType(); + const std::string& wearable_name = LLWearableType::getTypeName(wearable_type); U64 valid_folder_types = LLViewerFolderType::lookupValidFolderTypes(wearable_name); folder_valid |= valid_folder_types; folder_invalid |= ~valid_folder_types; @@ -863,10 +912,29 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, const LLUUID& parent, const LLTransactionID& transaction_id, const std::string& name, const std::string& desc, LLAssetType::EType asset_type, - LLInventoryType::EType inv_type, EWearableType wtype, + LLInventoryType::EType inv_type, LLWearableType::EType wtype, U32 next_owner_perm, LLPointer<LLInventoryCallback> cb) { + //check if name is equal to one of special inventory items names + //EXT-5839 + std::string server_name = name; + + { + std::map<std::string, std::string>::const_iterator dictionary_iter; + + for (dictionary_iter = LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.begin(); + dictionary_iter != LLLocalizedInventoryItemsDictionary::getInstance()->mInventoryItemsDict.end(); + dictionary_iter++) + { + const std::string& localized_name = dictionary_iter->second; + if(localized_name == name) + { + server_name = dictionary_iter->first; + } + } + } + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_CreateInventoryItem); msg->nextBlock(_PREHASH_AgentData); @@ -880,7 +948,7 @@ void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, msg->addS8Fast(_PREHASH_Type, (S8)asset_type); msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); msg->addU8Fast(_PREHASH_WearableType, (U8)wtype); - msg->addStringFast(_PREHASH_Name, name); + msg->addStringFast(_PREHASH_Name, server_name); msg->addStringFast(_PREHASH_Description, desc); gAgent.sendReliableMessage(); @@ -923,6 +991,7 @@ void link_inventory_item( const LLUUID& item_id, const LLUUID& parent_id, const std::string& new_name, + const std::string& new_description, const LLAssetType::EType asset_type, LLPointer<LLInventoryCallback> cb) { @@ -948,7 +1017,6 @@ void link_inventory_item( } LLUUID transaction_id; - std::string desc = "Broken link"; // This should only show if the object can't find its baseobj. LLInventoryType::EType inv_type = LLInventoryType::IT_NONE; if (dynamic_cast<const LLInventoryCategory *>(baseobj)) { @@ -979,7 +1047,7 @@ void link_inventory_item( msg->addS8Fast(_PREHASH_Type, (S8)asset_type); msg->addS8Fast(_PREHASH_InvType, (S8)inv_type); msg->addStringFast(_PREHASH_Name, new_name); - msg->addStringFast(_PREHASH_Description, desc); + msg->addStringFast(_PREHASH_Description, new_description); } gAgent.sendReliableMessage(); } @@ -1131,10 +1199,10 @@ void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, cons else { // Use for all clothing and body parts. Adding new wearable types requires updating LLWearableDictionary. - EWearableType wearable_type = LLWearableDictionary::typeNameToType(type_name); - if (wearable_type >= WT_SHAPE && wearable_type < WT_COUNT) + LLWearableType::EType wearable_type = LLWearableType::typeNameToType(type_name); + if (wearable_type >= LLWearableType::WT_SHAPE && wearable_type < LLWearableType::WT_COUNT) { - LLAssetType::EType asset_type = LLWearableDictionary::getAssetType(wearable_type); + LLAssetType::EType asset_type = LLWearableType::getAssetType(wearable_type); LLFolderType::EType folder_type = LLFolderType::assetTypeToFolderType(asset_type); const LLUUID parent_id = bridge ? bridge->getUUID() : gInventory.findCategoryUUIDForType(folder_type); LLFolderBridge::createWearable(parent_id, wearable_type); @@ -1472,14 +1540,14 @@ bool LLViewerInventoryItem::isWearableType() const return (getInventoryType() == LLInventoryType::IT_WEARABLE); } -EWearableType LLViewerInventoryItem::getWearableType() const +LLWearableType::EType LLViewerInventoryItem::getWearableType() const { if (!isWearableType()) { llwarns << "item is not a wearable" << llendl; - return WT_INVALID; + return LLWearableType::WT_INVALID; } - return EWearableType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK); + return LLWearableType::EType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK); } |