From 61c1b2fe2bde94a5f77597725e446a5345219ebe Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 19 Feb 2013 16:38:22 -0800 Subject: CHUI-778 (Saving preferences updates text in all open message panels in conversation floater to show as old messages) Problem was that closing the preferences floater was always acting as if the conversation transcripts/log files path had changed. If the path did not change then the user's conversations would be cleared and re-loaded as if they were part of the user's history (causing text to be grey). Solution: Now keep track of when the path was changed and only load up the transcripts/log upon change. --- indra/newview/llfloaterpreference.cpp | 28 ++++++++++++++++++++-------- indra/newview/llfloaterpreference.h | 1 + 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 3d8d0e15ec..b3e3a0678b 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -647,8 +647,12 @@ void LLFloaterPreference::cancel() pPathfindingConsole->onRegionBoundaryCross(); } - std::string dir_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); - updateLogLocation(dir_name); + if(mInstantMessageLogPathChanged) + { + std::string dir_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); + updateLogLocation(dir_name); + mInstantMessageLogPathChanged = false; + } } void LLFloaterPreference::onOpen(const LLSD& key) @@ -1436,19 +1440,27 @@ void LLFloaterPreference::setAllIgnored() void LLFloaterPreference::onClickLogPath() { - std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); + std::string original_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); + std::string proposed_name(original_name); + mInstantMessageLogPathChanged = false; LLDirPicker& picker = LLDirPicker::instance(); + //Launches a directory picker and waits for feedback if (!picker.getDir(&proposed_name ) ) { return; //Canceled! } - std::string dir_name = picker.getDirName(); - gSavedPerAccountSettings.setString("InstantMessageLogPath", dir_name); - - // enable/disable 'Delete transcripts button - updateDeleteTranscriptsButton(); + //Path changed + if(original_name != proposed_name) + { + std::string dir_name = picker.getDirName(); + gSavedPerAccountSettings.setString("InstantMessageLogPath", dir_name); + mInstantMessageLogPathChanged = true; + + // enable/disable 'Delete transcripts button + updateDeleteTranscriptsButton(); + } } void LLFloaterPreference::updateLogLocation(const std::string& dir_name) diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index dbd87f74a1..c72346c3b6 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -186,6 +186,7 @@ private: bool mGotPersonalInfo; bool mOriginalIMViaEmail; bool mLanguageChanged; + bool mInstantMessageLogPathChanged; bool mAvatarDataInitialized; bool mOriginalHideOnlineStatus; -- cgit v1.2.3 From 10dfe2d53413d2522038e79d4921a2305762dd63 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 20 Feb 2013 15:51:44 -0800 Subject: CHUI-778: Minor changes, prior commit was not changing the file path correctly due to logic error. Also clicking the 'Cancel' in preferences would still cause the file location to be saved instead of ignore the save. --- indra/newview/llfloaterpreference.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index b3e3a0678b..e5444583d6 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -646,13 +646,6 @@ void LLFloaterPreference::cancel() LLFloaterPathfindingConsole* pPathfindingConsole = pathfindingConsoleHandle.get(); pPathfindingConsole->onRegionBoundaryCross(); } - - if(mInstantMessageLogPathChanged) - { - std::string dir_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); - updateLogLocation(dir_name); - mInstantMessageLogPathChanged = false; - } } void LLFloaterPreference::onOpen(const LLSD& key) @@ -802,6 +795,14 @@ void LLFloaterPreference::onBtnOK() apply(); closeFloater(false); + //Conversation transcript and log path changed so reload conversations based on new location + if(mInstantMessageLogPathChanged) + { + std::string dir_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); + updateLogLocation(dir_name); + mInstantMessageLogPathChanged = false; + } + LLUIColorTable::instance().saveUserSettings(); gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); } @@ -1440,8 +1441,7 @@ void LLFloaterPreference::setAllIgnored() void LLFloaterPreference::onClickLogPath() { - std::string original_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); - std::string proposed_name(original_name); + std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); mInstantMessageLogPathChanged = false; LLDirPicker& picker = LLDirPicker::instance(); @@ -1451,10 +1451,12 @@ void LLFloaterPreference::onClickLogPath() return; //Canceled! } + //Gets the path from the directory picker + std::string dir_name = picker.getDirName(); + //Path changed - if(original_name != proposed_name) + if(proposed_name != dir_name) { - std::string dir_name = picker.getDirName(); gSavedPerAccountSettings.setString("InstantMessageLogPath", dir_name); mInstantMessageLogPathChanged = true; -- cgit v1.2.3 From 05f4e8a10517b3b341359a210aeb0af06c44d43a Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 22 Feb 2013 18:53:40 -0800 Subject: CHUI-778 (Saving preferences updates text in all open message panels in conversation floater to show as old messages) Now changing the log/transcripts file location actually moves the files to the new location. Prior behavior just started a new history at that location. Also a fix was made so that if the user changed the log/transcripts path then after pressing the Preferences 'OK' button the new location will be saved to the corresponding .xml file. --- indra/llvfs/lldir.cpp | 5 ++ indra/llvfs/lldir.h | 1 + indra/newview/llconversationlog.cpp | 21 ++++++ indra/newview/llconversationlog.h | 13 ++-- indra/newview/llfloaterpreference.cpp | 86 +++++++++++++++++++--- indra/newview/llfloaterpreference.h | 4 +- indra/newview/lllogchat.cpp | 60 +++++++++++++++ indra/newview/lllogchat.h | 4 + .../newview/skins/default/xui/en/notifications.xml | 11 +++ 9 files changed, 186 insertions(+), 19 deletions(-) diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp index f7bc19574a..6899e9a44a 100644 --- a/indra/llvfs/lldir.cpp +++ b/indra/llvfs/lldir.cpp @@ -347,6 +347,11 @@ const std::string &LLDir::getLLPluginDir() const return mLLPluginDir; } +const std::string &LLDir::getUserName() const +{ + return mUserName; +} + static std::string ELLPathToString(ELLPath location) { typedef std::map ELLPathMap; diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h index 95cab65149..cc10ed5bbd 100644 --- a/indra/llvfs/lldir.h +++ b/indra/llvfs/lldir.h @@ -104,6 +104,7 @@ class LLDir const std::string &getUserSkinDir() const; // User-specified skin folder with user modifications. e.g. c:\documents and settings\username\application data\second life\skins\curskin const std::string getSkinBaseDir() const; // folder that contains all installed skins (not user modifications). e.g. c:\program files\second life\skins const std::string &getLLPluginDir() const; // Directory containing plugins and plugin shell + const std::string &getUserName() const; // Expanded filename std::string getExpandedFilename(ELLPath location, const std::string &filename) const; diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index fc3bc8551c..88671a789f 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -376,6 +376,27 @@ void LLConversationLog::cache() } } +bool LLConversationLog::moveLog(const std::string &originDirectory, const std::string &targetDirectory) +{ + //Does the file exist in the current path + if(LLFile::isfile(originDirectory)) + { + //Does same file exist in the destination path, if so try to remove it + if(LLFile::isfile(targetDirectory)) + { + LLFile::remove(targetDirectory); + } + + //Move the file from the current path to destination path + if(LLFile::rename(originDirectory, targetDirectory) != 0) + { + return false; + } + } + + return true; +} + std::string LLConversationLog::getFileName() { std::string filename = "conversation"; diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h index fd38556131..58e698de25 100644 --- a/indra/newview/llconversationlog.h +++ b/indra/newview/llconversationlog.h @@ -137,6 +137,7 @@ public: * public method which is called on viewer exit to save conversation log */ void cache(); + bool moveLog(const std::string &originDirectory, const std::string &targetDirectory); void onClearLog(); void onClearLogResponse(const LLSD& notification, const LLSD& response); @@ -144,6 +145,12 @@ public: bool getIsLoggingEnabled() { return mLoggingEnabled; } bool isLogEmpty() { return mConversations.empty(); } + /** + * constructs file name in which conversations log will be saved + * file name is conversation.log + */ + std::string getFileName(); + private: LLConversationLog(); @@ -164,12 +171,6 @@ private: void notifyParticularConversationObservers(const LLUUID& session_id, U32 mask); - /** - * constructs file name in which conversations log will be saved - * file name is conversation.log - */ - std::string getFileName(); - bool saveToFile(const std::string& filename); bool loadFromFile(const std::string& filename); diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index e5444583d6..b9239b544f 100755 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -796,15 +796,25 @@ void LLFloaterPreference::onBtnOK() closeFloater(false); //Conversation transcript and log path changed so reload conversations based on new location - if(mInstantMessageLogPathChanged) + if(mPriorInstantMessageLogPath.length()) { - std::string dir_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); - updateLogLocation(dir_name); - mInstantMessageLogPathChanged = false; + //Couldn't move files so restore the old path and show a notification + if(!moveTranscriptsAndLog()) + { + gSavedPerAccountSettings.setString("InstantMessageLogPath", mPriorInstantMessageLogPath); + LLNotificationsUtil::add("PreferenceChatPathChanged"); + } + mPriorInstantMessageLogPath.clear(); } LLUIColorTable::instance().saveUserSettings(); gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); + + //Only save once logged in and loaded per account settings + if(mGotPersonalInfo) + { + gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE); + } } else { @@ -1442,7 +1452,7 @@ void LLFloaterPreference::setAllIgnored() void LLFloaterPreference::onClickLogPath() { std::string proposed_name(gSavedPerAccountSettings.getString("InstantMessageLogPath")); - mInstantMessageLogPathChanged = false; + mPriorInstantMessageLogPath.clear(); LLDirPicker& picker = LLDirPicker::instance(); //Launches a directory picker and waits for feedback @@ -1458,21 +1468,75 @@ void LLFloaterPreference::onClickLogPath() if(proposed_name != dir_name) { gSavedPerAccountSettings.setString("InstantMessageLogPath", dir_name); - mInstantMessageLogPathChanged = true; + mPriorInstantMessageLogPath = proposed_name; // enable/disable 'Delete transcripts button updateDeleteTranscriptsButton(); } } -void LLFloaterPreference::updateLogLocation(const std::string& dir_name) +bool LLFloaterPreference::moveTranscriptsAndLog() { - gDirUtilp->setChatLogsDir(dir_name); + std::string instantMessageLogPath(gSavedPerAccountSettings.getString("InstantMessageLogPath")); + std::string chatLogPath = gDirUtilp->add(instantMessageLogPath, gDirUtilp->getUserName()); + + bool madeDirectory = false; + + //Does the directory really exist, if not then make it + if(!LLFile::isdir(chatLogPath)) + { + //mkdir success is defined as zero + if(LLFile::mkdir(chatLogPath) != 0) + { + return false; + } + madeDirectory = true; + } + + std::string originalConversationLogDir = LLConversationLog::instance().getFileName(); + std::string targetConversationLogDir = gDirUtilp->add(chatLogPath, "conversation.log"); + //Try to move the conversation log + if(!LLConversationLog::instance().moveLog(originalConversationLogDir, targetConversationLogDir)) + { + //Couldn't move the log and created a new directory so remove the new directory + if(madeDirectory) + { + LLFile::rmdir(chatLogPath); + } + return false; + } + + //Attempt to move transcripts + std::vector listOfTranscripts; + std::vector listOfFilesMoved; + + LLLogChat::getListOfTranscriptFiles(listOfTranscripts); + + if(!LLLogChat::moveTranscripts(gDirUtilp->getChatLogsDir(), + instantMessageLogPath, + listOfTranscripts, + listOfFilesMoved)) + { + //Couldn't move all the transcripts so restore those that moved back to their old location + LLLogChat::moveTranscripts(instantMessageLogPath, + gDirUtilp->getChatLogsDir(), + listOfFilesMoved); + + //Move the conversation log back + LLConversationLog::instance().moveLog(targetConversationLogDir, originalConversationLogDir); + + if(madeDirectory) + { + LLFile::rmdir(chatLogPath); + } + + return false; + } + + gDirUtilp->setChatLogsDir(instantMessageLogPath); gDirUtilp->updatePerAccountChatLogsDir(); - LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir()); - // refresh IM floaters with new logs from files from new selected directory - LLFloaterIMSessionTab::processChatHistoryStyleUpdate(true); + return true; } void LLFloaterPreference::setPersonalInfo(const std::string& visibility, bool im_via_email) diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h index c72346c3b6..22e80a21cb 100644 --- a/indra/newview/llfloaterpreference.h +++ b/indra/newview/llfloaterpreference.h @@ -143,7 +143,7 @@ public: void resetAllIgnored(); void setAllIgnored(); void onClickLogPath(); - void updateLogLocation(const std::string& dir_name); + bool moveTranscriptsAndLog(); void enableHistory(); void setPersonalInfo(const std::string& visibility, bool im_via_email); void refreshEnabledState(); @@ -186,8 +186,8 @@ private: bool mGotPersonalInfo; bool mOriginalIMViaEmail; bool mLanguageChanged; - bool mInstantMessageLogPathChanged; bool mAvatarDataInitialized; + std::string mPriorInstantMessageLogPath; bool mOriginalHideOnlineStatus; std::string mDirectoryVisibility; diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 17b72c5023..b60e2aa44e 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -500,6 +500,66 @@ boost::signals2::connection LLLogChat::setSaveHistorySignal(const save_history_s return sSaveHistorySignal->connect(cb); } +//static +bool LLLogChat::moveTranscripts(const std::string originDirectory, + const std::string targetDirectory, + std::vector& listOfFilesToMove, + std::vector& listOfFilesMoved) +{ + std::string newFullPath; + bool movedAllTranscripts = true; + + BOOST_FOREACH(const std::string& fullpath, listOfFilesToMove) + { + newFullPath = targetDirectory + fullpath.substr(originDirectory.length(), std::string::npos); + + S32 retry_count = 0; + while (retry_count < 5) + { + //success is zero + if (LLFile::rename(fullpath, newFullPath) != 0) + { + retry_count++; + S32 result = errno; + LL_WARNS("LLLogChat::moveTranscripts") << "Problem renaming " << fullpath << " - errorcode: " + << result << " attempt " << retry_count << LL_ENDL; + + if(retry_count >= 5) + { + LL_WARNS("LLLogChat::moveTranscripts") << "Failed to rename " << fullpath << LL_ENDL; + return false; + } + + //If the file already exists in the new location, remove it then try again + if(LLFile::isfile(newFullPath)) + { + LLFile::remove(newFullPath); + LL_WARNS("LLLogChat::moveTranscripts") << "File already exists " << fullpath << LL_ENDL; + } + + ms_sleep(100); + } + else + { + listOfFilesMoved.push_back(newFullPath); + + if (retry_count) + { + LL_WARNS("LLLogChat::moveTranscripts") << "Successfully renamed " << fullpath << LL_ENDL; + } + break; + } + } + } + + if(listOfFilesMoved.size() != listOfFilesToMove.size()) + { + movedAllTranscripts = false; + } + + return movedAllTranscripts; +} + //static void LLLogChat::deleteTranscripts() { diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index 5fbb4ade96..b9aede0b29 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -56,6 +56,10 @@ public: typedef boost::signals2::signal save_history_signal_t; static boost::signals2::connection setSaveHistorySignal(const save_history_signal_t::slot_type& cb); + static bool moveTranscripts(const std::string currentDirectory, + const std::string newDirectory, + std::vector& listOfFilesToMove, + std::vector& listOfFilesMoved = std::vector()); static void deleteTranscripts(); private: diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 3ae9b206a4..234c6d7c0f 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -10028,4 +10028,15 @@ Cannot create large prims that intersect other players. Please re-try when othe yestext="OK"/> + + Unable to move files. Restored previous path. + + + -- cgit v1.2.3 From c6929e42486dd6aa212dc523be4f3b65f431b016 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 25 Feb 2013 04:20:08 -0800 Subject: CHUI-788 (Saving preferences updates text in all open message panels in conversation floater to show as old messages) Fixed build error for mac/linux --- indra/newview/lllogchat.cpp | 9 +++++++++ indra/newview/lllogchat.h | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index b60e2aa44e..95b0e6b9d6 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -560,6 +560,15 @@ bool LLLogChat::moveTranscripts(const std::string originDirectory, return movedAllTranscripts; } +//static +bool LLLogChat::moveTranscripts(const std::string currentDirectory, + const std::string newDirectory, + std::vector& listOfFilesToMove) +{ + std::vector listOfFilesMoved; + return moveTranscripts(currentDirectory, newDirectory, listOfFilesToMove, listOfFilesMoved); +} + //static void LLLogChat::deleteTranscripts() { diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index b9aede0b29..244f1c8790 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -59,7 +59,11 @@ public: static bool moveTranscripts(const std::string currentDirectory, const std::string newDirectory, std::vector& listOfFilesToMove, - std::vector& listOfFilesMoved = std::vector()); + std::vector& listOfFilesMoved); + static bool moveTranscripts(const std::string currentDirectory, + const std::string newDirectory, + std::vector& listOfFilesToMove); + static void deleteTranscripts(); private: -- cgit v1.2.3 From 57935506c29e4dfde82626a91a853d87a46aead3 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 25 Feb 2013 13:41:37 -0800 Subject: merge --- indra/newview/llconversationlog.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 4953bcbd02..03d1647c5e 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -380,13 +380,32 @@ void LLConversationLog::cache() bool LLConversationLog::moveLog(const std::string &originDirectory, const std::string &targetDirectory) { + + std::string backupFileName; + UINT backupFileCount = 0; + //Does the file exist in the current path if(LLFile::isfile(originDirectory)) { - //Does same file exist in the destination path, if so try to remove it + + //File already exists so make a backup file if(LLFile::isfile(targetDirectory)) { - LLFile::remove(targetDirectory); + backupFileName = targetDirectory + ".backup"; + + //If needed store backup file as .backup1 etc. + while(LLFile::isfile(backupFileName)) + { + backupFileName = targetDirectory + ".backup"; + + if(backupFileCount) + { + backupFileName += backupFileCount; + } + } + + //Rename the file to its backup name so it is not overwritten + LLFile::rename(targetDirectory, backupFileName); } //Move the file from the current path to destination path -- cgit v1.2.3 From 084ea74d43471eec1ae8781c4946fcf2a3a76a78 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 25 Feb 2013 16:48:09 -0800 Subject: CHUI-778: Now when conversation log and trascript files are moved they will not overwrite prior files with the same name. Instead the prior files will be stored as *.backup. --- indra/newview/llconversationlog.cpp | 21 +++++++++------------ indra/newview/lllogchat.cpp | 24 +++++++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp index 03d1647c5e..4be169e267 100644 --- a/indra/newview/llconversationlog.cpp +++ b/indra/newview/llconversationlog.cpp @@ -31,6 +31,8 @@ #include "llnotificationsutil.h" #include "lltrans.h" +#include "boost/lexical_cast.hpp" + const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec struct ConversationParams @@ -382,13 +384,12 @@ bool LLConversationLog::moveLog(const std::string &originDirectory, const std::s { std::string backupFileName; - UINT backupFileCount = 0; + unsigned backupFileCount = 0; - //Does the file exist in the current path - if(LLFile::isfile(originDirectory)) + //Does the file exist in the current path, if it does lets move it + if(LLFile::isfile(originDirectory)) { - - //File already exists so make a backup file + //The target directory contains that file already, so lets store it if(LLFile::isfile(targetDirectory)) { backupFileName = targetDirectory + ".backup"; @@ -396,19 +397,15 @@ bool LLConversationLog::moveLog(const std::string &originDirectory, const std::s //If needed store backup file as .backup1 etc. while(LLFile::isfile(backupFileName)) { - backupFileName = targetDirectory + ".backup"; - - if(backupFileCount) - { - backupFileName += backupFileCount; - } + ++backupFileCount; + backupFileName = targetDirectory + ".backup" + boost::lexical_cast(backupFileCount); } //Rename the file to its backup name so it is not overwritten LLFile::rename(targetDirectory, backupFileName); } - //Move the file from the current path to destination path + //Move the file from the current path to target path if(LLFile::rename(originDirectory, targetDirectory) != 0) { return false; diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index d9d28c6d70..6562cfe1bb 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -509,9 +509,12 @@ bool LLLogChat::moveTranscripts(const std::string originDirectory, { std::string newFullPath; bool movedAllTranscripts = true; + std::string backupFileName; + unsigned backupFileCount; BOOST_FOREACH(const std::string& fullpath, listOfFilesToMove) { + backupFileCount = 0; newFullPath = targetDirectory + fullpath.substr(originDirectory.length(), std::string::npos); S32 retry_count = 0; @@ -525,17 +528,20 @@ bool LLLogChat::moveTranscripts(const std::string originDirectory, LL_WARNS("LLLogChat::moveTranscripts") << "Problem renaming " << fullpath << " - errorcode: " << result << " attempt " << retry_count << LL_ENDL; - if(retry_count >= 5) - { - LL_WARNS("LLLogChat::moveTranscripts") << "Failed to rename " << fullpath << LL_ENDL; - return false; - } - - //If the file already exists in the new location, remove it then try again + //The target directory contains that file already, so lets store it if(LLFile::isfile(newFullPath)) { - LLFile::remove(newFullPath); - LL_WARNS("LLLogChat::moveTranscripts") << "File already exists " << fullpath << LL_ENDL; + backupFileName = newFullPath + ".backup"; + + //If needed store backup file as .backup1 etc. + while(LLFile::isfile(backupFileName)) + { + ++backupFileCount; + backupFileName = newFullPath + ".backup" + boost::lexical_cast(backupFileCount); + } + + //Rename the file to its backup name so it is not overwritten + LLFile::rename(newFullPath, backupFileName); } ms_sleep(100); -- cgit v1.2.3 From a26c1672235578f3a4e21be370b11522207e2c57 Mon Sep 17 00:00:00 2001 From: maksymsproductengine Date: Mon, 4 Mar 2013 20:05:35 +0200 Subject: CHUI-757 FIXED CHUI viewer shows Autopilot cancelled notification toast when interrupting click to walk: - The AutopilotCanceled notification was disabled for this viewer; --- indra/newview/skins/default/xui/en/notifications.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 3ae9b206a4..9c81c877b5 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -9706,14 +9706,6 @@ There is no suitable surface to sit on, try another spot. No room to sit here, try another spot. - - fail -Autopilot canceled - - Date: Mon, 4 Mar 2013 10:11:51 -0800 Subject: 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. --- indra/newview/llfloaterimnearbychat.h | 1 + indra/newview/llfloaterimsession.h | 1 + indra/newview/llfloaterimsessiontab.cpp | 21 +++++++++++++++++++++ indra/newview/llfloaterimsessiontab.h | 1 + indra/newview/llfloaterpreference.cpp | 7 ++++++- 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(*iter); + if (floater && floater->getLastChatMessageIndex() == -1) + { + floater->reloadMessages(true); + } + } + + LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); + if (nearby_chat && nearby_chat->getMessageArchiveLength() == 0) + { + nearby_chat->reloadMessages(true); + } +} + void LLFloaterIMSessionTab::updateCallBtnState(bool callIsActive) { LLButton* voiceButton = getChild("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(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(backupFileCount); - } - - //Rename the file to its backup name so it is not overwritten - LLFile::rename(newFullPath, backupFileName); - } - ms_sleep(100); } else -- cgit v1.2.3 From f352c81f11f26dfe9fe2cf494407045bab41dabf Mon Sep 17 00:00:00 2001 From: "Graham Madarasz (Graham)" Date: Mon, 4 Mar 2013 14:18:49 -0800 Subject: For MAINT-2423 fix regression from CHUI merge. Code review: DaveP --- indra/newview/lldrawable.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 59c2f15dd9..ba1759f642 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -643,18 +643,9 @@ BOOL LLDrawable::updateMove() return FALSE; } - BOOL done; + makeActive(); - if (isState(MOVE_UNDAMPED)) - { - done = updateMoveUndamped(); - } - else - { - makeActive(); - done = updateMoveDamped(); - } - return done; + return isState(MOVE_UNDAMPED) ? updateMoveUndamped() : updateMoveDamped(); } BOOL LLDrawable::updateMoveUndamped() -- cgit v1.2.3