summaryrefslogtreecommitdiff
path: root/indra/newview/llpersistentnotificationstorage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpersistentnotificationstorage.cpp')
-rwxr-xr-xindra/newview/llpersistentnotificationstorage.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/indra/newview/llpersistentnotificationstorage.cpp b/indra/newview/llpersistentnotificationstorage.cpp
index 076c3e0235..d8fc2bee32 100755
--- a/indra/newview/llpersistentnotificationstorage.cpp
+++ b/indra/newview/llpersistentnotificationstorage.cpp
@@ -77,6 +77,14 @@ void LLPersistentNotificationStorage::saveNotifications()
}
data.append(notification->asLLSD(true));
+ if (data.size() >= gSavedSettings.getS32("MaxPersistentNotifications"))
+ {
+ llwarns << "Too many persistent notifications."
+ << " Saved " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << history_channel->size()
+ << " persistent notifications." << llendl;
+ break;
+ }
+
}
writeNotifications(output);
@@ -97,7 +105,6 @@ void LLPersistentNotificationStorage::loadNotifications()
}
mLoaded = true;
-
LLSD input;
if (!readNotifications(input) ||input.isUndefined())
{
@@ -115,9 +122,9 @@ void LLPersistentNotificationStorage::loadNotifications()
findChannelByID(LLUUID(gSavedSettings.getString("NotificationChannelUUID"))));
LLNotifications& instance = LLNotifications::instance();
-
- for (LLSD::array_const_iterator notification_it = data.beginArray();
- notification_it != data.endArray();
+ S32 processed_notifications = 0;
+ for (LLSD::reverse_array_iterator notification_it = data.rbeginArray();
+ notification_it != data.rendArray();
++notification_it)
{
LLSD notification_params = *notification_it;
@@ -136,8 +143,16 @@ void LLPersistentNotificationStorage::loadNotifications()
// hide saved toasts so they don't confuse the user
notification_channel->hideToast(notification->getID());
}
+ ++processed_notifications;
+ if (processed_notifications >= gSavedSettings.getS32("MaxPersistentNotifications"))
+ {
+ llwarns << "Too many persistent notifications."
+ << " Processed " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << data.size() << " persistent notifications." << llendl;
+ break;
+ }
}
-
+ LLNotifications::instance().getChannel("Persistent")->
+ connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1));
LL_INFOS("LLPersistentNotificationStorage") << "finished loading notifications" << LL_ENDL;
}