From cc25193af9a64f36a75f401160f5757498f3e5fc Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 1 Aug 2020 01:19:10 +0300 Subject: SL-12795 Fix existance of multiple chatlog files after name change --- indra/newview/llconversationlog.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'indra/newview/llconversationlog.cpp') diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 5539fa75dd..dcffaf5930 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -398,6 +398,23 @@ void LLConversationLog::deleteBackupLogs() } } +void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::string &expected_filename) +{ + conversations_vec_t::iterator conv_it = mConversations.begin(); + for (; conv_it != mConversations.end(); ++conv_it) + { + if (conv_it->getSessionID() == session_id) + { + if (conv_it->getHistoryFileName() != expected_filename) + { + LLLogChat::renameLogFile(conv_it->getHistoryFileName(), expected_filename); + conv_it->updateHistoryFileName(expected_filename); + } + break; + } + } +} + bool LLConversationLog::moveLog(const std::string &originDirectory, const std::string &targetDirectory) { -- cgit v1.2.3 From a3d31ca683eb0744563b36d6432168fde6ae77d9 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 26 Jan 2021 20:28:31 +0200 Subject: SL-14766 long unicode display names corrupt the conversation.log Contribution by Beq Janus --- indra/newview/llconversationlog.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'indra/newview/llconversationlog.cpp') diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 9d78c528b6..fd59dd2601 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -535,7 +535,9 @@ bool LLConversationLog::loadFromFile(const std::string& filename) } bool purge_required = false; - char buffer[MAX_STRING]; + static constexpr int UTF_BUFFER{ 1024 }; // long enough to handle the most extreme Unicode nonsense and some to spare + + char buffer[UTF_BUFFER]; char conv_name_buffer[MAX_STRING]; char part_id_buffer[MAX_STRING]; char conv_id_buffer[MAX_STRING]; @@ -546,11 +548,14 @@ bool LLConversationLog::loadFromFile(const std::string& filename) // before CHUI-348 it was a flag of conversation voice state int prereserved_unused; - while (!feof(fp) && fgets(buffer, MAX_STRING, fp)) + memset(buffer, '\0', UTF_BUFFER); + while (!feof(fp) && fgets(buffer, UTF_BUFFER, fp)) { - conv_name_buffer[0] = '\0'; - part_id_buffer[0] = '\0'; - conv_id_buffer[0] = '\0'; + // force blank for added safety + memset(conv_name_buffer, '\0', MAX_STRING); + memset(part_id_buffer, '\0', MAX_STRING); + memset(conv_id_buffer, '\0', MAX_STRING); + memset(history_file_name, '\0', MAX_STRING); sscanf(buffer, "[%lld] %d %d %d %[^|]| %s %s %[^|]|", &time, @@ -587,6 +592,7 @@ bool LLConversationLog::loadFromFile(const std::string& filename) } mConversations.push_back(conversation); + memset(buffer, '\0', UTF_BUFFER); } fclose(fp); -- cgit v1.2.3 From 0e3d8023dc08d6b4965e71064c3ac5a2f1e4f180 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 11 Feb 2021 18:45:57 +0200 Subject: SL-12795 Fix log session name not updating --- indra/newview/llconversationlog.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llconversationlog.cpp') diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index fd59dd2601..a696c99a82 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -398,7 +398,7 @@ void LLConversationLog::deleteBackupLogs() } } -void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::string &expected_filename) +void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::string &expected_filename, const std::string &new_session_name) { conversations_vec_t::iterator conv_it = mConversations.begin(); for (; conv_it != mConversations.end(); ++conv_it) @@ -409,6 +409,7 @@ void LLConversationLog::verifyFilename(const LLUUID& session_id, const std::stri { LLLogChat::renameLogFile(conv_it->getHistoryFileName(), expected_filename); conv_it->updateHistoryFileName(expected_filename); + conv_it->setConversationName(new_session_name); } break; } -- cgit v1.2.3