summaryrefslogtreecommitdiff
path: root/indra/newview/llnotificationstorage.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2024-05-15 16:35:49 +0300
committerGitHub <noreply@github.com>2024-05-15 16:35:49 +0300
commite49dcb8d0c9f539997effb640e350d9d0689aae6 (patch)
tree1bf99eaccce6de17c62f13c6595f7f497548dc5c /indra/newview/llnotificationstorage.cpp
parent531cd34f670170ade57f8813fe48012b61a1d3c2 (diff)
parent5f8a7374b9f18e0112d6749a9c845bd077a81acb (diff)
Merge pull request #1476 from secondlife/marchcat/x-b-merge
Maint X -> Maint B merge
Diffstat (limited to 'indra/newview/llnotificationstorage.cpp')
-rw-r--r--indra/newview/llnotificationstorage.cpp110
1 files changed, 55 insertions, 55 deletions
diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp
index 35fdfa88bb..75bafb8785 100644
--- a/indra/newview/llnotificationstorage.cpp
+++ b/indra/newview/llnotificationstorage.cpp
@@ -5,21 +5,21 @@
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
-*
+*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
-*
+*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
-*
+*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*
+*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -39,7 +39,7 @@
#include "llsdserialize.h"
#include "llsingleton.h"
#include "llregistry.h"
-#include "llviewermessage.h"
+#include "llviewermessage.h"
typedef boost::function<LLNotificationResponderInterface * (const LLSD& pParams)> responder_constructor_t;
@@ -67,7 +67,7 @@ LLNotificationResponderInterface * LLResponderRegistry::createResponder(const st
{
return (*factoryFunc)(pParams);
}
-
+
return NULL;
}
@@ -77,7 +77,7 @@ LLResponderRegistry::StaticRegistrar sRegisterOfferInfo("offer_info", &LLRespond
LLNotificationStorage::LLNotificationStorage(std::string pFileName)
- : mFileName(pFileName)
+ : mFileName(pFileName)
{
}
@@ -88,71 +88,71 @@ LLNotificationStorage::~LLNotificationStorage()
bool LLNotificationStorage::writeNotifications(const LLSD& pNotificationData) const
{
- llofstream notifyFile(mFileName.c_str());
- bool didFileOpen = notifyFile.is_open();
+ llofstream notifyFile(mFileName.c_str());
+ bool didFileOpen = notifyFile.is_open();
- if (!didFileOpen)
- {
- LL_WARNS("LLNotificationStorage") << "Failed to open file '" << mFileName << "'" << LL_ENDL;
- }
- else
- {
- LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
- formatter->format(pNotificationData, notifyFile, LLSDFormatter::OPTIONS_PRETTY);
- }
+ if (!didFileOpen)
+ {
+ LL_WARNS("LLNotificationStorage") << "Failed to open file '" << mFileName << "'" << LL_ENDL;
+ }
+ else
+ {
+ LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
+ formatter->format(pNotificationData, notifyFile, LLSDFormatter::OPTIONS_PRETTY);
+ }
- return didFileOpen;
+ return didFileOpen;
}
bool LLNotificationStorage::readNotifications(LLSD& pNotificationData, bool is_new_filename) const
{
- std::string filename = is_new_filename? mFileName : mOldFileName;
+ std::string filename = is_new_filename? mFileName : mOldFileName;
- LL_INFOS("LLNotificationStorage") << "starting read '" << filename << "'" << LL_ENDL;
+ LL_INFOS("LLNotificationStorage") << "starting read '" << filename << "'" << LL_ENDL;
- bool didFileRead;
+ bool didFileRead;
- pNotificationData.clear();
+ pNotificationData.clear();
- llifstream notifyFile(filename.c_str());
- didFileRead = notifyFile.is_open();
- if (!didFileRead)
- {
- LL_WARNS("LLNotificationStorage") << "Failed to open file '" << filename << "'" << LL_ENDL;
- }
- else
- {
- LLPointer<LLSDParser> parser = new LLSDXMLParser();
- didFileRead = (parser->parse(notifyFile, pNotificationData, LLSDSerialize::SIZE_UNLIMITED) >= 0);
+ llifstream notifyFile(filename.c_str());
+ didFileRead = notifyFile.is_open();
+ if (!didFileRead)
+ {
+ LL_WARNS("LLNotificationStorage") << "Failed to open file '" << filename << "'" << LL_ENDL;
+ }
+ else
+ {
+ LLPointer<LLSDParser> parser = new LLSDXMLParser();
+ didFileRead = (parser->parse(notifyFile, pNotificationData, LLSDSerialize::SIZE_UNLIMITED) >= 0);
notifyFile.close();
- if (!didFileRead)
- {
- LL_WARNS("LLNotificationStorage") << "Failed to parse open notifications from file '" << mFileName
+ if (!didFileRead)
+ {
+ LL_WARNS("LLNotificationStorage") << "Failed to parse open notifications from file '" << mFileName
<< "'" << LL_ENDL;
LLFile::remove(filename);
- LL_WARNS("LLNotificationStorage") << "Removed invalid open notifications file '" << mFileName
+ LL_WARNS("LLNotificationStorage") << "Removed invalid open notifications file '" << mFileName
<< "'" << LL_ENDL;
- }
- }
-
- if (!didFileRead)
- {
- if(is_new_filename)
- {
- didFileRead = readNotifications(pNotificationData, false);
- if(didFileRead)
- {
- writeNotifications(pNotificationData);
- LLFile::remove(mOldFileName);
- }
- }
- }
-
- return didFileRead;
+ }
+ }
+
+ if (!didFileRead)
+ {
+ if(is_new_filename)
+ {
+ didFileRead = readNotifications(pNotificationData, false);
+ if(didFileRead)
+ {
+ writeNotifications(pNotificationData);
+ LLFile::remove(mOldFileName);
+ }
+ }
+ }
+
+ return didFileRead;
}
LLNotificationResponderInterface * LLNotificationStorage::createResponder(const std::string& pNotificationName, const LLSD& pParams) const
{
- return LLResponderRegistry::getInstance()->createResponder(pNotificationName, pParams);
+ return LLResponderRegistry::getInstance()->createResponder(pNotificationName, pParams);
}