CHUI-838 FIXED (Opening chat history for groups only works once per session, if at all)

meow-7.2.2
Mnikolenko ProductEngine 2013-04-03 15:07:26 +03:00
parent e21a0f09b3
commit 7b0c364a6b
3 changed files with 25 additions and 8 deletions

View File

@ -1211,7 +1211,8 @@ bool LLFloaterIMContainer::enableContextMenuItem(const LLSD& userdata)
//Enable Chat history item for ad-hoc and group conversations
if ("can_chat_history" == item && uuids.size() > 0)
{
return LLLogChat::isTranscriptExist(uuids.front());
bool is_group = (getCurSelectedViewModelItem()->getType() == LLConversationItem::CONV_SESSION_GROUP);
return LLLogChat::isTranscriptExist(uuids.front(),is_group);
}
// If nothing is selected(and selected item is not group chat), everything needs to be disabled

View File

@ -631,7 +631,7 @@ void LLLogChat::deleteTranscripts()
}
// static
bool LLLogChat::isTranscriptExist(const LLUUID& avatar_id)
bool LLLogChat::isTranscriptExist(const LLUUID& avatar_id, bool is_group)
{
std::vector<std::string> list_of_transcriptions;
LLLogChat::getListOfTranscriptFiles(list_of_transcriptions);
@ -641,15 +641,31 @@ bool LLLogChat::isTranscriptExist(const LLUUID& avatar_id)
LLAvatarName avatar_name;
LLAvatarNameCache::get(avatar_id, &avatar_name);
std::string avatar_user_name = avatar_name.getAccountName();
std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_');
BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions)
if(!is_group)
{
if (std::string::npos != transcript_file_name.find(avatar_user_name))
std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_');
BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions)
{
return true;
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;
}
}
}
}
return false;

View File

@ -67,7 +67,7 @@ public:
std::vector<std::string>& listOfFilesToMove);
static void deleteTranscripts();
static bool isTranscriptExist(const LLUUID& avatar_id);
static bool isTranscriptExist(const LLUUID& avatar_id, bool is_group=false);
private:
static std::string cleanFileName(std::string filename);