diff options
author | dolphin <dolphin@lindenlab.com> | 2014-05-09 10:26:06 -0700 |
---|---|---|
committer | dolphin <dolphin@lindenlab.com> | 2014-05-09 10:26:06 -0700 |
commit | bb5e0f7877d06f10cd9ba82bc596a072427306b2 (patch) | |
tree | 534e3a99f342fff55a7f365b3d7552853bc3e17f /indra/newview/llfloaterexperiences.cpp | |
parent | d331db79c2a1f07f9919703677b44d4664c36509 (diff) |
Enable the experience purchase button based on the sim providing purchase info.
Diffstat (limited to 'indra/newview/llfloaterexperiences.cpp')
-rw-r--r-- | indra/newview/llfloaterexperiences.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/indra/newview/llfloaterexperiences.cpp b/indra/newview/llfloaterexperiences.cpp index 2153079fa4..5ed77d3680 100644 --- a/indra/newview/llfloaterexperiences.cpp +++ b/indra/newview/llfloaterexperiences.cpp @@ -47,11 +47,13 @@ class LLExperienceListResponder : public LLHTTPClient::Responder { public: typedef std::map<std::string, std::string> NameMap; - LLExperienceListResponder(const LLHandle<LLFloaterExperiences>& parent, NameMap& nameMap, const std::string& errorMessage="ErrorMessage"):mParent(parent),mErrorMessage(errorMessage) - { - mNameMap.swap(nameMap); - } + typedef boost::function<void(LLPanelExperiences*, const LLSD&)> Callback; + LLExperienceListResponder(const LLHandle<LLFloaterExperiences>& parent, NameMap& nameMap, const std::string& errorMessage="ErrorMessage"):mParent(parent),mErrorMessage(errorMessage) + { + mNameMap.swap(nameMap); + } + Callback mCallback; LLHandle<LLFloaterExperiences> mParent; NameMap mNameMap; const std::string mErrorMessage; @@ -73,7 +75,10 @@ public: { const LLSD& ids = content[it->first]; tab->setExperienceList(ids); - tab->enableButton(ids.beginArray() == ids.endArray()); + if(!mCallback.empty()) + { + mCallback(tab, content); + } } } ++it; @@ -298,6 +303,11 @@ void LLFloaterExperiences::onClose( bool app_quitting ) LLFloater::onClose(app_quitting); } +void LLFloaterExperiences::checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content) const +{ + panel->enableButton(content.has("purchase")); +} + void LLFloaterExperiences::sendPurchaseRequest() const { LLViewerRegion* region = gAgent.getRegion(); @@ -308,6 +318,8 @@ void LLFloaterExperiences::sendPurchaseRequest() const LLExperienceListResponder::NameMap nameMap; nameMap["experience_ids"]="Owned_Experiences_Tab"; - LLHTTPClient::post(url, content, new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap, "ExperienceAcquireFailed")); + LLExperienceListResponder* responder = new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap, "ExperienceAcquireFailed"); + responder->mCallback = boost::bind(&LLFloaterExperiences::checkPurchaseInfo, this, _1, _2); + LLHTTPClient::post(url, content, responder); } } |