diff --git a/doc/contributions.txt b/doc/contributions.txt
index 10c935f9bbf2cc70d45cf5b7a3001b6436c33989..32dd3c1a2ee6575a3cfd4a744d66d20a3bc3f658 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -744,6 +744,7 @@ Marc Claridge
 Marc2 Sands
 Marianne McCann
 Marine Kelley
+    CHUIBUG-134
     STORM-281
 MartinRJ Fayray
     STORM-1844
diff --git a/indra/llui/llchatentry.cpp b/indra/llui/llchatentry.cpp
index 8e9c6555c32608ac2ac545b558093209b5049281..9e48dcde7e20d8eb46a35db3f2bebb82522943cb 100644
--- a/indra/llui/llchatentry.cpp
+++ b/indra/llui/llchatentry.cpp
@@ -169,6 +169,15 @@ BOOL LLChatEntry::handleSpecialKey(const KEY key, const MASK mask)
 {
 	BOOL handled = FALSE;
 
+    // In the case of a chat entry, pressing RETURN when something is selected
+    // should NOT erase the selection (unlike a notecard, for example)
+    if (key == KEY_RETURN)
+    {
+        endOfDoc();
+        startSelection();
+        endSelection();
+    }
+
 	LLTextEditor::handleSpecialKey(key, mask);
 
 	switch(key)
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 27dd7f5b324338e744c6afcd9834c730b7227c9f..09e27a264aa151399208526cf86d02ee21d7ba2d 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1621,7 +1621,7 @@ void LLFloater::bringToFront( S32 x, S32 y )
 
 
 // virtual
-void LLFloater::setVisibleAndFrontmost(BOOL take_focus)
+void LLFloater::setVisibleAndFrontmost(BOOL take_focus, const LLSD& key)
 {
 	LLMultiFloater* hostp = getHost();
 	if (hostp)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index cb5bf28db3c0e003f08ad524512836117ed79dd1..4dba1e645f5bdcf3d6319180c24efa89879c8170 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -305,7 +305,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 	/*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // do not override
 	
 	void			setFrontmost(BOOL take_focus = TRUE);
-    virtual void	setVisibleAndFrontmost(BOOL take_focus=TRUE);    
+    virtual void	setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD());    
 	
 	// Defaults to false.
 	virtual BOOL	canSaveAs() const { return FALSE; }
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index c20d8636126224d4b611969aa71697a5552c2a59..1cdddf0d5b93e830eabc4776cabcfb26bf3dd6e0 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -488,12 +488,12 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD&
 		{
 			host->setMinimized(FALSE);
 			instance->openFloater(key);
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 		}
 		else if (!instance->getVisible())
 		{
 			instance->openFloater(key);
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 			instance->setFocus(TRUE);
 		}
 		else
@@ -506,16 +506,16 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD&
 		if (instance->isMinimized())
 		{
 			instance->setMinimized(FALSE);
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 		}
 		else if (!instance->isShown())
 		{
 			instance->openFloater(key);
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 		}
 		else if (!instance->isFrontmost())
 		{
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 		}
 		else
 		{
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index c4f63d9256abea12f031d4925b8d1493e765d7ee..0152571e20f67789366d0502bc944c874296e52d 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -820,6 +820,15 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 		body_message_params.font.style = "ITALIC";
 	}
 
+	if(chat.mChatType == CHAT_TYPE_WHISPER)
+	{
+		body_message_params.font.style = "ITALIC";
+	}
+	else if(chat.mChatType == CHAT_TYPE_SHOUT)
+	{
+		body_message_params.font.style = "BOLD";
+	}
+
 	bool message_from_log = chat.mChatStyle == CHAT_STYLE_HISTORY;
 	// We graying out chat history by graying out messages that contains full date in a time string
 	if (message_from_log)
diff --git a/indra/newview/llconversationlog.cpp b/indra/newview/llconversationlog.cpp
index 4be169e267fce543b6ce114527beb73d40470fb3..dd20ca15aebbad66e686c7b23cdd6bf6086825a0 100644
--- a/indra/newview/llconversationlog.cpp
+++ b/indra/newview/llconversationlog.cpp
@@ -28,9 +28,11 @@
 #include "llagent.h"
 #include "llavatarnamecache.h"
 #include "llconversationlog.h"
+#include "lldiriterator.h"
 #include "llnotificationsutil.h"
 #include "lltrans.h"
 
+#include <boost/foreach.hpp>
 #include "boost/lexical_cast.hpp"
 
 const int CONVERSATION_LIFETIME = 30; // lifetime of LLConversation is 30 days by spec
@@ -380,6 +382,36 @@ void LLConversationLog::cache()
 	}
 }
 
+void LLConversationLog::getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs)
+{
+	// get Users log directory
+	std::string dirname = gDirUtilp->getPerAccountChatLogsDir();
+
+	// add final OS dependent delimiter
+	dirname += gDirUtilp->getDirDelimiter();
+
+	// create search pattern
+	std::string pattern = "conversation.log.backup*";
+
+	LLDirIterator iter(dirname, pattern);
+	std::string filename;
+	while (iter.next(filename))
+	{
+		list_of_backup_logs.push_back(gDirUtilp->add(dirname, filename));
+	}
+}
+
+void LLConversationLog::deleteBackupLogs()
+{
+	std::vector<std::string> backup_logs;
+	getListOfBackupLogs(backup_logs);
+
+	BOOST_FOREACH(const std::string& fullpath, backup_logs)
+	{
+		LLFile::remove(fullpath);
+	}
+}
+
 bool LLConversationLog::moveLog(const std::string &originDirectory, const std::string &targetDirectory)
 {
 
@@ -575,5 +607,6 @@ void LLConversationLog::onClearLogResponse(const LLSD& notification, const LLSD&
 		mConversations.clear();
 		notifyObservers();
 		cache();
+		deleteBackupLogs();
 	}
 }
diff --git a/indra/newview/llconversationlog.h b/indra/newview/llconversationlog.h
index 58e698de25e32fa02fa61831b2b02d9a16bc5483..265b1f0ef04a0c74b492c2073acc1da315b87612 100644
--- a/indra/newview/llconversationlog.h
+++ b/indra/newview/llconversationlog.h
@@ -138,6 +138,8 @@ class LLConversationLog : public LLSingleton<LLConversationLog>, LLIMSessionObse
 	 */
 	void cache();
 	bool moveLog(const std::string &originDirectory, const std::string &targetDirectory);
+	void getListOfBackupLogs(std::vector<std::string>& list_of_backup_logs);
+	void deleteBackupLogs();
 
 	void onClearLog();
 	void onClearLogResponse(const LLSD& notification, const LLSD& response);
diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp
index 96b225b841a01d08f6bc5c0447e2efe41c956fbc..b202cfc9d3f46b1abac996f8ce69e573c7532bc7 100644
--- a/indra/newview/llconversationloglist.cpp
+++ b/indra/newview/llconversationloglist.cpp
@@ -198,6 +198,8 @@ void LLConversationLogList::refresh()
 
 void LLConversationLogList::rebuildList()
 {
+	const LLConversation * selected_conversationp = getSelectedConversation();
+
 	clear();
 
 	bool have_filter = !mNameFilter.empty();
@@ -214,7 +216,12 @@ void LLConversationLogList::rebuildList()
 
 		addNewItem(&*iter);
 	}
-	
+
+	// try to restore selection of item
+	if (NULL != selected_conversationp)
+	{
+		selectItemByUUID(selected_conversationp->getSessionID());
+	}
 
 	bool logging_enabled = log_instance.getIsLoggingEnabled();
 	bool log_empty = log_instance.isLogEmpty();
@@ -238,8 +245,16 @@ void LLConversationLogList::rebuildList()
 
 void LLConversationLogList::onCustomAction(const LLSD& userdata)
 {
+	const LLConversation * selected_conversationp = getSelectedConversation();
+
+	if (NULL == selected_conversationp)
+	{
+		return;
+	}
+
 	const std::string command_name = userdata.asString();
-	const LLUUID& selected_id = getSelectedConversation()->getParticipantID();
+	const LLUUID& selected_conversation_participant_id = selected_conversationp->getParticipantID();
+	const LLUUID& selected_conversation_session_id = selected_conversationp->getSessionID();
 	LLIMModel::LLIMSession::SType stype = getSelectedSessionType();
 
 	if ("im" == command_name)
@@ -247,11 +262,11 @@ void LLConversationLogList::onCustomAction(const LLSD& userdata)
 		switch (stype)
 		{
 		case LLIMModel::LLIMSession::P2P_SESSION:
-			LLAvatarActions::startIM(selected_id);
+			LLAvatarActions::startIM(selected_conversation_participant_id);
 			break;
 
 		case LLIMModel::LLIMSession::GROUP_SESSION:
-			LLGroupActions::startIM(getSelectedConversation()->getSessionID());
+			LLGroupActions::startIM(selected_conversation_session_id);
 			break;
 
 		default:
@@ -263,11 +278,11 @@ void LLConversationLogList::onCustomAction(const LLSD& userdata)
 		switch (stype)
 		{
 		case LLIMModel::LLIMSession::P2P_SESSION:
-			LLAvatarActions::startCall(selected_id);
+			LLAvatarActions::startCall(selected_conversation_participant_id);
 			break;
 
 		case LLIMModel::LLIMSession::GROUP_SESSION:
-			LLGroupActions::startCall(getSelectedConversation()->getSessionID());
+			LLGroupActions::startCall(selected_conversation_session_id);
 			break;
 
 		default:
@@ -279,11 +294,11 @@ void LLConversationLogList::onCustomAction(const LLSD& userdata)
 		switch (stype)
 		{
 		case LLIMModel::LLIMSession::P2P_SESSION:
-			LLAvatarActions::showProfile(selected_id);
+			LLAvatarActions::showProfile(selected_conversation_participant_id);
 			break;
 
 		case LLIMModel::LLIMSession::GROUP_SESSION:
-			LLGroupActions::show(getSelectedConversation()->getSessionID());
+			LLGroupActions::show(selected_conversation_session_id);
 			break;
 
 		default:
@@ -292,52 +307,53 @@ void LLConversationLogList::onCustomAction(const LLSD& userdata)
 	}
 	else if ("chat_history" == command_name)
 	{
-		const LLUUID& session_id = getSelectedConversation()->getSessionID();
-		LLFloaterReg::showInstance("preview_conversation", session_id, true);
+		LLFloaterReg::showInstance("preview_conversation", selected_conversation_session_id, true);
 	}
 	else if ("offer_teleport" == command_name)
 	{
-		LLAvatarActions::offerTeleport(selected_id);
+		LLAvatarActions::offerTeleport(selected_conversation_participant_id);
 	}
 	else if("add_friend" == command_name)
 	{
-		if (!LLAvatarActions::isFriend(selected_id))
+		if (!LLAvatarActions::isFriend(selected_conversation_participant_id))
 		{
-			LLAvatarActions::requestFriendshipDialog(selected_id);
+			LLAvatarActions::requestFriendshipDialog(selected_conversation_participant_id);
 		}
 	}
 	else if("remove_friend" == command_name)
 	{
-		if (LLAvatarActions::isFriend(selected_id))
+		if (LLAvatarActions::isFriend(selected_conversation_participant_id))
 		{
-			LLAvatarActions::removeFriendDialog(selected_id);
+			LLAvatarActions::removeFriendDialog(selected_conversation_participant_id);
 		}
 	}
 	else if ("invite_to_group" == command_name)
 	{
-		LLAvatarActions::inviteToGroup(selected_id);
+		LLAvatarActions::inviteToGroup(selected_conversation_participant_id);
 	}
 	else if ("show_on_map" == command_name)
 	{
-		LLAvatarActions::showOnMap(selected_id);
+		LLAvatarActions::showOnMap(selected_conversation_participant_id);
 	}
 	else if ("share" == command_name)
 	{
-		LLAvatarActions::share(selected_id);
+		LLAvatarActions::share(selected_conversation_participant_id);
 	}
 	else if ("pay" == command_name)
 	{
-		LLAvatarActions::pay(selected_id);
+		LLAvatarActions::pay(selected_conversation_participant_id);
 	}
 	else if ("block" == command_name)
 	{
-		LLAvatarActions::toggleBlock(selected_id);
+		LLAvatarActions::toggleBlock(selected_conversation_participant_id);
 	}
 }
 
 bool LLConversationLogList::isActionEnabled(const LLSD& userdata)
 {
-	if (numSelected() != 1)
+	const LLConversation * selected_conversationp = getSelectedConversation();
+
+	if (NULL == selected_conversationp || numSelected() > 1)
 	{
 		return false;
 	}
@@ -345,7 +361,7 @@ bool LLConversationLogList::isActionEnabled(const LLSD& userdata)
 	const std::string command_name = userdata.asString();
 
 	LLIMModel::LLIMSession::SType stype = getSelectedSessionType();
-	const LLUUID& selected_id = getSelectedConversation()->getParticipantID();
+	const LLUUID& selected_id = selected_conversationp->getParticipantID();
 
 	bool is_p2p   = LLIMModel::LLIMSession::P2P_SESSION == stype;
 	bool is_group = LLIMModel::LLIMSession::GROUP_SESSION == stype;
@@ -384,9 +400,16 @@ bool LLConversationLogList::isActionEnabled(const LLSD& userdata)
 
 bool LLConversationLogList::isActionChecked(const LLSD& userdata)
 {
+	const LLConversation * selected_conversationp = getSelectedConversation();
+
+	if (NULL == selected_conversationp)
+	{
+		return false;
+	}
+
 	const std::string command_name = userdata.asString();
 
-	const LLUUID& selected_id = getSelectedConversation()->getParticipantID();
+	const LLUUID& selected_id = selected_conversationp->getParticipantID();
 	bool is_p2p = LLIMModel::LLIMSession::P2P_SESSION == getSelectedSessionType();
 
 	if ("is_blocked" == command_name)
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
index 74b348cd81abc3b81751d56c4929b64648afb101..837389aed5eb365d831c9ae8ae0883ea27c6be3c 100755
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -104,6 +104,15 @@ LLConversationViewSession::~LLConversationViewSession()
 
 void LLConversationViewSession::setFlashState(bool flash_state)
 {
+	if (flash_state && !mFlashStateOn)
+	{
+		// flash chat toolbar button if scrolled out of sight (because flashing will not be visible)
+		if (mContainer->isScrolledOutOfSight(this))
+		{
+			gToolBarView->flashCommand(LLCommandId("chat"), true);
+		}
+	}
+
 	mFlashStateOn = flash_state;
 	mFlashStarted = false;
 	mFlashTimer->stopFlashing();
@@ -115,12 +124,6 @@ void LLConversationViewSession::startFlashing()
 	{
 		mFlashStarted = true;
 		mFlashTimer->startFlashing();
-		
-		// flash chat toolbar button if scrolled out of sight (because flashing will not be visible)
-		if (mContainer->isScrolledOutOfSight(this))
-		{
-			gToolBarView->flashCommand(LLCommandId("chat"), true);
-		}
 	}
 }
 
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 74490b695c6a2a6d250b82cd8a9d8729e9d0321d..7437dd8cda73f0b73f38597d73aa481e77633c40 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -226,10 +226,11 @@ BOOL LLFloaterIMContainer::postBuild()
 	childSetAction("add_btn", boost::bind(&LLFloaterIMContainer::onAddButtonClicked, this));
 
 	collapseMessagesPane(gSavedPerAccountSettings.getBOOL("ConversationsMessagePaneCollapsed"));
-	collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed"));
+	collapseConversationsPane(gSavedPerAccountSettings.getBOOL("ConversationsListPaneCollapsed"), false);
 	LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLFloaterIMSessionTab::processChatHistoryStyleUpdate, false));
 	mMicroChangedSignal = LLVoiceClient::getInstance()->MicroChangedCallback(boost::bind(&LLFloaterIMContainer::updateSpeakBtnState, this));
-	if (! mMessagesPane->isCollapsed())
+
+	if (! mMessagesPane->isCollapsed() && ! mConversationsPane->isCollapsed())
 	{
 		S32 conversations_panel_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth");
 		LLRect conversations_panel_rect = mConversationsPane->getRect();
@@ -668,7 +669,7 @@ void LLFloaterIMContainer::collapseMessagesPane(bool collapse)
 	// Make sure layout is updated before resizing conversation pane.
 	mConversationsStack->updateLayout();
 
-	updateState(collapse, gSavedPerAccountSettings.getS32("ConversationsMessagePaneWidth"));
+	reshapeFloaterAndSetResizeLimits(collapse, gSavedPerAccountSettings.getS32("ConversationsMessagePaneWidth"));
 
 	if (!collapse)
 	{
@@ -677,7 +678,7 @@ void LLFloaterIMContainer::collapseMessagesPane(bool collapse)
 	}
 }
 
-void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
+void LLFloaterIMContainer::collapseConversationsPane(bool collapse, bool save_is_allowed /*=true*/)
 {
 	if (mConversationsPane->isCollapsed() == collapse)
 	{
@@ -691,7 +692,7 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
 	// Save current width of Conversation panel before collapsing/expanding right pane.
 	S32 conv_pane_width = mConversationsPane->getRect().getWidth();
 
-	if (collapse)
+	if (collapse && save_is_allowed)
 	{
 		// Save the conversations pane width before collapsing it.
 		gSavedPerAccountSettings.setS32("ConversationsListPaneWidth", conv_pane_width);
@@ -701,10 +702,18 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
 	}
 
 	mConversationsStack->collapsePanel(mConversationsPane, collapse);
+	if (!collapse)
+	{
+		// Make sure layout is updated before resizing conversation pane.
+		mConversationsStack->updateLayout();
+		// Restore conversation's pane previous width.
+		mConversationsPane->setTargetDim(gSavedPerAccountSettings.getS32("ConversationsListPaneWidth"));
+	}
 
-	S32 delta_width = gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") - mConversationsPane->getMinDim();
+	S32 delta_width =
+			gSavedPerAccountSettings.getS32("ConversationsListPaneWidth") - mConversationsPane->getMinDim();
 
-	updateState(collapse, delta_width);
+	reshapeFloaterAndSetResizeLimits(collapse, delta_width);
 
 	for (conversations_widgets_map::iterator widget_it = mConversationsWidgets.begin();
 			widget_it != mConversationsWidgets.end(); ++widget_it)
@@ -724,21 +733,20 @@ void LLFloaterIMContainer::collapseConversationsPane(bool collapse)
 	}
 }
 
-void LLFloaterIMContainer::updateState(bool collapse, S32 delta_width)
+void LLFloaterIMContainer::reshapeFloaterAndSetResizeLimits(bool collapse, S32 delta_width)
 {
 	LLRect floater_rect = getRect();
 	floater_rect.mRight += ((collapse ? -1 : 1) * delta_width);
 
 	// Set by_user = true so that reshaped rect is saved in user_settings.
 	setShape(floater_rect, true);
-
 	updateResizeLimits();
 
-	bool is_left_pane_expanded = !mConversationsPane->isCollapsed();
-	bool is_right_pane_expanded = !mMessagesPane->isCollapsed();
+	bool at_least_one_panel_is_expanded =
+			! (mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed());
 
-	setCanResize(is_left_pane_expanded || is_right_pane_expanded);
-	setCanMinimize(is_left_pane_expanded || is_right_pane_expanded);
+	setCanResize(at_least_one_panel_is_expanded);
+	setCanMinimize(at_least_one_panel_is_expanded);
 
     assignResizeLimits();
 
@@ -767,15 +775,9 @@ void LLFloaterIMContainer::assignResizeLimits()
 	S32 msg_pane_min_width  = is_msg_pane_expanded ? mMessagesPane->getExpandedMinDim() : 0;
 	S32 new_min_width = conv_pane_target_width + msg_pane_min_width + summary_width_of_visible_borders;
 
-    if (is_conv_pane_expanded)
-    {
-    	// Save the conversations pane width.
-	    gSavedPerAccountSettings.setS32(
-	            "ConversationsListPaneWidth",
-                mConversationsPane->getRect().getWidth());
-    }
-
 	setResizeLimits(new_min_width, getMinHeight());
+
+	mConversationsStack->updateLayout();
 }
 
 void LLFloaterIMContainer::onAddButtonClicked()
@@ -1403,6 +1405,10 @@ BOOL LLFloaterIMContainer::selectConversationPair(const LLUUID& session_id, bool
 				// Switch to the conversation floater that is being selected
 				selectFloater(session_floater);
 			}
+			else
+			{
+				showStub(true);
+			}
 		}
 
 		// Set the focus on the selected floater
@@ -1881,6 +1887,9 @@ bool LLFloaterIMContainer::isScrolledOutOfSight(LLConversationViewSession* conve
 {
 	llassert(conversation_item_widget != NULL);
 
+	// make sure the widget is actually in the right spot first
+	mConversationsRoot->arrange(NULL, NULL);
+
 	// check whether the widget is in the visible portion of the scroll container
 	LLRect widget_rect;
 	conversation_item_widget->localRectToOtherView(conversation_item_widget->getLocalRect(), &widget_rect, mConversationsRoot);
@@ -1908,7 +1917,19 @@ BOOL LLFloaterIMContainer::handleKeyHere(KEY key, MASK mask )
 	return TRUE;
 }
 
-bool LLFloaterIMContainer::selectNextorPreviousConversation(bool select_next)
+bool LLFloaterIMContainer::selectAdjacentConversation(bool focus_selected)
+{
+	bool selectedAdjacentConversation = selectNextorPreviousConversation(true, focus_selected);
+
+	if(!selectedAdjacentConversation)
+	{
+		selectedAdjacentConversation = selectNextorPreviousConversation(false, focus_selected);
+	}
+
+	return selectedAdjacentConversation;
+}
+
+bool LLFloaterIMContainer::selectNextorPreviousConversation(bool select_next, bool focus_selected)
 {
 	if (mConversationsWidgets.size() > 1)
 	{
@@ -1929,12 +1950,7 @@ bool LLFloaterIMContainer::selectNextorPreviousConversation(bool select_next)
 				LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem());
 				if (vmi)
 				{
-					selectConversationPair(vmi->getUUID(), true);
-					LLFloater* floaterp = get_ptr_in_map(mSessions, getSelectedSession());
-					if(floaterp && !floaterp->isTornOff())
-					{
-						setFocus(TRUE);
-					}
+					selectConversationPair(vmi->getUUID(), true, focus_selected);
 					return true;
 				}
 			}
@@ -1958,11 +1974,6 @@ void LLFloaterIMContainer::closeFloater(bool app_quitting/* = false*/)
 	// Most of the time the user will never see this state.
 	setMinimized(FALSE);
 
-	// Save the conversations pane width.
-	gSavedPerAccountSettings.setS32(
-			"ConversationsListPaneWidth",
-			mConversationsPane->getRect().getWidth());
-
 	LLFloater::closeFloater(app_quitting);
 }
 
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index c84d4978ecd7572390618476850de67241b39b33..5139651d8d0b8b4458883f57610e2283dbb3c11c 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -72,7 +72,8 @@ class LLFloaterIMContainer
 	void selectNextConversationByID(const LLUUID& session_id);
     BOOL selectConversationPair(const LLUUID& session_id, bool select_widget, bool focus_floater = true);
     void clearAllFlashStates();
-    bool selectNextorPreviousConversation(bool select_next);
+	bool selectAdjacentConversation(bool focus_selected);
+    bool selectNextorPreviousConversation(bool select_next, bool focus_selected = true);
     void expandConversation();
 
 	/*virtual*/ void tabClose();
@@ -128,9 +129,9 @@ class LLFloaterIMContainer
 	void processParticipantsStyleUpdate();
 	void onSpeakButtonClicked();
 
-	void collapseConversationsPane(bool collapse);
+	void collapseConversationsPane(bool collapse, bool save_is_allowed=true);
 
-	void updateState(bool collapse, S32 delta_width);
+	void reshapeFloaterAndSetResizeLimits(bool collapse, S32 delta_width);
 
 	void onAddButtonClicked();
 	void onAvatarPicked(const uuid_vec_t& ids);
diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index dfaf4bbdd60173592ef50486aa8ec831182f9d00..cfee5001a6d30e9348681fb9edc1deee7402fc80 100644
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -257,6 +257,17 @@ void LLFloaterIMNearbyChat::setVisible(BOOL visible)
 	}
 }
 
+
+void LLFloaterIMNearbyChat::setVisibleAndFrontmost(BOOL take_focus, const LLSD& key)
+{
+	LLFloaterIMSessionTab::setVisibleAndFrontmost(take_focus, key);
+
+	if(!isTornOff() && matchesKey(key))
+	{
+		LLFloaterIMContainer::getInstance()->selectConversationPair(mSessionID, true, false);
+	}
+}
+
 // virtual
 void LLFloaterIMNearbyChat::onTearOffClicked()
 {
diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h
index 4ad37eb0c7395f06ce5484faa03aa31df370f117..05b48cccb03657a2b3e7f646f04cdc9225eec7c9 100644
--- a/indra/newview/llfloaterimnearbychat.h
+++ b/indra/newview/llfloaterimnearbychat.h
@@ -54,6 +54,7 @@ class LLFloaterIMNearbyChat
 	/*virtual*/ void onOpen(const LLSD& key);
 	/*virtual*/ void onClose(bool app_quitting);
 	/*virtual*/ void setVisible(BOOL visible);
+	/*virtual*/ void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD());
 	/*virtual*/ void closeHostedFloater();
 
 	void loadHistory();
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index d3fcfbbc56143b794c721afd3e1b88b4c6926863..faeb8607128833710b63021e45a0cad2350ab9db 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -324,13 +324,6 @@ void LLFloaterIMSessionTab::onFocusReceived()
 	}
 
 	LLTransientDockableFloater::onFocusReceived();
-
-	LLFloaterIMContainer* container = LLFloaterReg::findTypedInstance<LLFloaterIMContainer>("im_container");
-	if (container)
-	{
-		container->selectConversationPair(mSessionID, true);
-		container->showStub(! getHost());
-	}
 }
 
 void LLFloaterIMSessionTab::onFocusLost()
@@ -801,10 +794,18 @@ void LLFloaterIMSessionTab::onTearOffClicked()
     mSaveRect = isTornOff();
     initRectControl();
 	LLFloater::onClickTearOff(this);
+	LLFloaterIMContainer* container = LLFloaterReg::findTypedInstance<LLFloaterIMContainer>("im_container");
+
 	if (isTornOff())
 	{
+		container->selectAdjacentConversation(false);
 		forceReshape();
 	}
+	//Upon re-docking the torn off floater, select the corresponding conversation line item
+	else
+	{
+		container->selectConversation(mSessionID);
+	}
 	refreshConversation();
 	updateGearBtn();
 }
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 3f8c23ba83b7ef3758235ad18f6828edb27961e2..b308a820b2e1c5b26c42065c1a8781383b1efdb1 100755
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -1667,7 +1667,10 @@ void LLFloaterPreference::onClickActionChange()
 
 void LLFloaterPreference::onDeleteTranscripts()
 {
-	LLNotificationsUtil::add("PreferenceChatDeleteTranscripts", LLSD(), LLSD(), boost::bind(&LLFloaterPreference::onDeleteTranscriptsResponse, this, _1, _2));
+	LLSD args;
+	args["FOLDER"] = gDirUtilp->getUserName();
+
+	LLNotificationsUtil::add("PreferenceChatDeleteTranscripts", args, LLSD(), boost::bind(&LLFloaterPreference::onDeleteTranscriptsResponse, this, _1, _2));
 }
 
 void LLFloaterPreference::onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response)
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index 448100c5d62b94946b931b6b43ba142b81bd784c..2d7454b636b2254b512c3907ff9debf80285fc26 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -444,7 +444,7 @@ std::string LLLogChat::oldLogFileName(std::string filename)
 }
 
 // static
-void LLLogChat::getListOfTranscriptFiles(std::vector<std::string>& list_of_transcriptions)
+void LLLogChat::findTranscriptFiles(std::string pattern, std::vector<std::string>& list_of_transcriptions)
 {
 	// get Users log directory
 	std::string dirname = gDirUtilp->getPerAccountChatLogsDir();
@@ -452,9 +452,6 @@ void LLLogChat::getListOfTranscriptFiles(std::vector<std::string>& list_of_trans
 	// add final OS dependent delimiter
 	dirname += gDirUtilp->getDirDelimiter();
 
-	// create search pattern
-	std::string pattern = "*." + LL_TRANSCRIPT_FILE_EXTENSION;
-
 	LLDirIterator iter(dirname, pattern);
 	std::string filename;
 	while (iter.next(filename))
@@ -490,6 +487,22 @@ void LLLogChat::getListOfTranscriptFiles(std::vector<std::string>& list_of_trans
 	}
 }
 
+// static
+void LLLogChat::getListOfTranscriptFiles(std::vector<std::string>& list_of_transcriptions)
+{
+	// create search pattern
+	std::string pattern = "*." + LL_TRANSCRIPT_FILE_EXTENSION;
+	findTranscriptFiles(pattern, list_of_transcriptions);
+}
+
+// static
+void LLLogChat::getListOfTranscriptBackupFiles(std::vector<std::string>& list_of_transcriptions)
+{
+	// create search pattern
+	std::string pattern = "*." + LL_TRANSCRIPT_FILE_EXTENSION + ".backup*";
+	findTranscriptFiles(pattern, list_of_transcriptions);
+}
+
 //static
 boost::signals2::connection LLLogChat::setSaveHistorySignal(const save_history_signal_t::slot_type& cb)
 {
@@ -581,6 +594,7 @@ void LLLogChat::deleteTranscripts()
 {
 	std::vector<std::string> list_of_transcriptions;
 	getListOfTranscriptFiles(list_of_transcriptions);
+	getListOfTranscriptBackupFiles(list_of_transcriptions);
 
 	BOOST_FOREACH(const std::string& fullpath, list_of_transcriptions)
 	{
diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h
index 784786a5650b1a4f281bf36d6f2f19427a3b4f6b..e819f00dd9c5f6e3cea756a24ddcc3c521fe2995 100644
--- a/indra/newview/lllogchat.h
+++ b/indra/newview/lllogchat.h
@@ -49,7 +49,9 @@ class LLLogChat
 				const std::string& from,
 				const LLUUID& from_id,
 				const std::string& line);
+	static void findTranscriptFiles(std::string pattern, std::vector<std::string>& list_of_transcriptions);
 	static void getListOfTranscriptFiles(std::vector<std::string>& list);
+	static void getListOfTranscriptBackupFiles(std::vector<std::string>& list_of_transcriptions);
 
 	static void loadChatHistory(const std::string& file_name, std::list<LLSD>& messages, const LLSD& load_params = LLSD());
 
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 157be08f45278c2223149f022d8c8677fae1dd6d..c74d9f1292c6d017f7bb1b43b26fb7228ac2fb4c 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2994,43 +2994,43 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
 		return;
 	}
 
-		BOOL new_name = FALSE;
-		if (visible_chat != mVisibleChat)
+	BOOL new_name = FALSE;
+	if (visible_chat != mVisibleChat)
+	{
+		mVisibleChat = visible_chat;
+		new_name = TRUE;
+	}
+
+	if (sRenderGroupTitles != mRenderGroupTitles)
+	{
+		mRenderGroupTitles = sRenderGroupTitles;
+		new_name = TRUE;
+	}
+
+	// First Calculate Alpha
+	// If alpha > 0, create mNameText if necessary, otherwise delete it
+	F32 alpha = 0.f;
+	if (mAppAngle > 5.f)
+	{
+		const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION;
+		if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME)
 		{
-			mVisibleChat = visible_chat;
-			new_name = TRUE;
+			alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION;
 		}
-		
-		if (sRenderGroupTitles != mRenderGroupTitles)
+		else
 		{
-			mRenderGroupTitles = sRenderGroupTitles;
-			new_name = TRUE;
+			// ...not fading, full alpha
+			alpha = 1.f;
 		}
-
-		// First Calculate Alpha
-		// If alpha > 0, create mNameText if necessary, otherwise delete it
-			F32 alpha = 0.f;
-			if (mAppAngle > 5.f)
-			{
-				const F32 START_FADE_TIME = NAME_SHOW_TIME - FADE_DURATION;
-				if (!visible_chat && sRenderName == RENDER_NAME_FADE && time_visible > START_FADE_TIME)
-				{
-					alpha = 1.f - (time_visible - START_FADE_TIME) / FADE_DURATION;
-				}
-				else
-				{
-					// ...not fading, full alpha
-					alpha = 1.f;
-				}
-			}
-			else if (mAppAngle > 2.f)
-			{
-				// far away is faded out also
-				alpha = (mAppAngle-2.f)/3.f;
-			}
+	}
+	else if (mAppAngle > 2.f)
+	{
+		// far away is faded out also
+		alpha = (mAppAngle-2.f)/3.f;
+	}
 
 	if (alpha <= 0.f)
-			{
+	{
 		if (mNameText)
 		{
 			mNameText->markDead();
@@ -3040,19 +3040,19 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
 		return;
 	}
 
-				if (!mNameText)
-				{
+	if (!mNameText)
+	{
 		mNameText = static_cast<LLHUDNameTag*>( LLHUDObject::addHUDObject(
 			LLHUDObject::LL_HUD_NAME_TAG) );
 		//mNameText->setMass(10.f);
-					mNameText->setSourceObject(this);
+		mNameText->setSourceObject(this);
 		mNameText->setVertAlignment(LLHUDNameTag::ALIGN_VERT_TOP);
-					mNameText->setVisibleOffScreen(TRUE);
-					mNameText->setMaxLines(11);
-					mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f);
-					sNumVisibleChatBubbles++;
-					new_name = TRUE;
-				}
+		mNameText->setVisibleOffScreen(TRUE);
+		mNameText->setMaxLines(11);
+		mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f);
+		sNumVisibleChatBubbles++;
+		new_name = TRUE;
+    }
 				
 	idleUpdateNameTagPosition(root_pos_last);
 	idleUpdateNameTagText(new_name);			
@@ -3303,6 +3303,7 @@ void LLVOAvatar::clearNameTag()
 		mNameText->setLabel("");
 		mNameText->setString( "" );
 	}
+	mTimeVisible.reset();
 }
 
 //static
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 88c02fc84edccd4761e4770891d5d2213381d171..c681e3900235ed5ea02241bbae5bd7816b96c523 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -9998,7 +9998,7 @@ Cannot create large prims that intersect other players.  Please re-try when othe
    icon="alertmodal.tga"
    name="PreferenceChatClearLog"
    type="alertmodal">
-    This will delete the log of previous conversations. Proceed?
+    This will delete the logs of previous conversations, and any backups of that file.
     <tag>confirm</tag>
     <usetemplate
      ignoretext="Confirm before I delete the log of previous conversations."
@@ -10011,7 +10011,7 @@ Cannot create large prims that intersect other players.  Please re-try when othe
    icon="alertmodal.tga"
    name="PreferenceChatDeleteTranscripts"
    type="alertmodal">
-    This will delete transcripts for all previous conversations. The list of conversations will not be affected. If you run scripts on your chat transcript files, you may want to proceed with caution. Proceed?
+    This will delete the transcripts for all previous conversations. The list of past conversations will not be affected. All files with the suffixes .txt and txt.backup in the folder [FOLDER] will be deleted.
     <tag>confirm</tag>
     <usetemplate
      ignoretext="Confirm before I delete transcripts."