CHUI-778: Now when changing paths for chat logs and transcripts any empty conversations will be reloaded with data from the new location. Use case for this is if the users nearby chat is empty and they switch to a location that has a nearby chat file, then the nearby chat file be loaded.
parent
084ea74d43
commit
9f965be297
|
|
@ -69,6 +69,7 @@ public:
|
|||
LLChatEntry* getChatBox() { return mInputEditor; }
|
||||
|
||||
std::string getCurrentChat();
|
||||
S32 getMessageArchiveLength() {return mMessageArchive.size();}
|
||||
|
||||
virtual BOOL handleKeyHere( KEY key, MASK mask );
|
||||
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ public:
|
|||
static floater_showed_signal_t sIMFloaterShowedSignal;
|
||||
|
||||
bool needsTitleOverwrite() { return mSessionNameUpdatedForTyping && mOtherTyping; }
|
||||
S32 getLastChatMessageIndex() {return mLastMessageIndex;}
|
||||
private:
|
||||
|
||||
/*virtual*/ void refresh();
|
||||
|
|
|
|||
|
|
@ -725,6 +725,27 @@ void LLFloaterIMSessionTab::processChatHistoryStyleUpdate(bool clean_messages/*
|
|||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLFloaterIMSessionTab::reloadEmptyFloaters()
|
||||
{
|
||||
LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
|
||||
for (LLFloaterReg::const_instance_list_t::const_iterator iter = inst_list.begin();
|
||||
iter != inst_list.end(); ++iter)
|
||||
{
|
||||
LLFloaterIMSession* floater = dynamic_cast<LLFloaterIMSession*>(*iter);
|
||||
if (floater && floater->getLastChatMessageIndex() == -1)
|
||||
{
|
||||
floater->reloadMessages(true);
|
||||
}
|
||||
}
|
||||
|
||||
LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
|
||||
if (nearby_chat && nearby_chat->getMessageArchiveLength() == 0)
|
||||
{
|
||||
nearby_chat->reloadMessages(true);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive)
|
||||
{
|
||||
LLButton* voiceButton = getChild<LLButton>("voice_call_btn");
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ public:
|
|||
|
||||
// reload all message with new settings of visual modes
|
||||
static void processChatHistoryStyleUpdate(bool clean_messages = false);
|
||||
static void reloadEmptyFloaters();
|
||||
|
||||
/**
|
||||
* Returns true if chat is displayed in multi tabbed floater
|
||||
|
|
|
|||
|
|
@ -798,8 +798,13 @@ void LLFloaterPreference::onBtnOK()
|
|||
//Conversation transcript and log path changed so reload conversations based on new location
|
||||
if(mPriorInstantMessageLogPath.length())
|
||||
{
|
||||
if(moveTranscriptsAndLog())
|
||||
{
|
||||
//When floaters are empty but have a chat history files, reload chat history into them
|
||||
LLFloaterIMSessionTab::reloadEmptyFloaters();
|
||||
}
|
||||
//Couldn't move files so restore the old path and show a notification
|
||||
if(!moveTranscriptsAndLog())
|
||||
else
|
||||
{
|
||||
gSavedPerAccountSettings.setString("InstantMessageLogPath", mPriorInstantMessageLogPath);
|
||||
LLNotificationsUtil::add("PreferenceChatPathChanged");
|
||||
|
|
|
|||
|
|
@ -517,6 +517,22 @@ bool LLLogChat::moveTranscripts(const std::string originDirectory,
|
|||
backupFileCount = 0;
|
||||
newFullPath = targetDirectory + fullpath.substr(originDirectory.length(), std::string::npos);
|
||||
|
||||
//The target directory contains that file already, so lets store it
|
||||
if(LLFile::isfile(newFullPath))
|
||||
{
|
||||
backupFileName = newFullPath + ".backup";
|
||||
|
||||
//If needed store backup file as .backup1 etc.
|
||||
while(LLFile::isfile(backupFileName))
|
||||
{
|
||||
++backupFileCount;
|
||||
backupFileName = newFullPath + ".backup" + boost::lexical_cast<std::string>(backupFileCount);
|
||||
}
|
||||
|
||||
//Rename the file to its backup name so it is not overwritten
|
||||
LLFile::rename(newFullPath, backupFileName);
|
||||
}
|
||||
|
||||
S32 retry_count = 0;
|
||||
while (retry_count < 5)
|
||||
{
|
||||
|
|
@ -528,22 +544,6 @@ bool LLLogChat::moveTranscripts(const std::string originDirectory,
|
|||
LL_WARNS("LLLogChat::moveTranscripts") << "Problem renaming " << fullpath << " - errorcode: "
|
||||
<< result << " attempt " << retry_count << LL_ENDL;
|
||||
|
||||
//The target directory contains that file already, so lets store it
|
||||
if(LLFile::isfile(newFullPath))
|
||||
{
|
||||
backupFileName = newFullPath + ".backup";
|
||||
|
||||
//If needed store backup file as .backup1 etc.
|
||||
while(LLFile::isfile(backupFileName))
|
||||
{
|
||||
++backupFileCount;
|
||||
backupFileName = newFullPath + ".backup" + boost::lexical_cast<std::string>(backupFileCount);
|
||||
}
|
||||
|
||||
//Rename the file to its backup name so it is not overwritten
|
||||
LLFile::rename(newFullPath, backupFileName);
|
||||
}
|
||||
|
||||
ms_sleep(100);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue