diff options
author | Rider Linden <rider@lindenlab.com> | 2015-09-03 16:14:40 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2015-09-03 16:14:40 -0700 |
commit | ec998b4c6efee0ddba48481dfba630e18c53a29c (patch) | |
tree | 85a6179d3d4dd13abe0dd71e071b6c38502bf1b4 /indra/newview | |
parent | e0c27db16771ebcc95111595acea192fd52e5e02 (diff) |
Region experience allow/disallow.
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/llfloaterregioninfo.cpp | 58 | ||||
-rwxr-xr-x | indra/newview/llfloaterregioninfo.h | 2 |
2 files changed, 20 insertions, 40 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 37e934429f..a166dda8ee 100755 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -3586,29 +3586,6 @@ void LLPanelRegionExperiences::processResponse( const LLSD& content ) } - -class LLRegionExperienceResponder : public LLHTTPClient::Responder -{ -public: - typedef boost::function<void (const LLSD&)> callback_t; - - callback_t mCallback; - - LLRegionExperienceResponder(callback_t callback) : mCallback(callback) { } - -protected: - /*virtual*/ void httpSuccess() - { - mCallback(getContent()); - } - - /*virtual*/ void httpFailure() - { - LL_WARNS() << "experience responder failed [status:" << getStatus() << "]: " << getContent() << LL_ENDL; - } -}; - - // Used for both access add and remove operations, depending on the flag // passed in (ESTATE_EXPERIENCE_ALLOWED_ADD, ESTATE_EXPERIENCE_ALLOWED_REMOVE, etc.) // static @@ -3691,6 +3668,13 @@ void LLPanelRegionExperiences::infoCallback(LLHandle<LLPanelRegionExperiences> h } } +/*static*/ +std::string LLPanelRegionExperiences::regionCapabilityQuery(LLViewerRegion* region, const std::string &cap) +{ + // region->getHandle() How to get a region * from a handle? + + return region->getCapability(cap); +} bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region) { @@ -3715,13 +3699,10 @@ bool LLPanelRegionExperiences::refreshFromRegion(LLViewerRegion* region) mTrusted->loading(); mTrusted->setReadonly(!allow_modify); - std::string url = region->getCapability("RegionExperiences"); - if (!url.empty()) - { - LLHTTPClient::get(url, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::infoCallback, - getDerivedHandle<LLPanelRegionExperiences>(), _1))); - } - return LLPanelRegionInfo::refreshFromRegion(region); + LLExperienceCache::getInstance()->getRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1), + boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1)); + + return LLPanelRegionInfo::refreshFromRegion(region); } LLSD LLPanelRegionExperiences::addIds(LLPanelExperienceListEditor* panel) @@ -3739,18 +3720,15 @@ LLSD LLPanelRegionExperiences::addIds(LLPanelExperienceListEditor* panel) BOOL LLPanelRegionExperiences::sendUpdate() { LLViewerRegion* region = gAgent.getRegion(); - std::string url = region->getCapability("RegionExperiences"); - if (!url.empty()) - { - LLSD content; - content["allowed"]=addIds(mAllowed); - content["blocked"]=addIds(mBlocked); - content["trusted"]=addIds(mTrusted); + LLSD content; - LLHTTPClient::post(url, content, new LLRegionExperienceResponder(boost::bind(&LLPanelRegionExperiences::infoCallback, - getDerivedHandle<LLPanelRegionExperiences>(), _1))); - } + content["allowed"]=addIds(mAllowed); + content["blocked"]=addIds(mBlocked); + content["trusted"]=addIds(mTrusted); + + LLExperienceCache::getInstance()->setRegionExperiences(boost::bind(&LLPanelRegionExperiences::regionCapabilityQuery, region, _1), + content, boost::bind(&LLPanelRegionExperiences::infoCallback, getDerivedHandle<LLPanelRegionExperiences>(), _1)); return TRUE; } diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 90f115faaf..3c74618fff 100755 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -479,6 +479,8 @@ public: private: void refreshRegionExperiences(); + static std::string regionCapabilityQuery(LLViewerRegion* region, const std::string &cap); + LLPanelExperienceListEditor* setupList(const char* control_name, U32 add_id, U32 remove_id); static LLSD addIds( LLPanelExperienceListEditor* panel ); |