From f99dbd9be0f631ee9135ac89d8322c359711d626 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 21 Oct 2014 21:46:16 -0700 Subject: DD-224 : WIP : Add a deleteListing method, call SLM_UPDATE_FOLDER notification if state is deleted --- indra/newview/llmarketplacefunctions.cpp | 11 +++++++++++ indra/newview/llmarketplacefunctions.h | 1 + indra/newview/llviewermessage.cpp | 13 +++++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 4bf0eac03b..5e4615dbda 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -1487,6 +1487,17 @@ bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update_slm) return true; } +bool LLMarketplaceData::deleteListing(S32 listing_id) +{ + if (listing_id == 0) + { + return false; + } + + LLUUID folder_id = getListingFolder(listing_id); + return deleteListing(folder_id); +} + // Accessors bool LLMarketplaceData::getActivationState(const LLUUID& folder_id) { diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 18ff313555..c2b287eea9 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -197,6 +197,7 @@ public: bool associateListing(const LLUUID& folder_id, const LLUUID& source_folder_id, S32 listing_id); bool getListing(const LLUUID& folder_id); bool getListing(S32 listing_id); + bool deleteListing(S32 listing_id); // Probe the Marketplace data set to identify folders bool isListed(const LLUUID& folder_id); // returns true if folder_id is a Listing folder diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 871ed8c0df..931b16ccb7 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -5968,9 +5968,18 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem) // Special Marketplace update notification if (notificationID == "SLM_UPDATE_FOLDER") { + std::string state = llsdBlock["state"].asString(); + llinfos << "Merov : SLM_UPDATE_FOLDER, state = " << state << ", id = " << llsdBlock["listing_id"].asInteger() << llendl; // In general, no message will be displayed, all we want is to get the listing updated in the marketplace floater - // If getListing() fails though, the message of the alert will be shown by the caller of attempt_standard_notification() - return LLMarketplaceData::instance().getListing(llsdBlock["listing_id"].asInteger()); + // If getListing() or deleteListing() fails though, the message of the alert will be shown by the caller of attempt_standard_notification() + if (state == "deleted") + { + return LLMarketplaceData::instance().deleteListing(llsdBlock["listing_id"].asInteger()); + } + else + { + return LLMarketplaceData::instance().getListing(llsdBlock["listing_id"].asInteger()); + } } LLNotificationsUtil::add(notificationID, llsdBlock); -- cgit v1.2.3