summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2010-11-12 14:15:21 -0500
committerOz Linden <oz@lindenlab.com>2010-11-12 14:15:21 -0500
commit4839e79b20679560f697af96c11db4aef7e1d740 (patch)
treeea5faa6268fbe23de23ee03ee43d367181fba5c9 /indra/newview
parent5b86f60a13f28f5978ff3a53371cb3bae7f0d837 (diff)
parent2632565bbced3002eb9912270b1f7303c48a0b44 (diff)
merge STORM-102 to latest viewer-development prior to pull
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings_per_account.xml12
-rw-r--r--indra/newview/llappviewer.cpp4
-rw-r--r--indra/newview/llappviewerlinux.cpp3
-rw-r--r--indra/newview/llfloaterpreference.cpp2
-rw-r--r--indra/newview/llfloateruipreview.cpp12
-rw-r--r--indra/newview/llimview.cpp11
-rw-r--r--indra/newview/lllogchat.cpp64
-rw-r--r--indra/newview/lllogchat.h4
-rw-r--r--indra/newview/llviewermedia.cpp2
-rw-r--r--indra/newview/llwaterparammanager.cpp4
-rw-r--r--indra/newview/llwlparammanager.cpp4
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_privacy.xml15
12 files changed, 98 insertions, 39 deletions
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index dc76a4e518..705c73cbf7 100644
--- a/indra/newview/app_settings/settings_per_account.xml
+++ b/indra/newview/app_settings/settings_per_account.xml
@@ -110,7 +110,17 @@
<key>Value</key>
<string>00000000-0000-0000-0000-000000000000</string>
</map>
-
+ <key>LogFileNamewithDate</key>
+ <map>
+ <key>Comment</key>
+ <string>Add Date Stamp to chat and IM Logs with format chat-YYYY-MM-DD and 'IM file name'-YYYY-MM. To view old logs goto ..\Second Life\[login name]</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <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
influence on previous versions of the viewer in case of settings are not used or default value
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index bf0f948a6d..f66663891d 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3036,7 +3036,7 @@ void LLAppViewer::migrateCacheDirectory()
S32 file_count = 0;
std::string file_name;
std::string mask = delimiter + "*.*";
- while (gDirUtilp->getNextFileInDir(old_cache_dir, mask, file_name, false))
+ while (gDirUtilp->getNextFileInDir(old_cache_dir, mask, file_name))
{
if (file_name == "." || file_name == "..") continue;
std::string source_path = old_cache_dir + delimiter + file_name;
@@ -3255,7 +3255,7 @@ bool LLAppViewer::initCache()
dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,"");
std::string found_file;
- if (gDirUtilp->getNextFileInDir(dir, mask, found_file, false))
+ if (gDirUtilp->getNextFileInDir(dir, mask, found_file))
{
old_vfs_data_file = dir + gDirUtilp->getDirDelimiter() + found_file;
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index 7629265730..898cc1c0ba 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -504,8 +504,7 @@ std::string LLAppViewerLinux::generateSerialNumber()
// trawl /dev/disk/by-uuid looking for a good-looking UUID to grab
std::string this_name;
- BOOL wrap = FALSE;
- while (gDirUtilp->getNextFileInDir(uuiddir, "*", this_name, wrap))
+ while (gDirUtilp->getNextFileInDir(uuiddir, "*", this_name))
{
if (this_name.length() > best.length() ||
(this_name.length() == best.length() &&
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 5becd8f990..c105f023c7 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -1246,7 +1246,7 @@ void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im
getChildView("show_timestamps_check_im")->setEnabled(TRUE);
getChildView("log_path_string")->setEnabled(FALSE);// LineEditor becomes readonly in this case.
getChildView("log_path_button")->setEnabled(TRUE);
-
+ childEnable("logfile_name_datestamp");
std::string display_email(email);
getChild<LLUICtrl>("email_address")->setValue(display_email);
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index 5dc8067648..5687b88a1f 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -480,7 +480,7 @@ BOOL LLFloaterUIPreview::postBuild()
mLanguageSelection->removeall(); // clear out anything temporarily in list from XML
while(found) // for every directory
{
- if((found = gDirUtilp->getNextFileInDir(xui_dir, "*", language_directory, FALSE))) // get next directory
+ if((found = gDirUtilp->getNextFileInDir(xui_dir, "*", language_directory))) // get next directory
{
std::string full_path = xui_dir + language_directory;
if(LLFile::isfile(full_path.c_str())) // if it's not a directory, skip it
@@ -634,7 +634,7 @@ void LLFloaterUIPreview::refreshList()
BOOL found = TRUE;
while(found) // for every floater file that matches the pattern
{
- if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "floater_*.xml", name, FALSE))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "floater_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
@@ -642,7 +642,7 @@ void LLFloaterUIPreview::refreshList()
found = TRUE;
while(found) // for every inspector file that matches the pattern
{
- if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "inspect_*.xml", name, FALSE))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "inspect_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
@@ -650,7 +650,7 @@ void LLFloaterUIPreview::refreshList()
found = TRUE;
while(found) // for every menu file that matches the pattern
{
- if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "menu_*.xml", name, FALSE))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "menu_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
@@ -658,7 +658,7 @@ void LLFloaterUIPreview::refreshList()
found = TRUE;
while(found) // for every panel file that matches the pattern
{
- if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "panel_*.xml", name, FALSE))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "panel_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
@@ -667,7 +667,7 @@ void LLFloaterUIPreview::refreshList()
found = TRUE;
while(found) // for every sidepanel file that matches the pattern
{
- if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "sidepanel_*.xml", name, FALSE))) // get next file matching pattern
+ if((found = gDirUtilp->getNextFileInDir(getLocalizedDirectory(), "sidepanel_*.xml", name))) // get next file matching pattern
{
addFloaterEntry(name.c_str()); // and add it to the list (file name only; localization code takes care of rest of path)
}
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 857c27be63..cc48226052 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -537,16 +537,7 @@ bool LLIMModel::LLIMSession::isOtherParticipantAvaline()
void LLIMModel::LLIMSession::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name)
{
- 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
- mHistoryFileName = LLCacheName::cleanFullName(av_name.mDisplayName);
- }
- else
- {
- mHistoryFileName = LLCacheName::cleanFullName(av_name.getLegacyName());
- }
+ mHistoryFileName = av_name.mUsername;
}
void LLIMModel::LLIMSession::buildHistoryFileName()
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 8c70b1e973..2fb5ba82ba 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -182,15 +182,31 @@ private:
//static
std::string LLLogChat::makeLogFileName(std::string filename)
{
+ if( gSavedPerAccountSettings.getBOOL("LogFileNamewithDate") )
+ {
+ time_t now;
+ time(&now);
+ char dbuffer[20]; /* Flawfinder: ignore */
+ if (filename == "chat")
+ {
+ strftime(dbuffer, 20, "-%Y-%m-%d", localtime(&now));
+ }
+ else
+ {
+ strftime(dbuffer, 20, "-%Y-%m", localtime(&now));
+ }
+ filename += dbuffer;
+ }
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 */
return 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)
{
@@ -354,10 +370,19 @@ void LLLogChat::loadAllHistory(const std::string& file_name, std::list<LLSD>& me
llwarns << "Session name is Empty!" << llendl;
return ;
}
-
- LLFILE* fptr = LLFile::fopen(makeLogFileName(file_name), "r"); /*Flawfinder: ignore*/
- if (!fptr) return; //No previous conversation with this name.
-
+ //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)
+ {
+ fptr = LLFile::fopen(oldLogFileName(file_name), "r");/*Flawfinder: ignore*/
+ if (!fptr)
+ {
+ if (!fptr) return; //No previous conversation with this name.
+ }
+ }
+
+ //LL_INFOS("") << "Reading:" << file_name << LL_ENDL;
char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/
char *bptr;
S32 len;
@@ -544,3 +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 scanResult;
+ std::string directory = gDirUtilp->getPerAccountChatLogsDir();/* get Users log directory */
+ directory += gDirUtilp->getDirDelimiter();/* add final OS dependent delimiter */
+ 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
+ {
+ 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;
+}
diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h
index 6958d56311..27752452c9 100644
--- a/indra/newview/lllogchat.h
+++ b/indra/newview/lllogchat.h
@@ -41,6 +41,10 @@ public:
};
static std::string timestamp(bool withdate = false);
static std::string makeLogFileName(std::string(filename));
+ /**
+ *Add functions to get old and non date stamped file names when needed
+ */
+ static std::string oldLogFileName(std::string(filename));
static void saveHistory(const std::string& filename,
const std::string& from,
const LLUUID& from_id,
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 48ab122edf..31cf0acdd7 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1083,7 +1083,7 @@ void LLViewerMedia::clearAllCookies()
}
// the hard part: iterate over all user directories and delete the cookie file from each one
- while(gDirUtilp->getNextFileInDir(base_dir, "*_*", filename, false))
+ while(gDirUtilp->getNextFileInDir(base_dir, "*_*", filename))
{
target = base_dir;
target += filename;
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index 7314894c2e..d239347810 100644
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -89,7 +89,7 @@ void LLWaterParamManager::loadAllPresets(const std::string& file_name)
while(found)
{
std::string name;
- found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false);
+ found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name);
if(found)
{
@@ -115,7 +115,7 @@ void LLWaterParamManager::loadAllPresets(const std::string& file_name)
while(found)
{
std::string name;
- found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name, false);
+ found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name);
if(found)
{
name=name.erase(name.length()-4);
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index 9b6047395a..e5f52dfc97 100644
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -104,7 +104,7 @@ void LLWLParamManager::loadPresets(const std::string& file_name)
while(found)
{
std::string name;
- found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false);
+ found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name);
if(found)
{
@@ -130,7 +130,7 @@ void LLWLParamManager::loadPresets(const std::string& file_name)
while(found)
{
std::string name;
- found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name, false);
+ found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name);
if(found)
{
name=name.erase(name.length()-4);
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
index b396eba0b4..2ddb81559f 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
@@ -114,16 +114,17 @@
name="show_timestamps_check_im"
top_pad="10"
width="237" />
- <check_box
- enabled="false"
+ <check_box
+ control_name="LogFileNamewithDate"
+ enabled="false"
height="16"
- label="Add datestamp to log file name"
+ label="Add datestamp to log file name."
layout="topleft"
- left_delta="0"
- name="show_datestamps_check_im"
+ left_detla="5"
+ name="logfile_name_datestamp"
top_pad="10"
- width="237" />
- <text
+ width="350"/>
+ <text
type="string"
length="1"
follows="left|top"