summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/newview/llinventorybridge.cpp6
-rwxr-xr-xindra/newview/llinventoryfunctions.cpp6
-rwxr-xr-xindra/newview/llmarketplacefunctions.cpp22
-rwxr-xr-xindra/newview/llmarketplacefunctions.h64
4 files changed, 67 insertions, 31 deletions
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 11ae3b6189..759716f024 100755
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -2754,7 +2754,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
{
update_marketplace_category(from_folder_uuid);
// Clear the folder from the marketplace in case it was a listing folder (moot if not listed)
- LLMarketplaceData::instance().deleteListing(cat_id);
+ LLMarketplaceData::instance().clearListing(cat_id);
}
}
}
@@ -3215,7 +3215,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
}
else if ("marketplace_disassociate_listing" == action)
{
- LLMarketplaceData::instance().deleteListing(mUUID);
+ LLMarketplaceData::instance().clearListing(mUUID);
return;
}
else if ("marketplace_associate_listing" == action)
@@ -3532,7 +3532,7 @@ void LLFolderBridge::pasteFromClipboard()
if (vicat)
{
// Clear the cut folder from the marketplace if it was a listing folder (moot if not listed)
- LLMarketplaceData::instance().deleteListing(item_id);
+ LLMarketplaceData::instance().clearListing(item_id);
if (move_is_into_marketplacelistings)
{
move_folder_to_marketplacelistings(vicat, parent_id);
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 413c0d4b4b..f92831ccc5 100755
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -167,8 +167,8 @@ void update_marketplace_category(const LLUUID& cur_uuid)
{
// *TODO : Confirm with Producer that this is what we want to happen in that case!
llinfos << "Merov : Unlist as the version folder is not under the listing folder anymore!!" << llendl;
- LLMarketplaceData::instance().setVersionFolderID(listing_uuid, LLUUID::null);
- LLMarketplaceData::instance().setActivation(listing_uuid, false);
+ LLMarketplaceData::instance().setVersionFolder(listing_uuid, LLUUID::null);
+ LLMarketplaceData::instance().activateListing(listing_uuid, false);
}
}
@@ -181,7 +181,7 @@ void update_marketplace_category(const LLUUID& cur_uuid)
{
// *TODO : Confirm with Producer that this is what we want to happen in that case!
llinfos << "Merov : Disassociate as the listing folder is not under the marketplace folder anymore!!" << llendl;
- LLMarketplaceData::instance().deleteListing(cur_uuid);
+ LLMarketplaceData::instance().clearListing(cur_uuid);
}
}
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index 74ea453c50..f4b4d8aa27 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -1049,6 +1049,26 @@ bool LLMarketplaceData::createListing(const LLUUID& folder_id)
return true;
}
+bool LLMarketplaceData::clearListing(const LLUUID& folder_id)
+{
+ // Folder id can be the root of the listing or not so we need to retrieve the root first
+ S32 depth = depth_nesting_in_marketplace(folder_id);
+ LLUUID listing_uuid = nested_parent_id(folder_id, depth);
+ S32 listing_id = getListingID(listing_uuid);
+ if (listing_id == 0)
+ {
+ // Listing doesn't exists -> exit with error
+ return false;
+ }
+
+ // Update the SLM Server so that this listing is not active anymore
+ // *TODO : use deleteSLMListing()
+ deleteListing(listing_uuid);
+ updateSLMListing(listing_uuid, listing_id, LLUUID::null, false);
+
+ return true;
+}
+
bool LLMarketplaceData::activateListing(const LLUUID& folder_id, bool activate)
{
// Folder id can be the root of the listing or not so we need to retrieve the root first
@@ -1126,8 +1146,8 @@ bool LLMarketplaceData::deleteListing(const LLUUID& folder_id)
// Listing doesn't exist -> exit with error
return false;
}
- // *TODO : Implement SLM API for deleting SLM records once it exists there...
mMarketplaceItems.erase(folder_id);
+
update_marketplace_category(folder_id);
gInventory.notifyObservers();
return true;
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index ed4af544db..2aee41d3d8 100755
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -145,44 +145,53 @@ private:
bool mIsActive;
std::string mEditURL;
};
-// Note: The listing folder UUID is used as a key to this map. It could therefore be taken off the LLMarketplaceTuple objects themselves
+// Notes:
+// * The mListingFolderId is used as a key to this map. It could therefore be taken off the LLMarketplaceTuple objects themselves.
+// * The SLM DB however uses mListingId as its primary key and it shows in its API. In the viewer though, the mListingFolderId is what we use to grab an inventory record.
typedef std::map<LLUUID, LLMarketplaceTuple> marketplace_items_list_t;
-// Session cache of Marketplace tuples
-// Note: There's one and only one possible set of Marketplace dataset per agent and per session
+// Session cache of all Marketplace tuples
+// Notes:
+// * There's one and only one possible set of Marketplace dataset per agent and per session thus making it an LLSingleton
+// * Some of those records might correspond to folders that do not exist in the inventory anymore. We do not clear them out though. They just won't show up in the UI.
+
+class LLSLMGetMerchantResponder;
+class LLSLMGetListingsResponder;
+class LLSLMCreateListingsResponder;
+class LLSLMUpdateListingsResponder;
+class LLSLMAssociateListingsResponder;
+
class LLMarketplaceData
: public LLSingleton<LLMarketplaceData>
{
public:
+ friend class LLSLMGetMerchantResponder;
+ friend class LLSLMGetListingsResponder;
+ friend class LLSLMCreateListingsResponder;
+ friend class LLSLMUpdateListingsResponder;
+ friend class LLSLMAssociateListingsResponder;
+
LLMarketplaceData();
virtual ~LLMarketplaceData();
- // SLM Public
+ // Public SLM API : Initialization and status
typedef boost::signals2::signal<void ()> status_updated_signal_t;
U32 getSLMStatus() const { return mMarketPlaceStatus; }
- void setSLMStatus(U32 status);
void initializeSLM(const status_updated_signal_t::slot_type& cb);
void getSLMListings();
- //void getSLMListing();
- void createSLMListing(const LLUUID& folder_id);
- void updateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed);
- void associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id);
-
bool isEmpty() { return (mMarketplaceItems.size() == 0); }
- // Probe the Marketplace data set to identify folders
- bool isListed(const LLUUID& folder_id); // returns true if folder_id is a Listing folder
- bool isVersionFolder(const LLUUID& folder_id); // returns true if folder_id is a Version folder
-
// Create/Delete Marketplace data set : each method returns true if the function succeeds, false if error
bool createListing(const LLUUID& folder_id);
bool activateListing(const LLUUID& folder_id, bool activate);
+ bool clearListing(const LLUUID& folder_id);
bool setVersionFolder(const LLUUID& folder_id, const LLUUID& version_id);
-
- bool addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed);
bool associateListing(const LLUUID& folder_id, S32 listing_id);
- bool deleteListing(const LLUUID& folder_id);
-
+
+ // Probe the Marketplace data set to identify folders
+ bool isListed(const LLUUID& folder_id); // returns true if folder_id is a Listing folder
+ bool isVersionFolder(const LLUUID& folder_id); // returns true if folder_id is a Version folder
+
// Access Marketplace data set : each method returns a default value if the folder_id can't be found
bool getActivationState(const LLUUID& folder_id);
S32 getListingID(const LLUUID& folder_id);
@@ -190,18 +199,25 @@ public:
std::string getListingURL(const LLUUID& folder_id);
LLUUID getListingFolder(S32 listing_id);
+ // Used to flag if count values for Marketplace are likely to have to be updated
+ bool checkDirtyCount() { if (mDirtyCount) { mDirtyCount = false; return true; } else { return false; } }
+ void setDirtyCount() { mDirtyCount = true; }
+
+private:
// Modify Marketplace data set : each method returns true if the function succeeds, false if error
+ // Used internally only by SLM Responders when data are received from the SLM Server
+ bool addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed);
+ bool deleteListing(const LLUUID& folder_id);
bool setListingID(const LLUUID& folder_id, S32 listing_id);
bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id);
bool setActivation(const LLUUID& folder_id, bool activate);
bool setEditURL(const LLUUID& folder_id, const std::string& edit_url);
- // Used to flag if count values for Marketplace are likely to have to be updated
- bool checkDirtyCount() { if (mDirtyCount) { mDirtyCount = false; return true; } else { return false; } }
- void setDirtyCount() { mDirtyCount = true; }
-
-private:
- // SLM Private
+ // Private SLM API : package data and get/post/put requests to the SLM Server through the SLM API
+ void setSLMStatus(U32 status);
+ void createSLMListing(const LLUUID& folder_id);
+ void updateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed);
+ void associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id);
std::string getSLMConnectURL(const std::string& route);
// Handling Marketplace connection and inventory connection