summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-04-25 17:12:49 -0700
committerMerov Linden <merov@lindenlab.com>2014-04-25 17:12:49 -0700
commit6d7b33f77e6d6facd585faf8c5d355f68942fcef (patch)
tree406956731f84eb55a1b41364c9c4b48e79385ac2 /indra/newview
parentc00909603adc5981b05f4f9e31d067be64e8c6c2 (diff)
DD-22 : WIP : Implemented SLM API GET merchant, use it in initialization but glitch in UI (needs to reopen the floater to see content)
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llfloatermarketplacelistings.cpp18
-rwxr-xr-xindra/newview/llmarketplacefunctions.cpp94
-rwxr-xr-xindra/newview/llmarketplacefunctions.h8
3 files changed, 96 insertions, 24 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp
index 76cca065c8..27b31518a1 100755
--- a/indra/newview/llfloatermarketplacelistings.cpp
+++ b/indra/newview/llfloatermarketplacelistings.cpp
@@ -160,7 +160,8 @@ public:
if (added_category_type == LLFolderType::FT_MARKETPLACE_LISTINGS)
{
- mMarketplaceListingsFloater->initializeMarketPlace();
+ //mMarketplaceListingsFloater->initializeMarketPlace();
+ LLMarketplaceData::instance().initializeSLM();
}
}
}
@@ -234,9 +235,11 @@ void LLFloaterMarketplaceListings::onOpen(const LLSD& key)
//
// Initialize the Market Place or go update the marketplace listings
//
- if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
+ //if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
+ if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
{
- initializeMarketPlace();
+ //initializeMarketPlace();
+ LLMarketplaceData::instance().initializeSLM();
}
else
{
@@ -269,7 +272,8 @@ void LLFloaterMarketplaceListings::fetchContents()
void LLFloaterMarketplaceListings::setup()
{
- if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)
+ //if (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)
+ if (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_PLACE_MERCHANT)
{
// If we are *not* a merchant or we have no market place connection established yet, do nothing
return;
@@ -375,7 +379,8 @@ void LLFloaterMarketplaceListings::updateView()
std::string tooltip;
const LLSD& subs = getMarketplaceStringSubstitutions();
- U32 mkt_status = LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus();
+ //U32 mkt_status = LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus();
+ U32 mkt_status = LLMarketplaceData::instance().getSLMStatus();
// *TODO : check those messages and create better appropriate ones in strings.xml
if (mRootFolderId.notNull())
@@ -485,7 +490,8 @@ void LLFloaterMarketplaceListings::initializationReportError(U32 status, const L
void LLFloaterMarketplaceListings::importStatusChanged(bool inProgress)
{
- if (mRootFolderId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
+ //if (mRootFolderId.isNull() && (LLMarketplaceInventoryImporter::getInstance()->getMarketPlaceStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
+ if (mRootFolderId.isNull() && (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT))
{
setup();
}
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index 40417bf77b..607f907ed1 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -95,6 +95,46 @@ LLSD getMarketplaceStringSubstitutions()
return marketplace_sub_map;
}
+///////////////////////////////////////////////////////////////////////////////
+// SLM Responder
+class LLSLMMerchantResponder : public LLHTTPClient::Responder
+{
+ LOG_CLASS(LLSLMMerchantResponder);
+public:
+
+ LLSLMMerchantResponder() {}
+
+ virtual void completed(U32 status, const std::string& reason, const LLSD& content)
+ {
+ if (isGoodStatus(status))
+ {
+ llinfos << "Merov : completed successful, status = " << status << ", reason = " << reason << ", content = " << content << llendl;
+ LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_MERCHANT);
+ }
+ else
+ {
+ llinfos << "Merov : completed with error, status = " << status << ", reason = " << reason << ", content = " << content << llendl;
+ LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT);
+ }
+ }
+
+ void completedHeader(U32 status, const std::string& reason, const LLSD& content)
+ {
+ if (isGoodStatus(status))
+ {
+ llinfos << "Merov : completed header successful, status = " << status << ", reason = " << reason << ", content = " << content << llendl;
+ LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_MERCHANT);
+ }
+ else
+ {
+ llinfos << "Merov : completed header with error, status = " << status << ", reason = " << reason << ", content = " << content << llendl;
+ LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT);
+ }
+ }
+};
+// SLM Responder End
+///////////////////////////////////////////////////////////////////////////////
+
namespace LLMarketplaceImport
{
// Basic interface for this namespace
@@ -427,27 +467,15 @@ void LLMarketplaceInventoryImporter::initialize()
return;
}
- // Test DirectDelivery cap
- LLViewerRegion* region = gAgent.getRegion();
- if (region)
+ if (!LLMarketplaceImport::hasSessionCookie())
{
- std::string url = region->getCapability("DirectDelivery");
- llinfos << "Merov : Test DirectDelivery cap : url = " << url << llendl;
+ mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING;
+ LLMarketplaceImport::establishMarketplaceSessionCookie();
}
else
{
- llinfos << "Merov : Test DirectDelivery cap : no region accessible" << llendl;
+ mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT;
}
-
- if (!LLMarketplaceImport::hasSessionCookie())
- {
- mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING;
- LLMarketplaceImport::establishMarketplaceSessionCookie();
- }
- else
- {
- mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_MERCHANT;
- }
}
void LLMarketplaceInventoryImporter::reinitializeAndTriggerImport()
@@ -573,11 +601,43 @@ LLMarketplaceTuple::LLMarketplaceTuple(const LLUUID& folder_id, S32 listing_id,
// Data map
-LLMarketplaceData::LLMarketplaceData()
+LLMarketplaceData::LLMarketplaceData() :
+ mMarketPlaceStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED)
{
mTestCurrentMarketplaceID = 1234567;
}
+S32 LLMarketplaceData::getTestMarketplaceID()
+{
+ return mTestCurrentMarketplaceID++;
+}
+
+void LLMarketplaceData::initializeSLM()
+{
+ mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING;
+
+ // Get DirectDelivery cap
+ std::string url = "";
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ url = region->getCapability("DirectDelivery");
+ llinfos << "Merov : Test DirectDelivery cap : url = " << url << llendl;
+ }
+ else
+ {
+ llinfos << "Merov : Test DirectDelivery cap : no region accessible" << llendl;
+ }
+ // *TODO : Take this DirectDelivery cap coping hack out
+ if (url == "")
+ {
+ url = "https://marketplace.secondlife-staging.com/api/1/viewer/" + gAgentID.asString() + "/merchant";
+ }
+ llinfos << "Merov : Testing get : " << url << llendl;
+
+ LLHTTPClient::get(url, new LLSLMMerchantResponder(), LLSD());
+}
+
// Creation / Deletion
bool LLMarketplaceData::addListing(const LLUUID& folder_id)
{
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index a587419323..a71ccfd53e 100755
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -145,6 +145,11 @@ class LLMarketplaceData
public:
LLMarketplaceData();
+ // SLM
+ U32 getSLMStatus() const { return mMarketPlaceStatus; }
+ void setSLMStatus(U32 status) { mMarketPlaceStatus = status; }
+ void initializeSLM();
+
bool isEmpty() { return (mMarketplaceItems.size() == 0); }
// Probe the Marketplace data set to identify folders
@@ -169,10 +174,11 @@ public:
bool setActivation(const LLUUID& folder_id, bool activate);
// Merov : Test method while waiting for SLM API
- S32 getTestMarketplaceID() { return mTestCurrentMarketplaceID++; }
+ S32 getTestMarketplaceID();
private:
marketplace_items_list_t mMarketplaceItems;
+ U32 mMarketPlaceStatus;
// Merov : This is for test only, waiting for SLM API
S32 mTestCurrentMarketplaceID;
};