diff options
| author | Todd Stinson <stinson@lindenlab.com> | 2012-05-17 20:02:53 -0700 |
|---|---|---|
| committer | Todd Stinson <stinson@lindenlab.com> | 2012-05-17 20:02:53 -0700 |
| commit | 9845ad1728384629d0bafbf74e76c823ffd565bb (patch) | |
| tree | b8ad990716f60a14866ec12eed76ef5580540dd6 /indra/newview/llagent.cpp | |
| parent | ffdd6812ca7ee0d497766aff04c91b30d1bbc63d (diff) | |
EXP-1940: BUGFIX Correcting issue with changing maturity setting and teleporting from dialog did not work on agni. Problem stemmed from 2 issues. 1) The server responded with different results between aditi and agni due to some changes in the Pathfinding project. 2) The viewer was actually sending two separate requests to change to the same preference setting. This fixes both issues.
Diffstat (limited to 'indra/newview/llagent.cpp')
| -rwxr-xr-x | indra/newview/llagent.cpp | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 340629e404..b822af352c 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -339,6 +339,7 @@ LLAgent::LLAgent() : mTeleportFailedSlot(), mIsMaturityRatingChangingDuringTeleport(false), mMaturityRatingChange(0U), + mMaturityPreferenceConfirmCallback(NULL), mTeleportState( TELEPORT_NONE ), mRegionp(NULL), @@ -2520,7 +2521,39 @@ void LLMaturityPreferencesResponder::result(const LLSD &pContent) { if (!mMaturityPreferencesCallback.empty()) { - mMaturityPreferencesCallback(pContent); + U8 actualPreferenceValue = SIM_ACCESS_MIN; + llassert(!pContent.isUndefined()); + llassert(pContent.isMap()); + + if (!pContent.isUndefined() && pContent.isMap()) + { + if (pContent.has("access_prefs")) + { + llassert(pContent.has("access_prefs")); + llassert(pContent.get("access_prefs").isMap()); + llassert(pContent.get("access_prefs").has("max")); + llassert(pContent.get("access_prefs").get("max").isString()); + if (pContent.get("access_prefs").isMap() && pContent.get("access_prefs").has("max") && + pContent.get("access_prefs").get("max").isString()) + { + LLSD::String actualPreference = pContent.get("access_prefs").get("max").asString(); + LLStringUtil::trim(actualPreference); + actualPreferenceValue = LLViewerRegion::shortStringToAccess(actualPreference); + } + } + else if (pContent.has("max")) + { + llassert(pContent.get("max").isString()); + if (pContent.get("max").isString()) + { + LLSD::String actualPreference = pContent.get("max").asString(); + LLStringUtil::trim(actualPreference); + actualPreferenceValue = LLViewerRegion::shortStringToAccess(actualPreference); + } + } + } + + mMaturityPreferencesCallback(actualPreferenceValue); } } @@ -2528,12 +2561,24 @@ void LLMaturityPreferencesResponder::error(U32 pStatus, const std::string& pReas { if (!mMaturityPreferencesCallback.empty()) { - LLSD empty; - mMaturityPreferencesCallback(empty); + mMaturityPreferencesCallback(SIM_ACCESS_MIN); } } -bool LLAgent::sendMaturityPreferenceToServer(int preferredMaturity, maturity_preferences_callback_t pMaturityPreferencesCallback) +void LLAgent::setMaturityPreferenceAndConfirm(U32 preferredMaturity, maturity_preferences_callback_t pMaturityPreferencesCallback) +{ + llassert(mMaturityPreferenceConfirmCallback == NULL); + mMaturityPreferenceConfirmCallback = pMaturityPreferencesCallback; + + gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(preferredMaturity)); + // PreferredMaturity has a signal hook on change that will call LLAgent::sendMaturityPreferenceToServer + // sendMaturityPreferenceToServer will use mMaturityPreferenceConfirmCallback in the LLHTTPResponder + // This allows for confirmation that the server has officially received the maturity preference change + + mMaturityPreferenceConfirmCallback = NULL; +} + +bool LLAgent::sendMaturityPreferenceToServer(int preferredMaturity) { if (!getRegion()) return false; @@ -2561,7 +2606,7 @@ bool LLAgent::sendMaturityPreferenceToServer(int preferredMaturity, maturity_pre body["access_prefs"] = access_prefs; llinfos << "Sending access prefs update to " << (access_prefs["max"].asString()) << " via capability to: " << url << llendl; - LLHTTPClient::ResponderPtr responderPtr = LLHTTPClient::ResponderPtr(new LLMaturityPreferencesResponder(pMaturityPreferencesCallback)); + LLHTTPClient::ResponderPtr responderPtr = LLHTTPClient::ResponderPtr(new LLMaturityPreferencesResponder(mMaturityPreferenceConfirmCallback)); LLHTTPClient::post(url, body, responderPtr); return true; } |
