diff options
| author | simon <none@none> | 2013-08-26 15:45:09 -0700 |
|---|---|---|
| committer | simon <none@none> | 2013-08-26 15:45:09 -0700 |
| commit | 90d1c5b3676fe4e8ea8668b41fdf92613d5f102d (patch) | |
| tree | 8d5afd9678fd44444bcc7b5d311b5cfb7abe5217 /indra/newview/llpersistentnotificationstorage.cpp | |
| parent | ac2dc34ed0abbac8d5a8eb7f887037fe387c6a7a (diff) | |
| parent | 27d637d0f14fdfff496256222dc1343d2d7ee9ae (diff) | |
Merge downstream code for CHUIStorm
Diffstat (limited to 'indra/newview/llpersistentnotificationstorage.cpp')
| -rwxr-xr-x | indra/newview/llpersistentnotificationstorage.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/indra/newview/llpersistentnotificationstorage.cpp b/indra/newview/llpersistentnotificationstorage.cpp index c5104d54f2..d8fc2bee32 100755 --- a/indra/newview/llpersistentnotificationstorage.cpp +++ b/indra/newview/llpersistentnotificationstorage.cpp @@ -38,7 +38,8 @@ LLPersistentNotificationStorage::LLPersistentNotificationStorage() : LLSingleton<LLPersistentNotificationStorage>() - , LLNotificationStorage(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml")) + , LLNotificationStorage("") + , mLoaded(false) { } @@ -97,6 +98,13 @@ void LLPersistentNotificationStorage::loadNotifications() LL_INFOS("LLPersistentNotificationStorage") << "start loading notifications" << LL_ENDL; + if (mLoaded) + { + LL_INFOS("LLPersistentNotificationStorage") << "notifications already loaded, exiting" << LL_ENDL; + return; + } + + mLoaded = true; LLSD input; if (!readNotifications(input) ||input.isUndefined()) { @@ -148,8 +156,20 @@ void LLPersistentNotificationStorage::loadNotifications() LL_INFOS("LLPersistentNotificationStorage") << "finished loading notifications" << LL_ENDL; } +void LLPersistentNotificationStorage::initialize() +{ + setFileName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "open_notifications.xml")); + LLNotifications::instance().getChannel("Persistent")-> + connectChanged(boost::bind(&LLPersistentNotificationStorage::onPersistentChannelChanged, this, _1)); +} + bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& payload) { + // In case we received channel changed signal but haven't yet loaded notifications, do it + if (!mLoaded) + { + loadNotifications(); + } // we ignore "load" messages, but rewrite the persistence file on any other const std::string sigtype = payload["sigtype"].asString(); if ("load" != sigtype) |
