From 61c1b2fe2bde94a5f77597725e446a5345219ebe Mon Sep 17 00:00:00 2001
From: Gilbert Gonzales <gilbert@lindenlab.com>
Date: Tue, 19 Feb 2013 16:38:22 -0800
Subject: [PATCH] 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 3d8d0e15ecf..b3e3a0678b7 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 dbd87f74a19..c72346c3b61 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -186,6 +186,7 @@ class LLFloaterPreference : public LLFloater, public LLAvatarPropertiesObserver,
 	bool mGotPersonalInfo;
 	bool mOriginalIMViaEmail;
 	bool mLanguageChanged;
+	bool mInstantMessageLogPathChanged;
 	bool mAvatarDataInitialized;
 	
 	bool mOriginalHideOnlineStatus;
-- 
GitLab