summaryrefslogtreecommitdiff
path: root/indra/newview/llmarketplacefunctions.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-04-18 14:41:32 -0700
committerMerov Linden <merov@lindenlab.com>2014-04-18 14:41:32 -0700
commita99e2475443bebb6b9c9d2c8998300ce50f254a8 (patch)
tree36feb4d625180b9e2dfd7044f9f205d234a760c6 /indra/newview/llmarketplacefunctions.cpp
parentc52b4e27f2fbeb558eec3ea587fe88f8e5b947dd (diff)
DD-58 : Implement associate listing UI and primitive
Diffstat (limited to 'indra/newview/llmarketplacefunctions.cpp')
-rwxr-xr-xindra/newview/llmarketplacefunctions.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index 9465401d88..6ff6ba6714 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -584,6 +584,28 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id)
return true;
}
+bool LLMarketplaceData::associateListing(const LLUUID& folder_id, std::string listing_id)
+{
+ if (isListed(folder_id))
+ {
+ // Listing already exists -> exit with error
+ return false;
+ }
+ mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id);
+
+ // Check that the listing ID is not already associated to some other record
+ LLUUID old_listing = getListingFolder(listing_id);
+ if (old_listing.notNull())
+ {
+ // If it is already used, unlist the old record (we can't have 2 listings with the same listing ID)
+ deleteListing(old_listing);
+ }
+
+ setListingID(folder_id,listing_id);
+ update_marketplace_category(folder_id);
+ return true;
+}
+
bool LLMarketplaceData::deleteListing(const LLUUID& folder_id)
{
if (!isListed(folder_id))
@@ -630,6 +652,21 @@ LLUUID LLMarketplaceData::getVersionFolderID(const LLUUID& folder_id)
return (it == mMarketplaceItems.end() ? LLUUID::null : (it->second).mVersionFolderId);
}
+// Reverse lookup : find the listing folder id from the listing id
+LLUUID LLMarketplaceData::getListingFolder(std::string listing_id)
+{
+ marketplace_items_list_t::iterator it = mMarketplaceItems.begin();
+ while (it != mMarketplaceItems.end())
+ {
+ if ((it->second).mListingId == listing_id)
+ {
+ return (it->second).mListingFolderId;
+ }
+ it++;
+ }
+ return LLUUID::null;
+}
+
bool LLMarketplaceData::isListed(const LLUUID& folder_id)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id);