From ea1b87e2a8112ad2b2c40125d92a807e00e69860 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 20 Jul 2014 12:58:03 +0200 Subject: [PATCH] FIRE-13725 / CHUIBUG-222: Viewer freezes when opening preferences or right-clicking on friends' names; based on a fix by Kitty Barnett --- indra/newview/lllogchat.cpp | 116 +++++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 40 deletions(-) diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index e5bfd85b5c..1111be3eed 100755 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -782,15 +782,59 @@ void LLLogChat::deleteTranscripts() // static bool LLLogChat::isTranscriptExist(const LLUUID& avatar_id, bool is_group) { - std::vector list_of_transcriptions; - LLLogChat::getListOfTranscriptFiles(list_of_transcriptions); + // FIRE-13725 / CHUIBUG-222: Viewer freezes when opening preferences or right-clicking on friends' names + //std::vector list_of_transcriptions; + //LLLogChat::getListOfTranscriptFiles(list_of_transcriptions); - if (list_of_transcriptions.size() > 0) + //if (list_of_transcriptions.size() > 0) + //{ + // LLAvatarName avatar_name; + // LLAvatarNameCache::get(avatar_id, &avatar_name); + // // [Legacy IM logfile names] + // //std::string avatar_user_name = avatar_name.getAccountName(); + // std::string avatar_user_name; + // if (gSavedSettings.getBOOL("UseLegacyIMLogNames")) + // { + // avatar_user_name = avatar_name.getUserName(); + // avatar_user_name = avatar_user_name.substr(0, avatar_user_name.find(" Resident"));; + // } + // else + // { + // avatar_user_name = avatar_name.getAccountName(); + // std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_'); + // } + // // [Legacy IM logfile names] + // if(!is_group) + // { + // //std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_'); + // BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions) + // { + // if (std::string::npos != transcript_file_name.find(avatar_user_name)) + // { + // return true; + // } + // } + // } + // else + // { + // std::string file_name; + // gCacheName->getGroupName(avatar_id, file_name); + // file_name = makeLogFileName(file_name); + // BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions) + // { + // if (transcript_file_name == file_name) + // { + // return true; + // } + // } + // } + + //} + std::string file_name; + if (!is_group) { LLAvatarName avatar_name; LLAvatarNameCache::get(avatar_id, &avatar_name); - // [Legacy IM logfile names] - //std::string avatar_user_name = avatar_name.getAccountName(); std::string avatar_user_name; if (gSavedSettings.getBOOL("UseLegacyIMLogNames")) { @@ -802,51 +846,43 @@ bool LLLogChat::isTranscriptExist(const LLUUID& avatar_id, bool is_group) avatar_user_name = avatar_name.getAccountName(); std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_'); } - // [Legacy IM logfile names] - if(!is_group) - { - //std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_'); - BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions) - { - if (std::string::npos != transcript_file_name.find(avatar_user_name)) - { - return true; - } - } - } - else - { - std::string file_name; - gCacheName->getGroupName(avatar_id, file_name); - file_name = makeLogFileName(file_name); - BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions) - { - if (transcript_file_name == file_name) - { - return true; - } - } - } - + file_name = makeLogFileName(avatar_user_name); } + else + { + gCacheName->getGroupName(avatar_id, file_name); + file_name = makeLogFileName(file_name); + } + if ( (!file_name.empty()) && (LLFile::isfile(file_name)) ) + { + return true; + } + // return false; } bool LLLogChat::isNearbyTranscriptExist() { - std::vector list_of_transcriptions; - LLLogChat::getListOfTranscriptFiles(list_of_transcriptions); + // FIRE-13725 / CHUIBUG-222: Viewer freezes when opening preferences or right-clicking on friends' names + //std::vector list_of_transcriptions; + //LLLogChat::getListOfTranscriptFiles(list_of_transcriptions); - std::string file_name; - file_name = makeLogFileName("chat"); - BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions) + //std::string file_name; + //file_name = makeLogFileName("chat"); + //BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions) + //{ + // if (transcript_file_name == file_name) + // { + // return true; + // } + //} + std::string strFilePath = makeLogFileName("chat"); + if ( (!strFilePath.empty()) && (LLFile::isfile(strFilePath)) ) { - if (transcript_file_name == file_name) - { - return true; - } + return true; } + // return false; }