summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorPaul ProductEngine <pguslisty@productengine.com>2012-09-13 18:49:57 +0300
committerPaul ProductEngine <pguslisty@productengine.com>2012-09-13 18:49:57 +0300
commita6370cf4a72371e090d45f2a147929d016f42780 (patch)
tree087f4646c21b45ad1dc8ecd4bd4048874abc2693 /indra
parent7da24ddaa3813f7b409b51ed5d330c7609b4f8a9 (diff)
CHUI-334 FIXED (Date not shown in the chat log for current date entries)
Before the "%Y/%m/%d" was always cutted from timestamp string for today's date. Now I added flag whether we should cut off timestamp or not.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterconversationpreview.cpp6
-rw-r--r--indra/newview/lllogchat.cpp17
-rw-r--r--indra/newview/lllogchat.h4
3 files changed, 20 insertions, 7 deletions
diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp
index dbcf154ef2..88efc39764 100644
--- a/indra/newview/llfloaterconversationpreview.cpp
+++ b/indra/newview/llfloaterconversationpreview.cpp
@@ -65,7 +65,11 @@ BOOL LLFloaterConversationPreview::postBuild()
std::string title = getString("Title", args);
setTitle(title);
- LLLogChat::loadChatHistory(file, mMessages, true);
+ LLSD load_params;
+ load_params["load_all_history"] = true;
+ load_params["cut_off_todays_date"] = false;
+
+ LLLogChat::loadChatHistory(file, mMessages, load_params);
mCurrentPage = mMessages.size() / mPageSize;
mPageSpinner = getChild<LLSpinCtrl>("history_page_spin");
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 073f5f00c5..3692658e9e 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -387,13 +387,16 @@ void append_to_last_message(std::list<LLSD>& messages, const std::string& line)
}
// static
-void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, bool load_all_history/*= false*/)
+void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params)
{
if (file_name.empty())
{
llwarns << "Session name is Empty!" << llendl;
return ;
}
+
+ bool load_all_history = load_params.has("load_all_history") ? load_params["load_all_history"].asBoolean() : false;
+
//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*/
@@ -449,7 +452,7 @@ void LLLogChat::loadChatHistory(const std::string& file_name, std::list<LLSD>& m
else
{
LLSD item;
- if (!LLChatLogParser::parse(line, item))
+ if (!LLChatLogParser::parse(line, item, load_params))
{
item[IM_TEXT] = line;
}
@@ -500,10 +503,11 @@ void LLChatLogFormatter::format(const LLSD& im, std::ostream& ostr) const
}
}
-bool LLChatLogParser::parse(std::string& raw, LLSD& im)
+bool LLChatLogParser::parse(std::string& raw, LLSD& im, const LLSD& parse_params)
{
if (!raw.length()) return false;
+ bool cut_off_todays_date = parse_params.has("cut_off_todays_date") ? parse_params["cut_off_todays_date"].asBoolean() : true;
im = LLSD::emptyMap();
//matching a timestamp
@@ -518,7 +522,12 @@ bool LLChatLogParser::parse(std::string& raw, LLSD& im)
boost::trim(timestamp);
timestamp.erase(0, 1);
timestamp.erase(timestamp.length()-1, 1);
- LLLogChatTimeScanner::instance().checkAndCutOffDate(timestamp);
+
+ if (cut_off_todays_date)
+ {
+ LLLogChatTimeScanner::instance().checkAndCutOffDate(timestamp);
+ }
+
im[IM_TIME] = timestamp;
}
else
diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h
index 95f83e64e5..d3e9adcc37 100644
--- a/indra/newview/lllogchat.h
+++ b/indra/newview/lllogchat.h
@@ -55,7 +55,7 @@ public:
void (*callback)(ELogLineType, const LLSD&, void*),
void* userdata);
- static void loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, bool load_all_history = false);
+ static void loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params = LLSD());
private:
static std::string cleanFileName(std::string filename);
};
@@ -105,7 +105,7 @@ public:
*
* @return false if failed to parse mandatory data - message text
*/
- static bool parse(std::string& raw, LLSD& im);
+ static bool parse(std::string& raw, LLSD& im, const LLSD& parse_params = LLSD());
protected:
LLChatLogParser();