Make option to open conversation history externally work under various circumstances (legacy filename format, session does not exist...)

meow-7.2.2
Ansariel 2013-07-25 11:55:18 +02:00
parent add9b699d8
commit 0445b453ee
6 changed files with 59 additions and 14 deletions

View File

@ -482,9 +482,13 @@ void FSFloaterIM::onHistoryButtonClicked()
{
lldebugs << "FSFloaterIM::onHistoryButtonClicked" << llendl;
if (gSavedSettings.getBOOL("FSUseBuiltInHistory"))
{
LLFloaterReg::showInstance("preview_conversation", mSessionID, true);
}
else
LLAvatarActions::viewChatHistoryExternally(mSessionID);
{
gViewerWindow->getWindow()->openFile(LLLogChat::makeLogFileName(LLIMModel::instance().getHistoryFileName(mSessionID)));
}
}
// support sysinfo button -Zi

View File

@ -1125,7 +1125,18 @@ void LLAvatarActions::viewChatHistory(const LLUUID& id)
LLAvatarNameCache::get(id, &avatar_name);
extended_id[LL_FCP_COMPLETE_NAME] = avatar_name.getCompleteName();
extended_id[LL_FCP_ACCOUNT_NAME] = avatar_name.getAccountName();
// <FS:Ansariel> [Legacy IM logfile names]
//extended_id[LL_FCP_ACCOUNT_NAME] = avatar_name.getAccountName();
if (gSavedSettings.getBOOL("UseLegacyIMLogNames"))
{
std::string avatar_user_name = avatar_name.getUserName();
extended_id[LL_FCP_ACCOUNT_NAME] = avatar_user_name.substr(0, avatar_user_name.find(" Resident"));;
}
else
{
extended_id[LL_FCP_ACCOUNT_NAME] = avatar_name.getAccountName();
}
// </FS:Ansariel> [Legacy IM logfile names]
LLFloaterReg::showInstance("preview_conversation", extended_id, true);
}
}
@ -1136,7 +1147,22 @@ void LLAvatarActions::viewChatHistoryExternally(const LLUUID& id)
{
if (LLLogChat::isTranscriptExist(id))
{
gViewerWindow->getWindow()->openFile(LLLogChat::makeLogFileName(LLIMModel::instance().getHistoryFileName(id)));
LLAvatarName av_name;
if (LLAvatarNameCache::get(id, &av_name))
{
std::string history_filename;
if (gSavedSettings.getBOOL("UseLegacyIMLogNames"))
{
std::string user_name = av_name.getUserName();
history_filename = user_name.substr(0, user_name.find(" Resident"));;
}
else
{
history_filename = LLCacheName::buildUsername(av_name.getUserName());
}
gViewerWindow->getWindow()->openFile(LLLogChat::makeLogFileName(history_filename));
}
}
}
// </FS:CR>

View File

@ -35,6 +35,8 @@
#include "llviewermenu.h"
#include "lltrans.h"
#include "llviewercontrol.h" // <FS:CR>
#include "llviewerwindow.h"
#include "llwindow.h"
static LLDefaultChildRegistry::Register<LLConversationLogList> r("conversation_log_list");
@ -351,7 +353,8 @@ void LLConversationLogList::onCustomAction(const LLSD& userdata)
// <FS:CR> Open conversation history externally
else if ("chat_history_external")
{
LLAvatarActions::viewChatHistoryExternally(selected_conversation_participant_id);
gViewerWindow->getWindow()->openFile(LLLogChat::makeLogFileName(
LLConversationLog::getInstance()->getConversation(selected_conversation_session_id)->getHistoryFileName()));
}
// </FS:CR>
}

View File

@ -40,6 +40,7 @@
#include "llavataractions.h"
#include "llviewerwindow.h"
#include "llwindow.h"
#include "llconversationlog.h"
// </FS:CR>
const std::string LL_FCP_COMPLETE_NAME("complete_name");
@ -84,6 +85,8 @@ BOOL LLFloaterConversationPreview::postBuild()
name = LLTrans::getString("NearbyChatTitle");
file = "chat";
}
// <FS:Ansariel> Remember used log file name
mFileName = file;
LLStringUtil::format_map_t args;
args["[NAME]"] = name;
@ -205,12 +208,5 @@ void LLFloaterConversationPreview::onMoreHistoryBtnClick()
// <FS:CR> Open chat history externally
void (LLFloaterConversationPreview::onBtnOpenExternal())
{
if (mSessionID.notNull())
{
LLAvatarActions::viewChatHistoryExternally(mSessionID);
}
else
{
gViewerWindow->getWindow()->openFile(LLLogChat::makeLogFileName("chat"));
}
gViewerWindow->getWindow()->openFile(LLLogChat::makeLogFileName(mFileName));
}

View File

@ -66,6 +66,9 @@ private:
std::list<LLSD> mMessages;
std::string mAccountName;
std::string mCompleteName;
// <FS:Ansariel> Remember used log file name
std::string mFileName;
};
#endif /* LLFLOATERCONVERSATIONPREVIEW_H_ */

View File

@ -673,8 +673,21 @@ 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(), '.', '_');
// <FS:Ansariel> [Legacy IM logfile names]
//std::string avatar_user_name = avatar_name.getAccountName();
//std::replace(avatar_user_name.begin(), avatar_user_name.end(), '.', '_');
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(), '.', '_');
}
// <//FS:Ansariel> [Legacy IM logfile names]
BOOST_FOREACH(std::string& transcript_file_name, list_of_transcriptions)
{