diff options
-rw-r--r-- | doc/contributions.txt | 1 | ||||
-rw-r--r-- | indra/newview/app_settings/settings_per_account.xml | 2 | ||||
-rw-r--r-- | indra/newview/lllogchat.cpp | 67 | ||||
-rw-r--r-- | indra/newview/lllogchat.h | 1 |
4 files changed, 34 insertions, 37 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt index 18501220ac..7343abd700 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -755,6 +755,7 @@ WolfPup Lowenhar SNOW-772 STORM-102 STORM-103 + STORM-143 VWR-20741 VWR-20933 Zai Lynch 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, |