diff options
author | Rider Linden <rider@lindenlab.com> | 2015-09-03 11:10:32 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2015-09-03 11:10:32 -0700 |
commit | c08072a0508cefc6bfc8c05937e984a095f323ce (patch) | |
tree | 888f05cc81991e0916c800afba167a0cc5da766c /indra/llmessage | |
parent | 346f885473282a2826699c1d2c7dd624d60a1bf3 (diff) |
Moved group experiences into experience cache. Use coros and new HTTP libs.
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llexperiencecache.cpp | 41 | ||||
-rw-r--r-- | indra/llmessage/llexperiencecache.h | 2 |
2 files changed, 43 insertions, 0 deletions
diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp index 29ca0b2820..233b15dcdd 100644 --- a/indra/llmessage/llexperiencecache.cpp +++ b/indra/llmessage/llexperiencecache.cpp @@ -635,6 +635,47 @@ void LLExperienceCache::findExperienceByNameCoro(LLCoreHttpUtil::HttpCoroutineAd fn(result); } +//------------------------------------------------------------------------- +void LLExperienceCache::getGroupExperiences(const LLUUID &groupId, ExperienceGetFn_t fn) +{ + if (mCapability.empty()) + { + LL_WARNS("ExperienceCache") << "Capability query method not set." << LL_ENDL; + return; + } + + LLCoprocedureManager::getInstance()->enqueueCoprocedure("ExpCache", "Group Experiences", + boost::bind(&LLExperienceCache::getGroupExperiencesCoro, this, _1, groupId, fn)); +} + +void LLExperienceCache::getGroupExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &httpAdapter, LLUUID groupId, ExperienceGetFn_t fn) +{ + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest()); + + // search for experiences owned by the current group + std::string url = mCapability("GroupExperiences"); + if (url.empty()) + { + LL_WARNS("ExperienceCache") << "No Group Experiences capability" << LL_ENDL; + } + + url += "?" + groupId.asString(); + + LLSD result = httpAdapter->getAndYield(httpRequest, url); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + if (!status) + { + fn(LLSD()); + return; + } + + const LLSD& experienceIds = result["experience_ids"]; + fn(experienceIds); +} + //========================================================================= void LLExperienceCacheImpl::mapKeys(const LLSD& legacyKeys) { diff --git a/indra/llmessage/llexperiencecache.h b/indra/llmessage/llexperiencecache.h index f6f69d92ba..76cbbb6ed6 100644 --- a/indra/llmessage/llexperiencecache.h +++ b/indra/llmessage/llexperiencecache.h @@ -65,6 +65,7 @@ public: //------------------------------------------- void fetchAssociatedExperience(const LLUUID& objectId, const LLUUID& itemId, ExperienceGetFn_t fn); void findExperienceByName(const std::string text, int page, ExperienceGetFn_t fn); + void getGroupExperiences(const LLUUID &groupId, ExperienceGetFn_t fn); //------------------------------------------- static const std::string NAME; // "name" @@ -137,6 +138,7 @@ private: void fetchAssociatedExperienceCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, LLUUID, LLUUID, ExperienceGetFn_t); void findExperienceByNameCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, std::string, int, ExperienceGetFn_t); + void getGroupExperiencesCoro(LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t &, LLUUID , ExperienceGetFn_t); void bootstrap(const LLSD& legacyKeys, int initialExpiration); void exportFile(std::ostream& ostr) const; |