diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp
index 257ec082a5689fa2656685a4d94f5a1ae9fa2d69..94be9055bd4d604465258cfecc53b93bac23da0e 100644
--- a/indra/newview/llconversationloglist.cpp
+++ b/indra/newview/llconversationloglist.cpp
@@ -241,15 +241,18 @@ void LLConversationLogList::onCustomAction(const LLSD& userdata)
 	{
 		LLAvatarActions::offerTeleport(selected_id);
 	}
-	else if("add_rem_friend" == command_name)
+	else if("add_friend" == command_name)
 	{
-		if (LLAvatarActions::isFriend(selected_id))
+		if (!LLAvatarActions::isFriend(selected_id))
 		{
-			LLAvatarActions::removeFriendDialog(selected_id);
+			LLAvatarActions::requestFriendshipDialog(selected_id);
 		}
-		else
+	}
+	else if("remove_friend" == command_name)
+	{
+		if (LLAvatarActions::isFriend(selected_id))
 		{
-			LLAvatarActions::requestFriendshipDialog(selected_id);
+			LLAvatarActions::removeFriendDialog(selected_id);
 		}
 	}
 	else if ("invite_to_group" == command_name)
@@ -336,6 +339,10 @@ bool LLConversationLogList::isActionChecked(const LLSD& userdata)
 	{
 		return is_p2p && LLAvatarActions::isFriend(selected_id);
 	}
+	else if ("is_not_friend" == command_name)
+	{
+		return is_p2p && !LLAvatarActions::isFriend(selected_id);
+	}
 
 	return false;
 }
diff --git a/indra/newview/llfloaterconversationlog.cpp b/indra/newview/llfloaterconversationlog.cpp
index c77a9e74bb23bf493f8476cd1fe371a58aba914e..4375ce57267a1f24a48cd5154633348c1f6d922f 100644
--- a/indra/newview/llfloaterconversationlog.cpp
+++ b/indra/newview/llfloaterconversationlog.cpp
@@ -28,6 +28,7 @@
 #include "llconversationloglist.h"
 #include "llfiltereditor.h"
 #include "llfloaterconversationlog.h"
+#include "llfloaterreg.h"
 #include "llmenubutton.h"
 
 LLFloaterConversationLog::LLFloaterConversationLog(const LLSD& key)
@@ -97,6 +98,10 @@ void LLFloaterConversationLog::onCustomAction (const LLSD& userdata)
 	{
 		mConversationLogList->toggleSortFriendsOnTop();
 	}
+	else if ("view_nearby_chat_history" == command_name)
+	{
+		LLFloaterReg::showInstance("preview_conversation", LLSD(LLUUID::null), true);
+	}
 }
 
 bool LLFloaterConversationLog::isActionEnabled(const LLSD& userdata)
diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp
index ae6f1441eb0afd37b5d240cfe9a61f11f828a96d..7083fb987d0f66e464bd631225a24083d0e5e370 100644
--- a/indra/newview/llfloaterconversationpreview.cpp
+++ b/indra/newview/llfloaterconversationpreview.cpp
@@ -29,6 +29,7 @@
 #include "llfloaterconversationpreview.h"
 #include "llimview.h"
 #include "lllineeditor.h"
+#include "lltrans.h"
 
 LLFloaterConversationPreview::LLFloaterConversationPreview(const LLSD& session_id)
 :	LLFloater(session_id),
@@ -44,20 +45,28 @@ BOOL LLFloaterConversationPreview::postBuild()
 	getChild<LLUICtrl>("more_history")->setCommitCallback(boost::bind(&LLFloaterConversationPreview::onMoreHistoryBtnClick, this));
 
 	const LLConversation* conv = LLConversationLog::instance().getConversation(mSessionID);
-	if (conv)
-	{
-		std::string name = conv->getConversationName();
-		LLStringUtil::format_map_t args;
-		args["[NAME]"] = name;
-		std::string title = getString("Title", args);
-		setTitle(title);
+	std::string name;
+	std::string file;
 
-		getChild<LLLineEditor>("description")->setValue(name);
+	if (mSessionID != LLUUID::null && conv)
+	{
+		name = conv->getConversationName();
+		file = conv->getHistoryFileName();
+	}
+	else
+	{
+		name = LLTrans::getString("NearbyChatTitle");
+		file = "chat";
 	}
 
-	std::string file = conv->getHistoryFileName();
-	LLLogChat::loadChatHistory(file, mMessages, true);
+	LLStringUtil::format_map_t args;
+	args["[NAME]"] = name;
+	std::string title = getString("Title", args);
+	setTitle(title);
+
+	getChild<LLLineEditor>("description")->setValue(name);
 
+	LLLogChat::loadChatHistory(file, mMessages, true);
 	mCurrentPage = mMessages.size() / mPageSize;
 
 	return LLFloater::postBuild();
@@ -68,7 +77,7 @@ void LLFloaterConversationPreview::draw()
 	LLFloater::draw();
 }
 
-void LLFloaterConversationPreview::onOpen(const LLSD& session_id)
+void LLFloaterConversationPreview::onOpen(const LLSD& key)
 {
 	showHistory();
 }
@@ -88,13 +97,8 @@ void LLFloaterConversationPreview::showHistory()
 	int delta = 0;
 	if (mCurrentPage)
 	{
-		// stinson 08/28/2012 : This operation could be simplified using integer math with the mod (%) operator.
-		//                      e.g. The following code should give the same output.
-		//                           int remainder = mMessages.size() % mPageSize;
-		//                           delta = (remainder == 0) ? 0 : (mPageSize - remainder);
-		//                      Though without examining further, the remainder might be a more appropriate value.
-		double num_of_pages = static_cast<double>(mMessages.size()) / static_cast<double>(mPageSize);
-		delta = static_cast<int>((ceil(num_of_pages) - num_of_pages) * static_cast<double>(mPageSize));
+		int remainder = mMessages.size() % mPageSize;
+		delta = (remainder == 0) ? 0 : (mPageSize - remainder);
 	}
 
 	std::advance(iter, (mCurrentPage * mPageSize) - delta);
diff --git a/indra/newview/llfloaterconversationpreview.h b/indra/newview/llfloaterconversationpreview.h
index 5105ef3702df61e506853eba72d8d9f944000df1..2246a44761384c96f9c9aed72b3ffc85cf8d08a5 100644
--- a/indra/newview/llfloaterconversationpreview.h
+++ b/indra/newview/llfloaterconversationpreview.h
@@ -39,7 +39,7 @@ class LLFloaterConversationPreview : public LLFloater
 	virtual BOOL postBuild();
 
 	virtual void draw();
-	virtual void onOpen(const LLSD& session_id);
+	virtual void onOpen(const LLSD& key);
 
 private:
 	void onMoreHistoryBtnClick();
diff --git a/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml b/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml
index b8d0eef956de1dde6f1512ea864b4de118454f9e..8796b87955fb99aa096cebd76fec0bf38118fed6 100644
--- a/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_conversation_log_gear.xml
@@ -57,20 +57,28 @@
       parameter="can_offer_teleport"/>
     </menu_item_call>
     <menu_item_separator />
-    <menu_item_check
-     label="Add friend/Remove friend"
+    <menu_item_call
+     label="Add Friend"
      layout="topleft"
-     name="Friend_add_remove">
-        <menu_item_check.on_click
+     name="add_friend">
+        <on_click
          function="Calllog.Action"
-         parameter="add_rem_friend" />
-        <menu_item_check.on_check
+         parameter="add_friend"/>
+        <on_visible
+         function="Calllog.Check"
+         parameter="is_not_friend" />
+    </menu_item_call>
+    <menu_item_call
+     label="Remove Friend"
+     layout="topleft"
+     name="remove_friend">
+        <on_click
+         function="Calllog.Action"
+         parameter="remove_friend"/>
+        <on_visible
          function="Calllog.Check"
          parameter="is_friend" />
-        <menu_item_check.on_enable
-         function="Calllog.Enable"
-         parameter="add_rem_friend" />
-    </menu_item_check>
+    </menu_item_call>
     <menu_item_call
      label="Invite to group..."
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/menu_conversation_log_view.xml b/indra/newview/skins/default/xui/en/menu_conversation_log_view.xml
index 4ab8cb4f7d0610c946fe54de26ad198ba3d4af8b..ce65b23971a28e593031a063c9689099718638b0 100644
--- a/indra/newview/skins/default/xui/en/menu_conversation_log_view.xml
+++ b/indra/newview/skins/default/xui/en/menu_conversation_log_view.xml
@@ -34,4 +34,12 @@
        function="CallLog.Check"
        parameter="sort_friends_on_top" />
   </menu_item_check>
+  <menu_item_separator />
+  <menu_item_call
+   label="View Nearby chat history..."
+   name="view_nearby_chat_history">
+      <on_click
+       function="CallLog.Action"
+       parameter="view_nearby_chat_history" />
+  </menu_item_call>
 </toggleable_menu>