From ceb15e6edeed5d0e1fb7eaab9bc5b1592a252303 Mon Sep 17 00:00:00 2001
From: Jonathan Yap <none@none>
Date: Tue, 5 Nov 2013 15:45:48 -0500
Subject: [PATCH] STORM-1980/1983 Add time to region restarting message

---
 indra/newview/llviewermessage.cpp             | 48 +++++++++----------
 .../skins/default/xui/en/notifications.xml    |  4 +-
 .../newview/skins/default/xui/en/strings.xml  |  3 ++
 3 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index ebc6ff81652..bcd535bb900 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5748,7 +5748,6 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
 	std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
 	LLStringUtil::toLower(regionMaturity);
 	llsdBlock["REGIONMATURITY"] = regionMaturity;
-	
 	bool returnValue = false;
 	LLNotificationPtr maturityLevelNotification;
 	std::string notifySuffix = "_Notify";
@@ -5918,6 +5917,7 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
 			(notificationID == "RegionEntryAccessBlocked") ||
 			(notificationID == "LandClaimAccessBlocked") ||
 			(notificationID == "LandBuyAccessBlocked")
+
 		   )
 		{
 			/*---------------------------------------------------------------------
@@ -5959,7 +5959,23 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
 			snap_filename += SCREEN_HOME_FILENAME;
 			gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE);
 		}
-		
+
+	if (notificationID == "RegionRestartMinutes" ||
+		notificationID == "RegionRestartSeconds")
+	{
+		// Get current UTC time, adjusted for the user's clock
+		// being off.
+		time_t utc_time;
+		utc_time = time_corrected();
+		std::string timeStr = LLTrans::getString("ViewerMessageTime");
+		LLSD substitution;
+		substitution["datetime"] = (S32) utc_time;
+		LLStringUtil::format(timeStr, substitution);
+		llsdBlock["TIME"] = timeStr;
+
+		send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f);
+	}
+
 		LLNotificationsUtil::add(notificationID, llsdBlock);
 		return true;
 	}	
@@ -6019,7 +6035,6 @@ void process_alert_message(LLMessageSystem *msgsystem, void **user_data)
 		
 	std::string message;
 	msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, message);
-
 	process_special_alert_messages(message);
 
 	if (!attempt_standard_notification(msgsystem))
@@ -6043,7 +6058,6 @@ bool handle_not_age_verified_alert(const std::string &pAlertName)
 bool handle_special_alerts(const std::string &pAlertName)
 {
 	bool isHandled = false;
-
 	if (LLStringUtil::compareStrings(pAlertName, "NotAgeVerified") == 0)
 	{
 		
@@ -6079,28 +6093,10 @@ void process_alert_core(const std::string& message, BOOL modal)
 		// System message is important, show in upper-right box not tip
 		std::string text(message.substr(1));
 		LLSD args;
-		if (text.substr(0,17) == "RESTART_X_MINUTES")
-		{
-			S32 mins = 0;
-			LLStringUtil::convertToS32(text.substr(18), mins);
-			args["MINUTES"] = llformat("%d",mins);
-			LLNotificationsUtil::add("RegionRestartMinutes", args);
-			send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f);
-		}
-		else if (text.substr(0,17) == "RESTART_X_SECONDS")
-		{
-			S32 secs = 0;
-			LLStringUtil::convertToS32(text.substr(18), secs);
-			args["SECONDS"] = llformat("%d",secs);
-			LLNotificationsUtil::add("RegionRestartSeconds", args);
-			send_sound_trigger(LLUUID(gSavedSettings.getString("UISndAlert")), 1.0f);
-		}
-		else
-		{
-			std::string new_msg =LLNotifications::instance().getGlobalString(text);
-			args["MESSAGE"] = new_msg;
-			LLNotificationsUtil::add("SystemMessage", args);
-		}
+
+		std::string new_msg =LLNotifications::instance().getGlobalString(text);
+		args["MESSAGE"] = new_msg;
+		LLNotificationsUtil::add("SystemMessage", args);
 	}
 	else if (modal)
 	{
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index e7c89db0690..a0a5a0395a8 100755
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -6887,7 +6887,7 @@ This will add a bookmark in your inventory so you can quickly IM this Resident.
    priority="high"
    sound="UISndAlert"
    type="notify">
-This region will restart in [MINUTES] minutes.
+[TIME] This region will restart in [MINUTES] minutes.
 If you stay in this region you will be logged out.
   </notification>
 
@@ -6897,7 +6897,7 @@ If you stay in this region you will be logged out.
    priority="high"
    sound="UISndAlert"
    type="notify">
-This region will restart in [SECONDS] seconds.
+[TIME] This region will restart in [SECONDS] seconds.
 If you stay in this region you will be logged out.
   </notification>
 
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 8ac95beddb3..3fc1609cd48 100755
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2551,6 +2551,9 @@ Drag folders to this area and click "Send to Marketplace" to list them for sale
   <!-- panel preferences general -->
   <string name="DoNotDisturbModeResponseDefault">This resident has turned on &apos;Do Not Disturb&apos; and will see your message later.</string>
 
+	<!-- viewermessage -->
+	<string name="ViewerMessageTime">[hour12, datetime, slt]:[min, datetime, slt] [ampm, datetime, slt] [timezone,datetime, slt]</string>
+
 	<!-- Mute -->
 	<string name="MuteByName">(By name)</string>
 	<string name="MuteAgent">(Resident)</string>
-- 
GitLab