summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorTodd Stinson <stinson@lindenlab.com>2012-05-17 14:50:33 -0700
committerTodd Stinson <stinson@lindenlab.com>2012-05-17 14:50:33 -0700
commitecdc5cf7647c0cbbb057dba2f4bdeaafc3f5a93f (patch)
treea723c7090aeea092f4b80f430caead67ba22be4b /indra/newview
parent9d8bf7f401230386a723055d54dd9dbb2be7a037 (diff)
EXP-1928: Handling the rare case that the user preferences cannot be successfully changed, and reporting that to the user.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llagent.cpp4
-rw-r--r--indra/newview/llagent.h4
-rwxr-xr-xindra/newview/llviewermessage.cpp102
-rw-r--r--indra/newview/llviewerregion.cpp25
-rw-r--r--indra/newview/llviewerregion.h1
-rw-r--r--indra/newview/skins/default/xui/en/notifications.xml11
6 files changed, 135 insertions, 12 deletions
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 3b1e894ed3..5d5e585563 100755
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -325,7 +325,7 @@ LLAgent::LLAgent() :
mTeleportFinishedSlot(),
mTeleportFailedSlot(),
mIsMaturityRatingChangingDuringTeleport(false),
- mMaturityRatingChange(0),
+ mMaturityRatingChange(0U),
mTeleportState( TELEPORT_NONE ),
mRegionp(NULL),
@@ -3618,7 +3618,7 @@ void LLAgent::clearFailedTeleportRequest()
}
}
-void LLAgent::setMaturityRatingChangeDuringTeleport(int pMaturityRatingChange)
+void LLAgent::setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange)
{
mIsMaturityRatingChangingDuringTeleport = true;
mMaturityRatingChange = pMaturityRatingChange;
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 07ceaf11b1..cbfe8af90c 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -580,7 +580,7 @@ public:
inline bool hasFailedTeleportRequest() {return (mFailedTeleportRequest != NULL);};
void restartFailedTeleportRequest();
void clearFailedTeleportRequest();
- void setMaturityRatingChangeDuringTeleport(int pMaturityRatingChange);
+ void setMaturityRatingChangeDuringTeleport(U8 pMaturityRatingChange);
private:
friend class LLTeleportRequest;
@@ -595,7 +595,7 @@ private:
boost::signals2::connection mTeleportFailedSlot;
bool mIsMaturityRatingChangingDuringTeleport;
- int mMaturityRatingChange;
+ U8 mMaturityRatingChange;
void teleportRequest(const U64& region_handle,
const LLVector3& pos_local, // Go to a named location home
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index d88a6f1a9b..84de54986f 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -42,6 +42,7 @@
#include "llinventorydefines.h"
#include "lllslconstants.h"
#include "llregionhandle.h"
+#include "llsd.h"
#include "llsdserialize.h"
#include "llteleportflags.h"
#include "lltransactionflags.h"
@@ -107,6 +108,7 @@
#include "llagentui.h"
#include "llpanelblockedlist.h"
#include "llpanelplaceprofile.h"
+#include "llviewerregion.h"
#include <boost/algorithm/string/split.hpp> //
#include <boost/regex.hpp>
@@ -5385,18 +5387,102 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg)
}
}
-void handle_maturity_preference_change(const LLSD &pResponse, int pMaturityRatingChange)
+void handle_maturity_preference_change(const LLSD &pResponse, U8 pMaturityRatingChange)
{
- if (pResponse.isUndefined())
+ 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())
{
- // XXX stinson 05/15/2012 : should report some notification that the preference has not changed
- gAgent.clearFailedTeleportRequest();
+ LLSD::String actualPreference = pResponse.get("access_prefs").get("max").asString();
+ LLStringUtil::trim(actualPreference);
+ actualPrefValue = LLViewerRegion::shortStringToAccess(actualPreference);
}
- else
+
+ switch (actualPrefValue)
+ {
+ case SIM_ACCESS_MIN :
+ switch (pMaturityRatingChange)
+ {
+ case SIM_ACCESS_MIN :
+ isMaturityPreferenceElevated = true;
+ break;
+ case SIM_ACCESS_PG :
+ case SIM_ACCESS_MATURE :
+ case SIM_ACCESS_ADULT :
+ default :
+ isMaturityPreferenceElevated = false;
+ break;
+ }
+ break;
+ case SIM_ACCESS_PG :
+ switch (pMaturityRatingChange)
+ {
+ case SIM_ACCESS_MIN :
+ case SIM_ACCESS_PG :
+ isMaturityPreferenceElevated = true;
+ break;
+ case SIM_ACCESS_MATURE :
+ case SIM_ACCESS_ADULT :
+ default :
+ isMaturityPreferenceElevated = false;
+ break;
+ }
+ break;
+ case SIM_ACCESS_MATURE :
+ switch (pMaturityRatingChange)
+ {
+ case SIM_ACCESS_MIN :
+ case SIM_ACCESS_PG :
+ case SIM_ACCESS_MATURE :
+ isMaturityPreferenceElevated = true;
+ break;
+ case SIM_ACCESS_ADULT :
+ default :
+ isMaturityPreferenceElevated = false;
+ break;
+ }
+ break;
+ case SIM_ACCESS_ADULT :
+ switch (pMaturityRatingChange)
+ {
+ case SIM_ACCESS_MIN :
+ case SIM_ACCESS_PG :
+ case SIM_ACCESS_MATURE :
+ case SIM_ACCESS_ADULT :
+ isMaturityPreferenceElevated = true;
+ break;
+ default :
+ isMaturityPreferenceElevated = false;
+ break;
+ }
+ break;
+ default :
+ isMaturityPreferenceElevated = false;
+ break;
+ }
+
+ if (isMaturityPreferenceElevated)
{
gAgent.setMaturityRatingChangeDuringTeleport(pMaturityRatingChange);
gAgent.restartFailedTeleportRequest();
}
+ else
+ {
+ LLSD args;
+ args["RATING"] = LLViewerRegion::accessToString(pMaturityRatingChange);
+ LLNotificationsUtil::add("MaturityCouldNotBeChanged", args);
+ gAgent.clearFailedTeleportRequest();
+ }
}
bool handle_special_notification_callback(const LLSD& notification, const LLSD& response)
@@ -5406,8 +5492,8 @@ bool handle_special_notification_callback(const LLSD& notification, const LLSD&
if (0 == option)
{
// set the preference to the maturity of the region we're calling
- int preferredMaturity = notification["payload"]["_region_access"].asInteger();
- gSavedSettings.setU32("PreferredMaturity", preferredMaturity);
+ 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, _1, preferredMaturity));
}
else
@@ -5421,7 +5507,7 @@ bool handle_special_notification_callback(const LLSD& notification, const LLSD&
// some of the server notifications need special handling. This is where we do that.
bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
{
- int regionAccess = llsdBlock["_region_access"].asInteger();
+ U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
llsdBlock["REGIONMATURITY"] = LLViewerRegion::accessToString(regionAccess);
bool returnValue = false;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index e3cb985ddb..f3771e93d9 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -655,6 +655,31 @@ std::string LLViewerRegion::accessToShortString(U8 sim_access)
}
// static
+U8 LLViewerRegion::shortStringToAccess(const std::string &sim_access)
+{
+ U8 accessValue;
+
+ if (LLStringUtil::compareStrings(sim_access, "PG") == 0)
+ {
+ accessValue = SIM_ACCESS_PG;
+ }
+ else if (LLStringUtil::compareStrings(sim_access, "M") == 0)
+ {
+ accessValue = SIM_ACCESS_MATURE;
+ }
+ else if (LLStringUtil::compareStrings(sim_access, "A") == 0)
+ {
+ accessValue = SIM_ACCESS_ADULT;
+ }
+ else
+ {
+ accessValue = SIM_ACCESS_MIN;
+ }
+
+ return accessValue;
+}
+
+// static
void LLViewerRegion::processRegionInfo(LLMessageSystem* msg, void**)
{
// send it to 'observers'
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index c483c6ef52..7280c7f2e6 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -202,6 +202,7 @@ public:
// Returns "M", "PG", "A" etc.
static std::string accessToShortString(U8 sim_access);
+ static U8 shortStringToAccess(const std::string &sim_access);
// Return access icon name
static std::string getAccessIcon(U8 sim_access);
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 649d1982b1..c76c28579b 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4139,6 +4139,17 @@ You won't receive any more notifications that you're about to visit a region wit
<notification
icon="alertmodal.tga"
+ name="MaturityCouldNotBeChanged"
+ type="alertmodal">
+We were unable to change your preferences to view [RATING] content at this time. Please attempt to change your preferences by using Me &gt; Preferences &gt; General from the menu bar, and then retrying your teleport.
+ <tag>confirm</tag>
+ <usetemplate
+ name="okbutton"
+ yestext="OK"/>
+ </notification>
+
+ <notification
+ icon="alertmodal.tga"
name="LandClaimAccessBlocked"
type="alertmodal">
You cannot claim this land due to your maturity Rating. This may be a result of a lack of information validating your age.