Commits

Stinson Linden committed 75bfe88

EXP-1950: Breaking out the dialogs into 2 paths so that teleports can report messages with slightly different wordings.

Comments (0)

Files changed (2)

indra/newview/llviewermessage.cpp

 		}
 		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;
 				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);
 		}
 		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;
 				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);
 			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 )
 					{

indra/newview/skins/default/xui/en/notifications.xml

      name="okcancelignore"
      yestext="Go to Knowledge Base"
 	 notext="Close"
-	 ignoretext="The region you&apos;re trying to visit contains content, which is accessible to adults only."/>
+	 ignoretext="Region crossing: The region you&apos;re trying to visit contains content, which is accessible to adults only."/>
   </notification>
 
   <notification
 
   <notification
    icon="alertmodal.tga"
-   name="RegionEntryAccessBlocked_ChangeAndReTeleport"
-   type="alertmodal">
-   <tag>fail</tag>
-    <tag>confirm</tag>
-The region you're trying to visit contains [REGIONMATURITY] content, but your current preferences are set to exclude [REGIONMATURITY] content. We can change your preferences and continue with the teleport, or you can cancel this teleport.
-	 <form name="form">
-      <button
-       index="0"
-       name="OK"
-       text="Change and continue"/>
-      <button
-       default="true"
-       index="1"
-       name="Cancel"
-       text="Cancel"/>
-       <ignore name="ignore" text="The region you&apos;re trying to visit contains content excluded by your preferences.  We can change your preferences and continue with the teleport."/>
-    </form>
-  </notification>
-
-  <notification
-   icon="alertmodal.tga"
    name="RegionEntryAccessBlocked_Change"
    type="alertmodal">
     <tag>fail</tag>
     <tag>confirm</tag>
-The region you're trying to visit contains [REGIONMATURITY] content, but your current preferences are set to exclude [REGIONMATURITY] content. We can change your preferences, or you can cancel the teleport. After your preferences are changed, you will need to attempt the teleport again.
+The region you're trying to visit contains [REGIONMATURITY] content, but your current preferences are set to exclude [REGIONMATURITY] content. We can change your preferences, or you can cancel. After your preferences are changed, you may attempt enter the region again.
     <form name="form">
       <button
        index="0"
        index="1"
        name="Cancel"
        text="Cancel"/>
-      <ignore name="ignore" text="The region you&apos;re trying to visit contains content excluded by your preferences.  We can change your preferences.  Then, you will need to attempt the teleport again."/>
+      <ignore name="ignore" text="Region crossing: The region you&apos;re trying to visit contains content excluded by your preferences."/>
     </form>
   </notification>
 
 
   <notification
    icon="alertmodal.tga"
+   name="TeleportEntryAccessBlocked"
+   type="alertmodal">
+    <tag>fail</tag>
+    The region you're trying to visit contains content exceeding your current preferences.  You can change your preferences using Me &gt; Preferences &gt; General.
+    <usetemplate
+     name="okbutton"
+     yestext="OK"/>
+  </notification>
+
+  <notification
+   icon="alertmodal.tga"
+   name="TeleportEntryAccessBlocked_AdultsOnlyContent"
+   type="alertmodal">
+    <tag>fail</tag>
+    <tag>confirm</tag>
+    The region you're trying to visit contains [REGIONMATURITY] content, which is accessible to adults only.
+    <url option="0" name="url">
+      http://wiki.secondlife.com/wiki/Linden_Lab_Official:Maturity_ratings:_an_overview
+    </url>
+    <usetemplate
+     name="okcancelignore"
+     yestext="Go to Knowledge Base"
+	 notext="Close"
+	 ignoretext="Teleport: The region you&apos;re trying to visit contains content, which is accessible to adults only."/>
+  </notification>
+
+  <notification
+   icon="notifytip.tga"
+   name="TeleportEntryAccessBlocked_Notify"
+   type="notifytip">
+    <tag>fail</tag>
+    The region you're trying to visit contains [REGIONMATURITY] content, but your current preferences are set to exclude [REGIONMATURITY] content.
+  </notification>
+
+  <notification
+   icon="notifytip.tga"
+   name="RegionEntryAccessBlocked_NotifyAdultsOnly"
+   type="notifytip">
+    <tag>fail</tag>
+    The region you're trying to visit contains content, which is accessible to adults only.
+  </notification>
+
+  <notification
+   icon="alertmodal.tga"
+   name="TeleportEntryAccessBlocked_ChangeAndReTeleport"
+   type="alertmodal">
+    <tag>fail</tag>
+    <tag>confirm</tag>
+    The region you're trying to visit contains [REGIONMATURITY] content, but your current preferences are set to exclude [REGIONMATURITY] content. We can change your preferences and continue with the teleport, or you can cancel this teleport.
+    <form name="form">
+      <button
+       index="0"
+       name="OK"
+       text="Change and continue"/>
+      <button
+       default="true"
+       index="1"
+       name="Cancel"
+       text="Cancel"/>
+      <ignore name="ignore" text="Teleport (restartable): The region you&apos;re trying to visit contains content excluded by your preferences."/>
+    </form>
+  </notification>
+
+  <notification
+   icon="alertmodal.tga"
+   name="TeleportEntryAccessBlocked_Change"
+   type="alertmodal">
+    <tag>fail</tag>
+    <tag>confirm</tag>
+    The region you're trying to visit contains [REGIONMATURITY] content, but your current preferences are set to exclude [REGIONMATURITY] content. We can change your preferences, or you can cancel the teleport. After your preferences are changed, you will need to attempt the teleport again.
+    <form name="form">
+      <button
+       index="0"
+       name="OK"
+       text="Change preferences"/>
+      <button
+       default="true"
+       index="1"
+       name="Cancel"
+       text="Cancel"/>
+      <ignore name="ignore" text="Teleport (non-restartable): The region you&apos;re trying to visit contains content excluded by your preferences."/>
+    </form>
+  </notification>
+
+  <notification
+   icon="alertmodal.tga"
+   name="TeleportEntryAccessBlocked_PreferencesOutOfSync"
+   type="alertmodal">
+    <tag>fail</tag>
+    We are having technical difficulties with your teleport because your preferences are out of sync with the server.
+    <usetemplate
+     name="okbutton"
+     yestext="OK"/>
+  </notification>
+
+  <notification
+   icon="alertmodal.tga"
    name="PreferredMaturityChanged"
    type="alertmodal">
 You won't receive any more notifications that you're about to visit a region with [RATING] content.  You may change your content preferences in the future by using Me &gt; Preferences &gt; General from the menu bar.