diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-03-04 10:11:51 -0800 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-03-04 10:11:51 -0800 |
commit | 9f965be297422ddab79ff9be47fb6d5c64a5096f (patch) | |
tree | 02140b5fe78f7f348325d769b130c983127adee4 | |
parent | 084ea74d43471eec1ae8781c4946fcf2a3a76a78 (diff) |
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.
-rw-r--r-- | indra/newview/llfloaterimnearbychat.h | 1 | ||||
-rw-r--r-- | indra/newview/llfloaterimsession.h | 1 | ||||
-rw-r--r-- | indra/newview/llfloaterimsessiontab.cpp | 21 | ||||
-rw-r--r-- | indra/newview/llfloaterimsessiontab.h | 1 | ||||
-rwxr-xr-x | indra/newview/llfloaterpreference.cpp | 7 | ||||
-rw-r--r-- | indra/newview/lllogchat.cpp | 32 |
6 files changed, 46 insertions, 17 deletions
diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h index 2992c12436..4ad37eb0c7 100644 --- a/indra/newview/llfloaterimnearbychat.h +++ b/indra/newview/llfloaterimnearbychat.h @@ -69,6 +69,7 @@ public: LLChatEntry* getChatBox() { return mInputEditor; } std::string getCurrentChat(); + S32 getMessageArchiveLength() {return mMessageArchive.size();} virtual BOOL handleKeyHere( KEY key, MASK mask ); diff --git a/indra/newview/llfloaterimsession.h b/indra/newview/llfloaterimsession.h index 381b3cf721..cb330bca0f 100644 --- a/indra/newview/llfloaterimsession.h +++ b/indra/newview/llfloaterimsession.h @@ -133,6 +133,7 @@ public: static floater_showed_signal_t sIMFloaterShowedSignal; bool needsTitleOverwrite() { return mSessionNameUpdatedForTyping && mOtherTyping; } + S32 getLastChatMessageIndex() {return mLastMessageIndex;} private: /*virtual*/ void refresh(); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 6dbcdb4474..f773ed4e23 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -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"); diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index e90fcbb806..b245049137 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -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 diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 988190f96a..3f8c23ba83 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -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"); diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 6562cfe1bb..448100c5d6 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -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 |