summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorWolfpup Lowenhar <wolfpup67@earthlink.net>2010-10-26 20:02:07 -0400
committerWolfpup Lowenhar <wolfpup67@earthlink.net>2010-10-26 20:02:07 -0400
commit7c89e565b373803b64cabaac3695ac3e93469962 (patch)
treee2fed34d493ec3e9715de17de67e314fe7ef0eed /indra
parent9abbb6c927d4f4131b0aefe6b847be0b44022c97 (diff)
This is the setting of the core file name date stamp code and settings files for
Chat, Group and IM Logs. --HG-- branch : storm-102
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/settings_per_account.xml12
-rw-r--r--indra/newview/llfloaterpreference.cpp2
-rw-r--r--indra/newview/lllogchat.cpp62
-rw-r--r--indra/newview/lllogchat.h5
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_privacy.xml12
5 files changed, 87 insertions, 6 deletions
diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml
index dc76a4e518..ab702e49e1 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>1</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/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 2bea3d37ff..a43f60f0f1 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/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 8c70b1e973..0e557cba5d 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -182,9 +182,25 @@ 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;
}
@@ -355,9 +371,21 @@ void LLLogChat::loadAllHistory(const std::string& file_name, std::list<LLSD>& me
return ;
}
- LLFILE* fptr = LLFile::fopen(makeLogFileName(file_name), "r"); /*Flawfinder: ignore*/
- if (!fptr) return; //No previous conversation with this name.
-
+ 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.
+ }
+ }
+
+ LL_INFOS("") << "Reading:" << file_name << LL_ENDL;
char buffer[LOG_RECALL_SIZE]; /*Flawfinder: ignore*/
char *bptr;
S32 len;
@@ -544,3 +572,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;
+}
diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h
index 6958d56311..578fe37227 100644
--- a/indra/newview/lllogchat.h
+++ b/indra/newview/lllogchat.h
@@ -41,6 +41,11 @@ 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 std::string ndsLogFileName(std::string(filename));
static void saveHistory(const std::string& filename,
const std::string& from,
const LLUUID& from_id,
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 4ebd4c76f8..efe08ed885 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
@@ -114,7 +114,17 @@
name="show_timestamps_check_im"
top_pad="10"
width="237" />
- <text
+ <check_box
+ control_name="LogFileNamewithDate"
+ enabled="false"
+ height="16"
+ label="Add datestamp to log file name."
+ layout="topleft"
+ left_detla="5"
+ name="logfile_name_datestamp"
+ top_pad="10"
+ width="350"/>
+ <text
type="string"
length="1"
follows="left|top"