diff options
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/newview/llinventorybridge.cpp | 5 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 92 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 9 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/strings.xml | 1 |
4 files changed, 95 insertions, 12 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d6ad9b50a4..f6a851e55f 100755 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2087,6 +2087,11 @@ std::string LLFolderBridge::getLabelSuffix() const suffix += " (" + LLTrans::getString("MarketplaceMax") + "=" + llformat("%d", stock_count) + ")"; } } + // Add updating suffix + if (LLMarketplaceData::instance().isUpdating(getUUID())) + { + suffix += " (" + LLTrans::getString("MarketplaceUpdating") + ")"; + } return LLInvFVBridge::getLabelSuffix() + suffix; } else diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 669c49ea4f..17b8ec746f 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -172,6 +172,8 @@ public: virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { + LLMarketplaceData::instance().setUpdating(false); + if (!isGoodStatus()) { log_SLM_warning("Get /listings", getStatus(), getReason(), "", ""); @@ -223,11 +225,16 @@ class LLSLMCreateListingsResponder : public LLHTTPClient::Responder LOG_CLASS(LLSLMCreateListingsResponder); public: - LLSLMCreateListingsResponder() {} + LLSLMCreateListingsResponder(const LLUUID& folder_id) + { + mExpectedFolderId = folder_id; + } virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { + LLMarketplaceData::instance().setUpdating(mExpectedFolderId,false); + if (!isGoodStatus()) { log_SLM_warning("Post /listings", getStatus(), getReason(), "", ""); @@ -269,6 +276,8 @@ public: it++; } } +private: + LLUUID mExpectedFolderId; }; class LLSLMGetListingResponder : public LLHTTPClient::Responder @@ -276,11 +285,16 @@ class LLSLMGetListingResponder : public LLHTTPClient::Responder LOG_CLASS(LLSLMGetListingResponder); public: - LLSLMGetListingResponder() {} + LLSLMGetListingResponder(const LLUUID& folder_id) + { + mExpectedFolderId = folder_id; + } virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { + LLMarketplaceData::instance().setUpdating(mExpectedFolderId,false); + LLBufferStream istr(channels, buffer.get()); std::stringstream strstrm; strstrm << istr.rdbuf(); @@ -327,6 +341,8 @@ public: it++; } } +private: + LLUUID mExpectedFolderId; }; class LLSLMUpdateListingsResponder : public LLHTTPClient::Responder @@ -334,8 +350,9 @@ class LLSLMUpdateListingsResponder : public LLHTTPClient::Responder LOG_CLASS(LLSLMUpdateListingsResponder); public: - LLSLMUpdateListingsResponder(bool expected_listed_state, const LLUUID& expected_version_id) + LLSLMUpdateListingsResponder(const LLUUID& folder_id, bool expected_listed_state, const LLUUID& expected_version_id) { + mExpectedFolderId = folder_id; mExpectedListedState = expected_listed_state; mExpectedVersionUUID = expected_version_id; } @@ -343,6 +360,8 @@ public: virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { + LLMarketplaceData::instance().setUpdating(mExpectedFolderId,false); + LLBufferStream istr(channels, buffer.get()); std::stringstream strstrm; strstrm << istr.rdbuf(); @@ -399,6 +418,7 @@ public: } } private: + LLUUID mExpectedFolderId; bool mExpectedListedState; LLUUID mExpectedVersionUUID; }; @@ -408,11 +428,16 @@ class LLSLMAssociateListingsResponder : public LLHTTPClient::Responder LOG_CLASS(LLSLMAssociateListingsResponder); public: - LLSLMAssociateListingsResponder() {} + LLSLMAssociateListingsResponder(const LLUUID& folder_id) + { + mExpectedFolderId = folder_id; + } virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { + LLMarketplaceData::instance().setUpdating(mExpectedFolderId,false); + if (!isGoodStatus()) { log_SLM_warning("Put /associate_inventory", getStatus(), getReason(), "", ""); @@ -464,6 +489,8 @@ public: it++; } } +private: + LLUUID mExpectedFolderId; }; class LLSLMDeleteListingsResponder : public LLHTTPClient::Responder @@ -471,11 +498,16 @@ class LLSLMDeleteListingsResponder : public LLHTTPClient::Responder LOG_CLASS(LLSLMDeleteListingsResponder); public: - LLSLMDeleteListingsResponder() {} + LLSLMDeleteListingsResponder(const LLUUID& folder_id) + { + mExpectedFolderId = folder_id; + } virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { + LLMarketplaceData::instance().setUpdating(mExpectedFolderId,false); + LLBufferStream istr(channels, buffer.get()); std::stringstream strstrm; strstrm << istr.rdbuf(); @@ -511,6 +543,8 @@ public: it++; } } +private: + LLUUID mExpectedFolderId; }; // SLM Responders End @@ -1038,7 +1072,8 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id, LLMarketplaceData::LLMarketplaceData() : mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED), mStatusUpdatedSignal(NULL), - mDirtyCount(false) + mDirtyCount(false), + mIsUpdating(false) { mInventoryObserver = new LLMarketplaceInventoryObserver; gInventory.addObserver(mInventoryObserver); @@ -1073,6 +1108,7 @@ void LLMarketplaceData::getSLMListings() // Send request std::string url = getSLMConnectURL("/listings"); log_SLM_infos("LLHTTPClient::get", url, ""); + setUpdating(true); LLHTTPClient::get(url, new LLSLMGetListingsResponder(), headers); } @@ -1085,7 +1121,9 @@ void LLMarketplaceData::getSLMListing(S32 listing_id) // Send request std::string url = getSLMConnectURL("/listing/") + llformat("%d",listing_id); log_SLM_infos("LLHTTPClient::get", url, ""); - LLHTTPClient::get(url, new LLSLMGetListingResponder(), headers); + LLUUID folder_id = LLMarketplaceData::instance().getListingFolder(listing_id); + setUpdating(folder_id,true); + LLHTTPClient::get(url, new LLSLMGetListingResponder(folder_id), headers); } void LLMarketplaceData::createSLMListing(const LLUUID& folder_id) @@ -1112,7 +1150,8 @@ void LLMarketplaceData::createSLMListing(const LLUUID& folder_id) // Send request std::string url = getSLMConnectURL("/listings"); log_SLM_infos("LLHTTPClient::postRaw", url, json_str); - LLHTTPClient::postRaw(url, data, size, new LLSLMCreateListingsResponder(), headers); + setUpdating(folder_id,true); + LLHTTPClient::postRaw(url, data, size, new LLSLMCreateListingsResponder(folder_id), headers); } void LLMarketplaceData::updateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed) @@ -1140,7 +1179,8 @@ void LLMarketplaceData::updateSLMListing(const LLUUID& folder_id, S32 listing_id // Send request std::string url = getSLMConnectURL("/listing/") + llformat("%d",listing_id); log_SLM_infos("LLHTTPClient::putRaw", url, json_str); - LLHTTPClient::putRaw(url, data, size, new LLSLMUpdateListingsResponder(is_listed, version_id), headers); + setUpdating(folder_id,true); + LLHTTPClient::putRaw(url, data, size, new LLSLMUpdateListingsResponder(folder_id, is_listed, version_id), headers); } void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id) @@ -1167,7 +1207,8 @@ void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing // Send request std::string url = getSLMConnectURL("/associate_inventory/") + llformat("%d",listing_id); log_SLM_infos("LLHTTPClient::putRaw", url, json_str); - LLHTTPClient::putRaw(url, data, size, new LLSLMAssociateListingsResponder(), headers); + setUpdating(folder_id,true); + LLHTTPClient::putRaw(url, data, size, new LLSLMAssociateListingsResponder(folder_id), headers); } void LLMarketplaceData::deleteSLMListing(S32 listing_id) @@ -1179,7 +1220,9 @@ void LLMarketplaceData::deleteSLMListing(S32 listing_id) // Send request std::string url = getSLMConnectURL("/listing/") + llformat("%d",listing_id); log_SLM_infos("LLHTTPClient::del", url, ""); - LLHTTPClient::del(url, new LLSLMDeleteListingsResponder(), headers); + LLUUID folder_id = LLMarketplaceData::instance().getListingFolder(listing_id); + setUpdating(folder_id,true); + LLHTTPClient::del(url, new LLSLMDeleteListingsResponder(folder_id), headers); } std::string LLMarketplaceData::getSLMConnectURL(const std::string& route) @@ -1466,6 +1509,33 @@ LLUUID LLMarketplaceData::getActiveFolder(const LLUUID& obj_id) return (getActivationState(listing_uuid) ? getVersionFolder(listing_uuid) : LLUUID::null); } +bool LLMarketplaceData::isUpdating(const LLUUID& folder_id) +{ + if (mIsUpdating) + { + // If we're waiting for data for all listings, we are in the updating process + return true; + } + else + { + std::set<LLUUID>::iterator it = mPendingUpdateSet.find(folder_id); + return (it != mPendingUpdateSet.end()); + } +} + +void LLMarketplaceData::setUpdating(const LLUUID& folder_id, bool isUpdating) +{ + std::set<LLUUID>::iterator it = mPendingUpdateSet.find(folder_id); + if (it != mPendingUpdateSet.end()) + { + mPendingUpdateSet.erase(it); + } + if (isUpdating) + { + mPendingUpdateSet.insert(folder_id); + } +} + // Private Modifiers bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id) { diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 5f72f6e78e..1614b610a6 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -201,7 +201,8 @@ public: bool isVersionFolder(const LLUUID& folder_id); // returns true if folder_id is a Version folder bool isInActiveFolder(const LLUUID& obj_id); // returns true if the obj_id is buried in an active version folder LLUUID getActiveFolder(const LLUUID& obj_id); // returns the UUID of the active version folder obj_id is in - + bool isUpdating(const LLUUID& folder_id); // returns true if we're waiting from SLM incoming data for folder_id + // Access Marketplace data set : each method returns a default value if the argument can't be found bool getActivationState(const LLUUID& folder_id); S32 getListingID(const LLUUID& folder_id); @@ -212,6 +213,8 @@ public: // Used to flag if stock count values for Marketplace have to be updated bool checkDirtyCount() { if (mDirtyCount) { mDirtyCount = false; return true; } else { return false; } } void setDirtyCount() { mDirtyCount = true; } + void setUpdating(bool isUpdating) { mIsUpdating = isUpdating; } + void setUpdating(const LLUUID& folder_id, bool isUpdating); private: // Modify Marketplace data set : each method returns true if the function succeeds, false if error @@ -238,6 +241,10 @@ private: LLInventoryObserver* mInventoryObserver; bool mDirtyCount; // If true, stock count value need to be updated at the next check + // Update data + bool mIsUpdating; // true if we're globally waiting for updated values from SLM + std::set<LLUUID> mPendingUpdateSet; + // The cache of SLM data (at last...) marketplace_items_list_t mMarketplaceItems; }; diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index b2f28748b2..b51d7d75c3 100755 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2315,6 +2315,7 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors. <string name="MarketplaceMax">max</string> <string name="MarketplaceStock">stock</string> <string name="MarketplaceNoStock">out of stock</string> + <string name="MarketplaceUpdating">updating...</string> <string name="Open landmarks">Open landmarks</string> <string name="Unconstrained">Unconstrained</string> |