diff options
| author | Merov Linden <merov@lindenlab.com> | 2014-04-28 15:53:54 -0700 | 
|---|---|---|
| committer | Merov Linden <merov@lindenlab.com> | 2014-04-28 15:53:54 -0700 | 
| commit | f15442a82a2bfee00694b0097abdf6aeae083e14 (patch) | |
| tree | 89ae04ea305d78bfa5be56d27b0103e807e6b7a4 | |
| parent | fc4939033e089354bc05fd0ca7fe402a4a1198bd (diff) | |
DD-22 : WIP : Implements getSLMListings(). Does no parsing for the moment
| -rwxr-xr-x | indra/newview/llfloatermarketplacelistings.cpp | 2 | ||||
| -rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 84 | ||||
| -rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 6 | 
3 files changed, 68 insertions, 24 deletions
diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index ccfca71df9..e2bf9f0206 100755 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -264,6 +264,8 @@ void LLFloaterMarketplaceListings::fetchContents()  	if (mRootFolderId.notNull())  	{  		LLInventoryModelBackgroundFetch::instance().start(mRootFolderId); +        // Get all the SLM Listings +        LLMarketplaceData::instance().getSLMListings();  	}  } diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index c3aaf66071..b85828ddfd 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -96,7 +96,7 @@ LLSD getMarketplaceStringSubstitutions()  }  /////////////////////////////////////////////////////////////////////////////// -// SLM Responder +// SLM Responders  class LLSLMMerchantResponder : public LLHTTPClient::Responder  {  	LOG_CLASS(LLSLMMerchantResponder); @@ -132,7 +132,41 @@ public:  		}      }  }; -// SLM Responder End + +class LLSLMListingsResponder : public LLHTTPClient::Responder +{ +	LOG_CLASS(LLSLMListingsResponder); +public: +	 +    LLSLMListingsResponder() {} +     +	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; +            // *TODO : Parse the Json body +            //LLMarketplaceData::instance().parseListings(content); +		} +		else +		{ +            llinfos << "Merov : completed with error, status = " << status << ", reason = " << reason << ", content = " << content << llendl; +		} +	} +     +    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; +		} +		else +		{ +            llinfos << "Merov : completed header with error, status = " << status << ", reason = " << reason << ", content = " << content << llendl; +		} +    } +}; +// SLM Responders End  ///////////////////////////////////////////////////////////////////////////////  namespace LLMarketplaceImport @@ -621,34 +655,36 @@ void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type&  		mStatusUpdatedSignal = new status_updated_signal_t();  	}  	mStatusUpdatedSignal->connect(cb); -     -    // 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 == "") +	LLHTTPClient::get(getSLMConnectURL("/merchant"), new LLSLMMerchantResponder(), LLSD()); +} + +void LLMarketplaceData::getSLMListings() +{ +	LLHTTPClient::get(getSLMConnectURL("/listings"), new LLSLMListingsResponder(), LLSD()); +} + +std::string LLMarketplaceData::getSLMConnectURL(const std::string& route) +{ +    std::string url(""); +    LLViewerRegion *regionp = gAgent.getRegion(); +    if (regionp)      { -        url = "https://marketplace.secondlife-staging.com/api/1/viewer/" + gAgentID.asString() + "/merchant"; +        // Get DirectDelivery cap +        url = regionp->getCapability("DirectDelivery"); +        // *TODO : Take this DirectDelivery cap coping mechanism hack out +        if (url == "") +        { +            url = "https://marketplace.secondlife-staging.com/api/1/viewer/" + gAgentID.asString(); +        } +        url += route;      } -    llinfos << "Merov : Testing get : " << url << llendl; -     -	LLHTTPClient::get(url, new LLSLMMerchantResponder(), LLSD()); +    llinfos << "Merov : Testing getSLMConnectURL : " << url << llendl; +	return url;  }  void LLMarketplaceData::setSLMStatus(U32 status)  { -    mMarketPlaceStatus = status; /* call cb if status is "done" */ - -    // Make sure we trigger the status change with the current state +    mMarketPlaceStatus = status;      if (mStatusUpdatedSignal)      {          (*mStatusUpdatedSignal)(); diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index 237432068c..d5869d3025 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -150,6 +150,12 @@ public:  	U32  getSLMStatus() const { return mMarketPlaceStatus; }  	void setSLMStatus(U32 status);      void initializeSLM(const status_updated_signal_t::slot_type& cb); +    void getSLMListings(); +    //void getSLMListing(); +    //void postSLMListing(); +    //void modifySLMListing(); +    //void associateSLMListing(); +    std::string getSLMConnectURL(const std::string& route);      bool isEmpty() { return (mMarketplaceItems.size() == 0); }  | 
