diff options
author | dolphin <dolphin@lindenlab.com> | 2013-08-19 09:24:04 -0700 |
---|---|---|
committer | dolphin <dolphin@lindenlab.com> | 2013-08-19 09:24:04 -0700 |
commit | b980efd014ddb56650fffeb7968901b8e6bc2837 (patch) | |
tree | 6c21ef82c540379030833af5e1a1aeae999526fd /indra/newview/llexperienceassociationresponder.cpp | |
parent | 02b501e4dc9a389878cd323e4f781bc752fec737 (diff) |
Added experience association info llsidepaneliteminfo for scripts.
Changed the cap which looks up a script association to take a object/item id pair
instead of a asset id.
Updated llpreviewscript to use the new cap (which also improves loading time
since it can be done in parallel with the lsltext retrieval).
Diffstat (limited to 'indra/newview/llexperienceassociationresponder.cpp')
-rw-r--r-- | indra/newview/llexperienceassociationresponder.cpp | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/indra/newview/llexperienceassociationresponder.cpp b/indra/newview/llexperienceassociationresponder.cpp index 69451bc054..33ada4906d 100644 --- a/indra/newview/llexperienceassociationresponder.cpp +++ b/indra/newview/llexperienceassociationresponder.cpp @@ -1,6 +1,8 @@ /** * @file llexperienceassociationresponder.cpp - * @brief llexperienceassociationresponder implementation + * @brief llexperienceassociationresponder implementation. This class combines + * a lookup for a script association and an experience details request. The first + * is always async, but the second may be cached locally. * * $LicenseInfo:firstyear=2013&license=viewerlgpl$ * Second Life Viewer Source Code @@ -27,12 +29,38 @@ #include "llviewerprecompiledheaders.h" #include "llexperienceassociationresponder.h" #include "llexperiencecache.h" +#include "llviewerregion.h" +#include "llagent.h" ExperienceAssociationResponder::ExperienceAssociationResponder(ExperienceAssociationResponder::callback_t callback):mCallback(callback) { ref(); } +void ExperienceAssociationResponder::fetchAssociatedExperience( const LLUUID& object_id, const LLUUID& item_id, callback_t callback ) +{ + LLSD request; + request["object-id"]=object_id; + request["item-id"]=item_id; + fetchAssociatedExperience(request, callback); +} + +void ExperienceAssociationResponder::fetchAssociatedExperience(LLSD& request, callback_t callback) +{ + LLViewerRegion* region = gAgent.getRegion(); + if (region) + { + std::string lookup_url=region->getCapability("GetMetadata"); + if(!lookup_url.empty()) + { + LLSD fields; + fields.append("experience"); + request["fields"] = fields; + LLHTTPClient::post(lookup_url, request, new ExperienceAssociationResponder(callback)); + } + } +} + void ExperienceAssociationResponder::error( U32 status, const std::string& reason ) { LLSD msg; @@ -52,22 +80,11 @@ void ExperienceAssociationResponder::result( const LLSD& content ) msg["message"]="no experience"; msg["error"]=-1; sendResult(msg); - LL_ERRS("ExperienceAssociation") << "Associated experience missing" << LL_ENDL; + return; } LLExperienceCache::get(content["experience"].asUUID(), boost::bind(&ExperienceAssociationResponder::sendResult, this, _1)); - /* LLLiveLSLEditor* scriptCore = LLFloaterReg::findTypedInstance<LLLiveLSLEditor>("preview_scriptedit", mParent); - - if(!scriptCore) - return; - - LLUUID id; - if(content.has("experience")) - { - id=content["experience"].asUUID(); - } - scriptCore->setAssociatedExperience(id);*/ } void ExperienceAssociationResponder::sendResult( const LLSD& experience ) |