From 16a5c9346d04f20c536e9034947873f1202eb32e Mon Sep 17 00:00:00 2001
From: Mnikolenko ProductEngine <mnikolenko@productengine.com>
Date: Tue, 20 May 2014 11:34:24 +0300
Subject: [PATCH] MAINT-3064 FIXED Select next session in the list if selected
 session is nearby chat and it's not the only one.

---
 indra/newview/llviewermenu.cpp                | 23 +++++++++++++++++++
 .../skins/default/xui/en/menu_viewer.xml      | 12 ++++++----
 2 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 1daa85176ac..aef8bc21ec6 100755
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -64,6 +64,7 @@
 #include "llfloaterinventory.h"
 #include "llfloaterimcontainer.h"
 #include "llfloaterland.h"
+#include "llfloaterimnearbychat.h"
 #include "llfloaterpathfindingcharacters.h"
 #include "llfloaterpathfindinglinksets.h"
 #include "llfloaterpay.h"
@@ -5660,6 +5661,25 @@ void toggle_debug_menus(void*)
 // 	gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects...");
 // }
 //
+
+class LLCommunicateNearbyChat : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		LLFloaterIMContainer* im_box = LLFloaterIMContainer::getInstance();
+		bool nearby_visible	= LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat")->isInVisibleChain();
+		if(nearby_visible && im_box->getSelectedSession() == LLUUID() && im_box->getConversationListItemSize() > 1)
+		{
+			im_box->selectNextorPreviousConversation(false);
+		}
+		else
+		{
+			LLFloaterReg::toggleInstanceOrBringToFront("nearby_chat");
+		}
+		return true;
+	}
+};
+
 class LLWorldSetHomeLocation : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
@@ -8577,6 +8597,9 @@ void initialize_menus()
 	// Me > Movement
 	view_listener_t::addMenu(new LLAdvancedAgentFlyingInfo(), "Agent.getFlying");
 
+	//Communicate Nearby chat
+	view_listener_t::addMenu(new LLCommunicateNearbyChat(), "Communicate.NearbyChat");
+
 	// Communicate > Voice morphing > Subscribe...
 	commit.add("Communicate.VoiceMorphing.Subscribe", boost::bind(&handle_voice_morphing_subscribe));
 	LLVivoxVoiceClient * voice_clientp = LLVivoxVoiceClient::getInstance();
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index b1c1b236f08..acec0176222 100755
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -259,8 +259,7 @@
              function="Floater.Visible"
              parameter="nearby_chat" />
             <menu_item_check.on_click
-             function="Floater.ToggleOrBringToFront"
-             parameter="nearby_chat" />
+             function="Communicate.NearbyChat"/>
         </menu_item_check>
         <menu_item_check
          label="Speak"
@@ -363,13 +362,16 @@
               function="SideTray.PanelPeopleTab"
               parameter="nearby_panel" />
         </menu_item_check>
-        <menu_item_call
+        <menu_item_check
          label="Block List"
          name="Block List">
-            <menu_item_call.on_click
+            <menu_item_check.on_check
+             function="SideTray.CheckPanelPeopleTab"
+             parameter="blocked_panel" />
+            <menu_item_check.on_click
               function="SideTray.PanelPeopleTab"
               parameter="blocked_panel" />
-        </menu_item_call>
+        </menu_item_check>
       <menu_item_separator/>
       <menu_item_check
        name="Do Not Disturb"
-- 
GitLab