From 9d57163479324a092b732558033c2965e142dc1d Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Wed, 15 Jun 2011 04:53:52 +0200 Subject: [PATCH] Inventory Link auto-detection --- indra/llinventory/llinventory.cpp | 10 ++++++++++ indra/newview/hippogridmanager.cpp | 15 ++++++++++++--- indra/newview/hippogridmanager.h | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 977faa9ac..e3a54b463 100644 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -39,6 +39,7 @@ #include "llsd.h" #include "message.h" #include +#include "../newview/hippogridmanager.h" #include "llsdutil.h" @@ -553,6 +554,10 @@ BOOL LLInventoryItem::unpackMessage(LLMessageSystem* msg, const char* block, S32 S8 type; msg->getS8Fast(block, _PREHASH_Type, type, block_num); mType = static_cast(type); + if (mType == LLAssetType::AT_LINK || mType == LLAssetType::AT_LINK_FOLDER) + { + gHippoGridManager->getConnectedGrid()->setSupportsInvLinks(true); + } msg->getS8(block, "InvType", type, block_num); mInventoryType = static_cast(type); mPermissions.initMasks(mInventoryType); @@ -1122,6 +1127,11 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd) S8 type = (U8)sd[w].asInteger(); mType = static_cast(type); } + + if (mType == LLAssetType::AT_LINK || mType == LLAssetType::AT_LINK_FOLDER) + { + gHippoGridManager->getConnectedGrid()->setSupportsInvLinks(true); + } } w = INV_INVENTORY_TYPE_LABEL; if (sd.has(w)) diff --git a/indra/newview/hippogridmanager.cpp b/indra/newview/hippogridmanager.cpp index 504b941d0..bcacddb42 100644 --- a/indra/newview/hippogridmanager.cpp +++ b/indra/newview/hippogridmanager.cpp @@ -57,6 +57,7 @@ HippoGridInfo::HippoGridInfo(const std::string& gridNick) : mXmlState(XML_VOID), mVoiceConnector("SLVoice"), mRenderCompat(true), + mInvLinks(false), mMaxAgentGroups(-1), mCurrencySymbol("OS$"), mRealCurrencySymbol("US$"), @@ -612,10 +613,16 @@ void HippoGridInfo::initFallback() bool HippoGridInfo::supportsInvLinks(){ if(isSecondLife()) return true; - else if(mLoginUri.find("avination.")!=std::string::npos) - return true; else - return false; + return mInvLinks; +} + +void HippoGridInfo::setSupportsInvLinks(bool b) { + if (b == true && mInvLinks == false) + { + llinfos << "Inventory Link support detected" << llendl; + } + mInvLinks = b; } // ******************************************************************** @@ -927,6 +934,7 @@ void HippoGridManager::parseData(LLSD &gridInfo, bool mergeIfNewer) if (gridMap.has("password")) grid->setPasswordUrl(gridMap["password"]); if (gridMap.has("search")) grid->setSearchUrl(gridMap["search"]); if (gridMap.has("render_compat")) grid->setRenderCompat(gridMap["render_compat"]); + if (gridMap.has("inventory_links")) grid->setSupportsInvLinks(gridMap["inventory_links"]); // if (gridMap.has("firstname")) grid->setFirstName(gridMap["firstname"]); // if (gridMap.has("lastname")) grid->setLastName(gridMap["lastname"]); // if (gridMap.has("avatarpassword")) grid->setAvatarPassword(gridMap["avatarpassword"]); @@ -967,6 +975,7 @@ void HippoGridManager::saveFile() gridInfo[i]["search"] = grid->getSearchUrl(); gridInfo[i]["render_compat"] = grid->isRenderCompat(); + gridInfo[i]["inventory_links"] = grid->supportsInvLinks(); } // write client grid info file diff --git a/indra/newview/hippogridmanager.h b/indra/newview/hippogridmanager.h index 618623b17..1301ae1cc 100644 --- a/indra/newview/hippogridmanager.h +++ b/indra/newview/hippogridmanager.h @@ -87,6 +87,7 @@ public: void setRealCurrencySymbol(const std::string& sym); void setDirectoryFee(int fee); bool supportsInvLinks(); + void setSupportsInvLinks(bool b); bool retrieveGridInfo(); @@ -113,6 +114,7 @@ private: std::string mLastName; std::string mAvatarPassword; bool mRenderCompat; + bool mInvLinks; int mMaxAgentGroups; std::string mCurrencySymbol;