diff options
author | Alexander Gavriliuk <alexandrgproductengine@lindenlab.com> | 2023-10-14 00:11:06 +0200 |
---|---|---|
committer | Guru <alexandrgproductengine@lindenlab.com> | 2023-10-14 02:31:07 +0200 |
commit | 70956fb2dbc42501d27a474e3f80003d591ee646 (patch) | |
tree | 30ec887589f894c68a81233ee99a518501497021 /indra/newview/llpanelavatar.cpp | |
parent | 96e459256410cd18f1506f7e0b2118955ea65b81 (diff) |
SL-20163 Allow residents to hide exact join date on profiles
Diffstat (limited to 'indra/newview/llpanelavatar.cpp')
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index ff33efe4aa..626978f9fb 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -127,6 +127,48 @@ void LLPanelProfileTab::setApplyProgress(bool started) } } +static void put_avatar_properties_coro(std::string cap_url, LLUUID agent_id, LLSD data) +{ + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t + httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("put_avatar_properties_coro", httpPolicy)); + LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); + LLCore::HttpHeaders::ptr_t httpHeaders; + + LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpOpts->setFollowRedirects(true); + + std::string finalUrl = cap_url + "/" + agent_id.asString(); + + LLSD result = httpAdapter->putAndSuspend(httpRequest, finalUrl, data, httpOpts, httpHeaders); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + if (!status) + { + LL_WARNS("AvatarProperties") << "Failed to put agent information " << data << " for id " << agent_id << LL_ENDL; + return; + } + + LL_DEBUGS("AvatarProperties") << "Agent id: " << agent_id << " Data: " << data << " Result: " << httpResults << LL_ENDL; +} + +bool LLPanelProfileTab::saveAgentUserInfoCoro(std::string name, LLSD value) const +{ + std::string cap_url = gAgent.getRegionCapability("AgentProfile"); + if (cap_url.empty()) + { + LL_WARNS("AvatarProperties") << "Failed to update profile data, no cap found" << LL_ENDL; + return false; + } + + LLCoros::instance().launch("putAgentUserInfoCoro", + boost::bind(put_avatar_properties_coro, cap_url, getAvatarId(), LLSD().with(name, value))); + + return true; +} + LLPanelProfilePropertiesProcessorTab::LLPanelProfilePropertiesProcessorTab() : LLPanelProfileTab() { |