From 33af464c441717db855651b70acc4b3636c649a0 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Wed, 28 Oct 2009 14:21:36 +0200
Subject: Implemented major sub-task EXT-1904 (New IM floater should handle
 Session Update)

--HG--
branch : product-engine
---
 indra/newview/llimfloater.cpp                  | 24 ++++++++++++++++++++++++
 indra/newview/llimfloater.h                    |  1 +
 indra/newview/llimview.cpp                     | 17 ++++++++++++++++-
 indra/newview/skins/default/xui/en/strings.xml |  2 ++
 4 files changed, 43 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 9e92e2f490..b8b0290b18 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -562,6 +562,30 @@ void LLIMFloater::processIMTyping(const LLIMInfo* im_info, BOOL typing)
 	}
 }
 
+void LLIMFloater::processSessionUpdate(const LLSD& session_update)
+{
+	// *TODO : verify following code when moderated mode will be implemented
+	if ( false && session_update.has("moderated_mode") &&
+		 session_update["moderated_mode"].has("voice") )
+	{
+		BOOL voice_moderated = session_update["moderated_mode"]["voice"];
+		const std::string session_label = LLIMModel::instance().getName(mSessionID);
+
+		if (voice_moderated)
+		{
+			setTitle(session_label + std::string(" ") + LLTrans::getString("IM_moderated_chat_label"));
+		}
+		else
+		{
+			setTitle(session_label);
+		}
+
+		// *TODO : uncomment this when/if LLPanelActiveSpeakers panel will be added
+		//update the speakers dropdown too
+		//mSpeakerPanel->setVoiceModerationCtrlMode(voice_moderated);
+	}
+}
+
 void LLIMFloater::addTypingIndicator(const LLIMInfo* im_info)
 {
 	// We may have lost a "stop-typing" packet, don't add it twice
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 3559e14c89..4097f11f56 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -88,6 +88,7 @@ public:
 
 	void onVisibilityChange(const LLSD& new_visibility);
 	void processIMTyping(const LLIMInfo* im_info, BOOL typing);
+	void processSessionUpdate(const LLSD& session_update);
 
 private:
 	// process focus events to set a currently active session
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 2e5e23c845..a716145590 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -2120,6 +2120,15 @@ public:
 				}
 			}
 
+			LLIMFloater* im_floater = LLIMFloater::findInstance(session_id);
+			if ( im_floater )
+			{
+				if ( body.has("session_info") )
+				{
+					im_floater->processSessionUpdate(body["session_info"]);
+				}
+			}
+
 			gIMMgr->clearPendingAgentListUpdates(session_id);
 		}
 		else
@@ -2217,11 +2226,17 @@ public:
 		const LLSD& context,
 		const LLSD& input) const
 	{
-		LLFloaterIMPanel* floaterp = gIMMgr->findFloaterBySession(input["body"]["session_id"].asUUID());
+		LLUUID session_id = input["body"]["session_id"].asUUID();
+		LLFloaterIMPanel* floaterp = gIMMgr->findFloaterBySession(session_id);
 		if (floaterp)
 		{
 			floaterp->processSessionUpdate(input["body"]["info"]);
 		}
+		LLIMFloater* im_floater = LLIMFloater::findInstance(session_id);
+		if ( im_floater )
+		{
+			im_floater->processSessionUpdate(input["body"]["info"]);
+		}
 	}
 };
 
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 7efda2b882..7e9585d4bd 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -2884,6 +2884,8 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 	<string name="IM_logging_string">-- Instant message logging enabled --</string>
 	<string name="IM_typing_start_string">[NAME] is typing...</string>
 	<string name="Unnamed">(Unnamed)</string>
+	<string name="IM_moderated_chat_label">(Moderated: Voices off by default)</string>
+
 
   <string name="ringing-im">
     Joining Voice Chat...
-- 
cgit v1.2.3