summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorTodd Stinson <stinson@lindenlab.com>2012-05-17 20:02:53 -0700
committerTodd Stinson <stinson@lindenlab.com>2012-05-17 20:02:53 -0700
commit9845ad1728384629d0bafbf74e76c823ffd565bb (patch)
treeb8ad990716f60a14866ec12eed76ef5580540dd6 /indra
parentffdd6812ca7ee0d497766aff04c91b30d1bbc63d (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')
-rwxr-xr-xindra/newview/llagent.cpp55
-rw-r--r--indra/newview/llagent.h8
-rwxr-xr-xindra/newview/llviewermessage.cpp37
3 files changed, 65 insertions, 35 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;
}
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 6c1f4a76a1..18975911de 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -694,9 +694,13 @@ public:
void setMaturity(char text);
static int convertTextToMaturity(char text);
- typedef boost::function<void (const LLSD &pResponse)> maturity_preferences_callback_t;
- bool sendMaturityPreferenceToServer(int preferredMaturity, maturity_preferences_callback_t pMaturityPreferencesCallback = NULL); // ! "U8" instead of "int"?
+ typedef boost::function<void (U8)> maturity_preferences_callback_t;
+ void setMaturityPreferenceAndConfirm(U32 preferredMaturity, maturity_preferences_callback_t pMaturityPreferencesCallback);
+private:
+ maturity_preferences_callback_t mMaturityPreferenceConfirmCallback;
+ bool sendMaturityPreferenceToServer(int preferredMaturity); // ! "U8" instead of "int"?
+public:
// Maturity callbacks for PreferredMaturity control variable
void handleMaturity(const LLSD& newvalue);
bool validateMaturity(const LLSD& newvalue);
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index bb48391fe0..3c2949d9ee 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5387,31 +5387,14 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
}
}
-void handle_maturity_preference_change_and_reteleport(const LLSD &pResponse, U8 pMaturityRatingChange)
+void handle_maturity_preference_change_and_reteleport(U8 pActualMaturityRating, U8 pRequestedMaturityRating)
{
bool isMaturityPreferenceElevated = false;
- U8 actualPrefValue = SIM_ACCESS_MIN;
- llassert(!pResponse.isUndefined());
- llassert(pResponse.isMap());
- llassert(pResponse.has("access_prefs"));
- llassert(pResponse.get("access_prefs").isMap());
- llassert(pResponse.get("access_prefs").has("max"));
- llassert(pResponse.get("access_prefs").get("max").isString());
-
- if (!pResponse.isUndefined() && pResponse.isMap() && pResponse.has("access_prefs") &&
- pResponse.get("access_prefs").isMap() && pResponse.get("access_prefs").has("max") &&
- pResponse.get("access_prefs").get("max").isString())
- {
- LLSD::String actualPreference = pResponse.get("access_prefs").get("max").asString();
- LLStringUtil::trim(actualPreference);
- actualPrefValue = LLViewerRegion::shortStringToAccess(actualPreference);
- }
-
- switch (actualPrefValue)
+ switch (pActualMaturityRating)
{
case SIM_ACCESS_MIN :
- switch (pMaturityRatingChange)
+ switch (pRequestedMaturityRating)
{
case SIM_ACCESS_MIN :
isMaturityPreferenceElevated = true;
@@ -5425,7 +5408,7 @@ void handle_maturity_preference_change_and_reteleport(const LLSD &pResponse, U8
}
break;
case SIM_ACCESS_PG :
- switch (pMaturityRatingChange)
+ switch (pRequestedMaturityRating)
{
case SIM_ACCESS_MIN :
case SIM_ACCESS_PG :
@@ -5439,7 +5422,7 @@ void handle_maturity_preference_change_and_reteleport(const LLSD &pResponse, U8
}
break;
case SIM_ACCESS_MATURE :
- switch (pMaturityRatingChange)
+ switch (pRequestedMaturityRating)
{
case SIM_ACCESS_MIN :
case SIM_ACCESS_PG :
@@ -5453,7 +5436,7 @@ void handle_maturity_preference_change_and_reteleport(const LLSD &pResponse, U8
}
break;
case SIM_ACCESS_ADULT :
- switch (pMaturityRatingChange)
+ switch (pRequestedMaturityRating)
{
case SIM_ACCESS_MIN :
case SIM_ACCESS_PG :
@@ -5473,13 +5456,13 @@ void handle_maturity_preference_change_and_reteleport(const LLSD &pResponse, U8
if (isMaturityPreferenceElevated)
{
- gAgent.setMaturityRatingChangeDuringTeleport(pMaturityRatingChange);
+ gAgent.setMaturityRatingChangeDuringTeleport(pActualMaturityRating);
gAgent.restartFailedTeleportRequest();
}
else
{
LLSD args;
- args["RATING"] = LLViewerRegion::accessToString(pMaturityRatingChange);
+ args["RATING"] = LLViewerRegion::accessToString(pRequestedMaturityRating);
LLNotificationsUtil::add("MaturityCouldNotBeChanged", args);
gAgent.clearFailedTeleportRequest();
}
@@ -5494,7 +5477,6 @@ bool handle_prompt_for_maturity_level_change_callback(const LLSD& notification,
// set the preference to the maturity of the region we're calling
U8 preferredMaturity = static_cast<U8>(notification["payload"]["_region_access"].asInteger());
gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(preferredMaturity));
- gAgent.sendMaturityPreferenceToServer(preferredMaturity);
}
return false;
@@ -5508,8 +5490,7 @@ bool handle_prompt_for_maturity_level_change_and_reteleport_callback(const LLSD&
{
// set the preference to the maturity of the region we're calling
U8 preferredMaturity = static_cast<U8>(notification["payload"]["_region_access"].asInteger());
- gSavedSettings.setU32("PreferredMaturity", static_cast<U32>(preferredMaturity));
- gAgent.sendMaturityPreferenceToServer(preferredMaturity, boost::bind(&handle_maturity_preference_change_and_reteleport, _1, preferredMaturity));
+ gAgent.setMaturityPreferenceAndConfirm(static_cast<U32>(preferredMaturity), boost::bind(&handle_maturity_preference_change_and_reteleport, _1, preferredMaturity));
}
else
{