From ae464867e6714816cd5bdaeecdd1d3c0a0817e58 Mon Sep 17 00:00:00 2001
From: Jon Wolk <jwolk@lindenlab.com>
Date: Tue, 15 Jul 2008 00:41:08 +0000
Subject: [PATCH] svn merge -r 90938:92097
 svn+ssh://svn.lindenlab.com/svn/linden/branches/qar-730/qar-730-merge ->
 release.  This is for QAR-730: Combination merge of QAR-432 and QAR-601

---
 indra/llcommon/llsdutil.cpp        |  5 +++--
 indra/llcommon/llsdutil.h          |  4 +++-
 indra/llcommon/lluuid.cpp          |  2 +-
 indra/llcommon/roles_constants.h   | 10 ++++++++++
 indra/llinventory/llparcel.cpp     |  6 ++++--
 indra/llinventory/llparcel.h       |  4 ++--
 indra/llui/lllineeditor.cpp        | 22 ++++++++++++++++++++--
 indra/newview/llimpanel.cpp        |  2 +-
 indra/newview/llpanellandmedia.cpp |  4 ++--
 indra/newview/llstatusbar.cpp      |  2 +-
 indra/newview/llvoiceclient.cpp    | 15 +++++++++------
 11 files changed, 56 insertions(+), 20 deletions(-)

diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp
index 137539cc04b..f62c8093d6c 100644
--- a/indra/llcommon/llsdutil.cpp
+++ b/indra/llcommon/llsdutil.cpp
@@ -184,8 +184,9 @@ char* ll_pretty_print_sd(const LLSD& sd)
 }
 
 //compares the structure of an LLSD to a template LLSD and stores the
-//"valid" values in a 3rd LLSD.  Default values are stored in the template
-//
+//"valid" values in a 3rd LLSD.  Default values pulled from the template
+//if the tested LLSD does not contain the key/value pair.
+//Excess values in the test LLSD are ignored in the resultant_llsd.
 //If the llsd to test has a specific key to a map and the values
 //are not of the same type, false is returned or if the LLSDs are not
 //of the same value.  Ordering of arrays matters
diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h
index 7098fa82527..818566fc038 100644
--- a/indra/llcommon/llsdutil.h
+++ b/indra/llcommon/llsdutil.h
@@ -92,9 +92,11 @@ char* ll_pretty_print_sd(const LLSD& sd);
 
 //compares the structure of an LLSD to a template LLSD and stores the
 //"valid" values in a 3rd LLSD. Default values
-//are pulled from the template.  Ordering of arrays matters
+//are pulled from the template.  Extra keys/values in the test
+//are ignored in the resultant LLSD.  Ordering of arrays matters
 //Returns false if the test is of same type but values differ in type
 //Otherwise, returns true
+
 BOOL compare_llsd_with_template(
 	const LLSD& llsd_to_test,
 	const LLSD& template_llsd,
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index 51e27e07081..1098d1bd3c9 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -184,7 +184,7 @@ void LLUUID::toCompressedString(std::string& out) const
 	char bytes[UUID_BYTES+1];
 	memcpy(bytes, mData, UUID_BYTES);		/* Flawfinder: ignore */
 	bytes[UUID_BYTES] = '\0';
-	out = bytes;
+	out.assign(bytes, UUID_BYTES);
 }
 
 // *TODO: deprecate
diff --git a/indra/llcommon/roles_constants.h b/indra/llcommon/roles_constants.h
index 23ebcf34d6f..7773b43f4af 100644
--- a/indra/llcommon/roles_constants.h
+++ b/indra/llcommon/roles_constants.h
@@ -143,11 +143,18 @@ const U64 GP_NOTICES_RECEIVE		= 0x1LL << 43;	// Receive Notices and View Notice
 const U64 GP_PROPOSAL_START		= 0x1LL << 44;	// Start Proposal
 const U64 GP_PROPOSAL_VOTE		= 0x1LL << 45;	// Vote on Proposal
 
+// Group chat moderation related
+const U64 GP_SESSION_JOIN = 0x1LL << 16; //can join session
+const U64 GP_SESSION_VOICE = 0x1LL << 27; //can hear/talk
+const U64 GP_SESSION_MODERATOR = 0x1LL << 37; //can mute people's session
+
 const U64 GP_DEFAULT_MEMBER = GP_ACCOUNTING_ACCOUNTABLE
 								| GP_LAND_ALLOW_SET_HOME
 								| GP_NOTICES_RECEIVE
 								| GP_PROPOSAL_START
 								| GP_PROPOSAL_VOTE
+                                | GP_SESSION_JOIN
+								| GP_SESSION_VOICE
 								;
 
 const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE
@@ -188,5 +195,8 @@ const U64 GP_DEFAULT_OFFICER = GP_ACCOUNTING_ACCOUNTABLE
 								| GP_PROPOSAL_VOTE
 								| GP_ROLE_ASSIGN_MEMBER_LIMITED
 								| GP_ROLE_PROPERTIES
+								| GP_SESSION_MODERATOR
+								| GP_SESSION_JOIN
+								| GP_SESSION_VOICE
 								;
 #endif
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index ecf013f0421..489798910d0 100644
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -1190,8 +1190,10 @@ BOOL LLParcel::exportStream(std::ostream& output_stream)
 	output_stream << "\t\t sound_local	   " << (getSoundLocal() ? 1 : 0)  << "\n";
 	output_stream << "\t\t allow_scripts    " << (getAllowOtherScripts()  ? 1 : 0)  << "\n";
 	output_stream << "\t\t allow_group_scripts    " << (getAllowGroupScripts()  ? 1 : 0)  << "\n";
-	output_stream << "\t\t allow_voice_chat    " << (getVoiceEnabled() ? 1 : 0) << "\n";
-	output_stream << "\t\t use_estate_voice_chan   " << (getVoiceUseEstateChannel() ? 1 : 0) << "\n";
+	output_stream << "\t\t use_estate_voice_chan		 " << (getParcelFlagUseEstateVoiceChannel() ? 1 : 0) << "\n";
+
+	output_stream << "\t\t allow_voice_chat    " << (getParcelFlagAllowVoice() ? 1 : 0) << "\n";
+	output_stream << "\t\t use_estate_voice_chan   " << (getParcelFlagUseEstateVoiceChannel() ? 1 : 0) << "\n";
 	output_stream << "\t\t for_sale         " << (getForSale()       ? 1 : 0)  << "\n";
 	output_stream << "\t\t sell_w_objects   " << (getSellWithObjects()	? 1 : 0)  << "\n";
 	output_stream << "\t\t draw_distance    " << mDrawDistance  << "\n";
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index 716802b2dc5..2a0ddc4ba82 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -444,9 +444,9 @@ class LLParcel
 					{ return (mParcelFlags & PF_FOR_SALE) ? TRUE : FALSE; }
 	BOOL	getSoundLocal() const
 					{ return (mParcelFlags & PF_SOUND_LOCAL) ? TRUE : FALSE; }
-	BOOL	getVoiceEnabled() const
+	BOOL	getParcelFlagAllowVoice() const
 					{ return (mParcelFlags & PF_ALLOW_VOICE_CHAT) ? TRUE : FALSE; }
-	BOOL	getVoiceUseEstateChannel() const
+	BOOL	getParcelFlagUseEstateVoiceChannel() const
 					{ return (mParcelFlags & PF_USE_ESTATE_VOICE_CHAN) ? TRUE : FALSE; }
 	BOOL	getAllowPublish() const
 					{ return (mParcelFlags & PF_ALLOW_PUBLISH) ? TRUE : FALSE; }
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 2655918169d..666e807a8db 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -1622,6 +1622,23 @@ void LLLineEditor::draw()
 			}
 		}
 
+		//draw label if no text is provided
+		//but we should draw it in a different color
+		//to give indication that it is not text you typed in
+		if (0 == mText.length() && mReadOnly)
+		{
+			mGLFont->render(mLabel.getWString(), 0,
+							mMinHPixels, (F32)text_bottom,
+							label_color,
+							LLFontGL::LEFT,
+							LLFontGL::BOTTOM,
+							LLFontGL::NORMAL,
+							S32_MAX,
+							mMaxHPixels - llround(rendered_pixels_right),
+							&rendered_pixels_right, FALSE);
+		}
+
+
 		// Draw children (border)
 		//mBorder->setVisible(TRUE);
 		mBorder->setKeyboardFocusHighlight( TRUE );
@@ -1634,10 +1651,11 @@ void LLLineEditor::draw()
 		// draw label if no text provided
 		if (0 == mText.length())
 		{
-			mGLFont->render(mLabel.getWString(), 0, 
+			mGLFont->render(mLabel.getWString(), 0,
 							mMinHPixels, (F32)text_bottom,
 							label_color,
-							LLFontGL::LEFT, LLFontGL::BOTTOM,
+							LLFontGL::LEFT,
+							LLFontGL::BOTTOM,
 							LLFontGL::NORMAL,
 							S32_MAX,
 							mMaxHPixels - llround(rendered_pixels_right),
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 754935edc6c..9d8641eb2f4 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -2225,7 +2225,7 @@ void LLFloaterIMPanel::showSessionForceClose(
 		"ForceCloseChatterBoxSession",
 		args,
 		LLFloaterIMPanel::onConfirmForceCloseError,
-		this);
+		new LLUUID(mSessionUUID));
 
 }
 
diff --git a/indra/newview/llpanellandmedia.cpp b/indra/newview/llpanellandmedia.cpp
index 34a4ad39548..3d38421ed43 100644
--- a/indra/newview/llpanellandmedia.cpp
+++ b/indra/newview/llpanellandmedia.cpp
@@ -150,9 +150,9 @@ void LLPanelLandMedia::refresh()
 		mCheckSoundLocal->set( parcel->getSoundLocal() );
 		mCheckSoundLocal->setEnabled( can_change_media );
 
-		if(parcel->getVoiceEnabled())
+		if(parcel->getParcelFlagAllowVoice())
 		{
-			if(parcel->getVoiceUseEstateChannel())
+			if(parcel->getParcelFlagUseEstateVoiceChannel())
 				mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatEstate);
 			else
 				mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatPrivate);
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index a7314548cac..ac80f1b6692 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -429,7 +429,7 @@ void LLStatusBar::refresh()
 		childSetVisible("restrictpush", FALSE);
 	}
 
-	BOOL have_voice = parcel && parcel->getVoiceEnabled(); 
+	BOOL have_voice = parcel && parcel->getParcelFlagAllowVoice(); 
 	if (have_voice)
 	{
 		childSetVisible("status_no_voice", FALSE);
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 222ce45d9dc..445e553c23f 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -3426,16 +3426,13 @@ std::string LLVoiceClient::nameFromAvatar(LLVOAvatar *avatar)
 std::string LLVoiceClient::nameFromID(const LLUUID &uuid)
 {
 	std::string result;
-	std::string rawuuid;
-	uuid.toCompressedString(rawuuid);
-	
 	// Prepending this apparently prevents conflicts with reserved names inside the vivox and diamondware code.
 	result = "x";
 	
 	// Base64 encode and replace the pieces of base64 that are less compatible 
 	// with e-mail local-parts.
 	// See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
-	result += LLBase64::encode((const U8*)rawuuid.c_str(), UUID_BYTES);
+	result += LLBase64::encode(uuid.mData, UUID_BYTES);
 	LLStringUtil::replaceChar(result, '+', '-');
 	LLStringUtil::replaceChar(result, '/', '_');
 	
@@ -3467,8 +3464,6 @@ bool LLVoiceClient::IDFromName(const std::string name, LLUUID &uuid)
 		if(len == UUID_BYTES)
 		{
 			// The decode succeeded.  Stuff the bits into the result's UUID
-			// MBW -- XXX -- there's no analogue of LLUUID::toCompressedString that allows you to set a UUID from binary data.
-			// The data field is public, so we cheat thusly:
 			memcpy(uuid.mData, rawuuid, UUID_BYTES);
 			result = true;
 		}
@@ -4076,6 +4071,9 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode
 		//the parcel you are in has changed something about its
 		//voice information
 
+		//this is a misnomer, as it can also be when you are not in
+		//a parcel at all.  Should really be something like
+		//LLViewerVoiceInfoChanged.....
 		if ( input.has("body") )
 		{
 			LLSD body = input["body"];
@@ -4085,6 +4083,11 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode
 
 			//body["voice_credentials"] has "channel_uri" (str),
 			//body["voice_credentials"] has "channel_credentials" (str)
+
+			//if we really wanted to be extra careful,
+			//we'd check the supplied
+			//local parcel id to make sure it's for the same parcel
+			//we believe we're in
 			if ( body.has("voice_credentials") )
 			{
 				LLSD voice_credentials = body["voice_credentials"];
-- 
GitLab