diff options
author | Wolfpup Lowenhar <wolfpup67@earthlink.net> | 2010-11-11 22:50:14 -0500 |
---|---|---|
committer | Wolfpup Lowenhar <wolfpup67@earthlink.net> | 2010-11-11 22:50:14 -0500 |
commit | 4077e6bb52f73a3ccd7f560788fc2fda21d7d9e7 (patch) | |
tree | 1a9d25433161b3f27fc139da161da0182ea43553 | |
parent | 899f470deca2cbc775e87147852e0b118464896f (diff) |
STORM-102 : STORM-143 :Made needed changes to code to improve searching for previous logs
and also changed the name used for P2P IM log file names. The latter change is going to
temporarely break personal content for those that are saving conversation logs as P2P IM
logs will now be useinf the user name and not the legacy name.
-rw-r--r-- | indra/newview/llimview.cpp | 5 | ||||
-rw-r--r-- | indra/newview/lllogchat.cpp | 53 |
2 files changed, 30 insertions, 28 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 857c27be63..14a29b7e0f 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -537,7 +537,8 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline() void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) { - if (av_name.mLegacyFirstName.empty()) + mHistoryFileName = av_name.mUsername; + /*if (av_name.mLegacyFirstName.empty()) { // if mLegacyFirstName is empty it means display names is off and the // data came from the gCacheName, mDisplayName will be the legacy name @@ -546,7 +547,7 @@ void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LL else { mHistoryFileName = LLCacheName::cleanFullName(av_name.getLegacyName()); - } + }*/ } void LLIMModel::LLIMSession::buildHistoryFileName() diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 4f80472330..2fb5ba82ba 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -206,7 +206,7 @@ std::string LLLogChat::makeLogFileName(std::string filename) std::string LLLogChat::cleanFileName(std::string filename) { - std::string invalidChars = "\"\'\\/?*:<>|"; + std::string invalidChars = "\"\'\\/?*:.<>|"; std::string::size_type position = filename.find_first_of(invalidChars); while (position != filename.npos) { @@ -370,8 +370,8 @@ 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 */ + //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*/ if (!fptr) { @@ -569,31 +569,32 @@ 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)
-{
+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))
+ filename=cleanFileName(filename);/* lest make shure the file name has no invalad charecters befor making the pattern */ + std::string pattern = (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 { - //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;
+ 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;/* uncomment if you want to verify step, delete on commit */ + return scanResult; } |