summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorWolfpup Lowenhar <wolfpup67@earthlink.net>2010-11-08 09:31:35 -0500
committerWolfpup Lowenhar <wolfpup67@earthlink.net>2010-11-08 09:31:35 -0500
commit669cf170ceae2609202fb948d388b7492f8eb90a (patch)
tree96a340fb8edd88f6f8e7114f66f2503ce777b227 /indra/newview
parent96112dfa2628569dea42bcf968eb7566d97e85f7 (diff)
STORM-102: STORM-143: Refactored the STORM-103 code to pull the proper plain test log no
matter when it was generated or if it has the date stamp in the name of the log or not. --HG-- branch : storm-102
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings_per_account.xml2
-rw-r--r--indra/newview/lllogchat.cpp67
-rw-r--r--indra/newview/lllogchat.h1
3 files changed, 33 insertions, 37 deletions
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index ab702e49e1..705c73cbf7 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -119,7 +119,7 @@
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
- <integer>1</integer>
+ <integer>0</integer>
</map>
<!-- Settings below are for back compatibility only.
They are not used in current viewer anymore. But they can't be removed to avoid
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 0e557cba5d..4f80472330 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -200,7 +200,7 @@ std::string LLLogChat::makeLogFileName(std::string filename)
filename = cleanFileName(filename);
filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS,filename);
filename += ".txt";
- LL_INFOS("") << "Current:" << filename << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
+ //LL_INFOS("") << "Current:" << filename << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
return filename;
}
@@ -370,22 +370,19 @@ void LLLogChat::loadAllHistory(const std::string& file_name, std::list<LLSD>& me
llwarns << "Session name is Empty!" << llendl;
return ;
}
-
+ LL_INFOS("") << "Loading:" << file_name << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
+ LL_INFOS("") << "Current:" << makeLogFileName(file_name) << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
LLFILE* fptr = LLFile::fopen(makeLogFileName(file_name), "r");/*Flawfinder: ignore*/
- // LL_INFOS("") << "Current:" << file_name << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
if (!fptr)
{
fptr = LLFile::fopen(oldLogFileName(file_name), "r");/*Flawfinder: ignore*/
- //LL_INFOS("") << "Old :" << file_name << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
if (!fptr)
{
- fptr =LLFile::fopen(ndsLogFileName(file_name), "r");/*Flawfinder:ignore*/
- //LL_INFOS("") << "Orginal:" << file_name << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
- if (!fptr) return; //No previous conversation with this name.
+ if (!fptr) return; //No previous conversation with this name.
}
}
- LL_INFOS("") << "Reading:" << file_name << LL_ENDL;
+ //LL_INFOS("") << "Reading:" << file_name << LL_ENDL;
char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/
char *bptr;
S32 len;
@@ -572,31 +569,31 @@ bool LLChatLogParser::parse(std::string& raw, LLSD& im)
im[IM_TEXT] = name_and_text[IDX_TEXT];
return true; //parsed name and message text, maybe have a timestamp too
}
-std::string LLLogChat::oldLogFileName(std::string filename)
-{
- time_t now;
- time_t yesterday = time(&now) - 86400;
- char dbuffer[20]; /* Flawfinder: ignore */
- if (filename == "chat")
- {
- strftime(dbuffer, 20, "-%Y-%m-%d", localtime(&yesterday));
- }
- else
- {
- strftime(dbuffer, 20, "-%Y-%m", localtime(&yesterday));
- }
- filename += dbuffer;
- filename = cleanFileName(filename);
- filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS,filename);
- filename += ".txt";
- //LL_INFOS("") << "Old :" << filename << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
- return filename;
-}
-std::string LLLogChat::ndsLogFileName(std::string filename)
-{
- filename = cleanFileName(filename);
- filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS,filename);
- filename += ".txt";
- //LL_INFOS("") << "Original:" << filename << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
- return filename;
+std::string LLLogChat::oldLogFileName(std::string filename)
+{
+ std::string scanResult;
+ std::string directory = gDirUtilp->getPerAccountChatLogsDir();/* get Users log directory */
+ directory += gDirUtilp->getDirDelimiter();/* add final OS dependent delimiter */
+ std::string pattern = (cleanFileName(filename)+(( filename == "chat" ) ? "-???\?-?\?-??.txt" : "-???\?-??.txt"));/* create search pattern*/
+ LL_INFOS("") << "Checking:" << directory << " for " << pattern << LL_ENDL;/* uncomment if you want to verify step, delete on commit */
+ std::vector<std::string> allfiles;
+
+ while (gDirUtilp->getNextFileInDir(directory, pattern, scanResult))
+ {
+ //LL_INFOS("") << "Found :" << scanResult << LL_ENDL;
+ allfiles.push_back(scanResult);
+ }
+
+ if (allfiles.size() == 0) // if no result from date search, return generic filename
+ {
+ scanResult = directory + filename + ".txt";
+ }
+ else
+ {
+ std::sort(allfiles.begin(), allfiles.end());
+ scanResult = directory + allfiles.back();
+ // thisfile is now the most recent version of the file.
+ }
+ LL_INFOS("") << "Reading:" << scanResult << LL_ENDL;
+ return scanResult;
}
diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h
index 578fe37227..27752452c9 100644
--- a/indra/newview/lllogchat.h
+++ b/indra/newview/lllogchat.h
@@ -45,7 +45,6 @@ public:
*Add functions to get old and non date stamped file names when needed
*/
static std::string oldLogFileName(std::string(filename));
- static std::string ndsLogFileName(std::string(filename));
static void saveHistory(const std::string& filename,
const std::string& from,
const LLUUID& from_id,