summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rwxr-xr-xindra/newview/llviewermessage.cpp76
1 files changed, 69 insertions, 7 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 74cd635a75..4a0de81eb1 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5448,8 +5448,71 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
}
else if (gAgent.prefersPG())
{
- if ((LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0) &&
- gAgent.hasRestartableFailedTeleportRequest())
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
+ returnValue = true;
+ }
+ }
+ else if (regionAccess == SIM_ACCESS_ADULT)
+ {
+ if (!gAgent.isAdult())
+ {
+ gAgent.clearTeleportRequest();
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
+ returnValue = true;
+
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG() || gAgent.prefersMature())
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
+ returnValue = true;
+ }
+ }
+
+ if ((maturityLevelNotification == NULL) || maturityLevelNotification->isIgnored())
+ {
+ // Given a simple notification if no maturityLevelNotification is set or it is ignore
+ LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock);
+ }
+
+ return returnValue;
+}
+
+// some of the server notifications need special handling. This is where we do that.
+bool handle_teleport_access_blocked(LLSD& llsdBlock)
+{
+ std::string notificationID("TeleportEntryAccessBlocked");
+ U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
+ std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
+ LLStringUtil::toLower(regionMaturity);
+ llsdBlock["REGIONMATURITY"] = regionMaturity;
+
+ bool returnValue = false;
+ LLNotificationPtr maturityLevelNotification;
+ std::string notifySuffix = "_Notify";
+ if (regionAccess == SIM_ACCESS_MATURE)
+ {
+ if (gAgent.isTeen())
+ {
+ gAgent.clearTeleportRequest();
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
+ returnValue = true;
+
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG())
+ {
+ if (gAgent.hasRestartableFailedTeleportRequest())
{
maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
returnValue = true;
@@ -5461,7 +5524,7 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
returnValue = true;
}
}
- else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+ else
{
gAgent.clearTeleportRequest();
maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
@@ -5480,8 +5543,7 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
}
else if (gAgent.prefersPG() || gAgent.prefersMature())
{
- if ((LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0) &&
- gAgent.hasRestartableFailedTeleportRequest())
+ if (gAgent.hasRestartableFailedTeleportRequest())
{
maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
returnValue = true;
@@ -5493,7 +5555,7 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
returnValue = true;
}
}
- else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+ else
{
gAgent.clearTeleportRequest();
maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
@@ -6275,7 +6337,7 @@ void process_teleport_failed(LLMessageSystem *msg, void**)
else
{
// change notification name in this special case
- if (handle_special_notification("RegionEntryAccessBlocked", llsd_block))
+ if (handle_teleport_access_blocked(llsd_block))
{
if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
{