[STORM-1980] Part 1: Notifications with timestamp and sound

This commit is contained in:
Inusaito Sayori
2014-04-23 10:58:14 -04:00
parent 3db489f4df
commit 7262bf96b8
3 changed files with 33 additions and 6 deletions

View File

@@ -2233,6 +2233,17 @@ This should be as low as possible, but too low may break functionality</string>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>UISndRestart</key>
<map>
<key>Comment</key>
<string>Sound file for region restarting (uuid for sound asset)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>1e506d0c-4811-bdf3-5ec7-d624284c9040</string>
</map>
<key>UISndSnapshot</key>
<map>
<key>Comment</key>

View File

@@ -6434,7 +6434,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";
@@ -6583,6 +6582,17 @@ void home_position_set()
gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE);
}
void add_time_arg(LLSD& args)
{
static const LLCachedControl<bool> show_local_time("LiruLocalTime");
// Get current UTC time, adjusted for the user's clock
// being off.
time_t utc_time = show_local_time ? time(NULL) : time_corrected();
std::string timeStr;
timeStructToFormattedString(show_local_time ? std::localtime(&utc_time) : utc_to_pacific_time(utc_time, gPacificDaylightTime), gSavedSettings.getString("ShortTimeFormat"), timeStr);
args["TIME"] = timeStr;
}
bool attempt_standard_notification(LLMessageSystem* msgsystem)
{
// if we have additional alert data
@@ -6654,6 +6664,11 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
{
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_KILLED_COUNT);
}
else if (notificationID == "RegionRestartMinutes" || notificationID == "RegionRestartSeconds")
{
add_time_arg(llsdBlock);
send_sound_trigger(LLUUID(gSavedSettings.getString("UISndRestart")), 1.0f);
}
LLNotificationsUtil::add(notificationID, llsdBlock);
return true;
@@ -6712,7 +6727,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)
{
@@ -6763,14 +6777,18 @@ void process_alert_core(const std::string& message, BOOL modal)
S32 mins = 0;
LLStringUtil::convertToS32(text.substr(18), mins);
args["MINUTES"] = llformat("%d",mins);
add_time_arg(args);
LLNotificationsUtil::add("RegionRestartMinutes", args);
send_sound_trigger(LLUUID(gSavedSettings.getString("UISndRestart")), 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);
add_time_arg(args);
LLNotificationsUtil::add("RegionRestartSeconds", args);
send_sound_trigger(LLUUID(gSavedSettings.getString("UISndRestart")), 1.0f);
}
else
{

View File

@@ -6943,9 +6943,8 @@ This will add a bookmark in your inventory so you can quickly IM this resident.
icon="notify.tga"
name="RegionRestartMinutes"
priority="high"
sound="UISndAlert"
type="notify">
Region is restarting in [MINUTES] minutes.
[TIME] This region will restart in [MINUTES] minutes.
If you remain in this region you will be logged out.
</notification>
@@ -6953,9 +6952,8 @@ If you remain in this region you will be logged out.
icon="notify.tga"
name="RegionRestartSeconds"
priority="high"
sound="UISndAlert"
type="notify">
Region is restarting in [SECONDS] seconds.
[TIME] This region will restart in [SECONDS] seconds.
If you remain in this region you will be logged out.
</notification>