From fc785febb332442533c20b638132b8ab378732a9 Mon Sep 17 00:00:00 2001
From: Mike Antipov <mantipov@productengine.com>
Date: Wed, 6 Jan 2010 17:13:12 +0200
Subject: Fixed normal bug EXT-3944 ('Error while moderating' dialog after
 disabling voice for non-connected participant avatar from miniinspector) -
 improved condition to check if avatar can be moderated. - if not moderation
 panel (with "Disable Voice" button) is not shown at all.

--HG--
branch : product-engine
---
 indra/newview/llinspectavatar.cpp   | 1 +
 indra/newview/llparticipantlist.cpp | 3 +--
 indra/newview/llspeakers.cpp        | 5 +++++
 indra/newview/llspeakers.h          | 2 ++
 4 files changed, 9 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 7f206cb873..72b36374dd 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -402,6 +402,7 @@ void LLInspectAvatar::updateModeratorPanel()
 				LLPointer<LLSpeaker> selected_speakerp = speaker_mgr->findSpeaker(mAvatarID);
 				
 				if(speaker_mgr->isVoiceActive() && selected_speakerp && 
+					selected_speakerp->isInVoiceChannel() &&
 					((self_speakerp && self_speakerp->mIsModerator) || gAgent.isGodlike()))
 				{
 					getChild<LLUICtrl>("enable_voice")->setVisible(selected_speakerp->mModeratorMutedVoice);
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index e2da4c4475..362454ee3c 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -592,8 +592,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD&
 			if (speakerp.notNull())
 			{
 				// not in voice participants can not be moderated
-				return speakerp->mStatus == LLSpeaker::STATUS_VOICE_ACTIVE
-					|| speakerp->mStatus == LLSpeaker::STATUS_MUTED;
+				return speakerp->isInVoiceChannel();
 			}
 		}
 		return false;
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 010dfd1b33..0dd9203c6d 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -88,6 +88,11 @@ void LLSpeaker::onAvatarNameLookup(const LLUUID& id, const std::string& first, c
 	mDisplayName = first + " " + last;
 }
 
+bool LLSpeaker::isInVoiceChannel()
+{
+	return mStatus == LLSpeaker::STATUS_VOICE_ACTIVE || mStatus == LLSpeaker::STATUS_MUTED;
+}
+
 LLSpeakerUpdateModeratorEvent::LLSpeakerUpdateModeratorEvent(LLSpeaker* source)
 : LLEvent(source, "Speaker add moderator event"),
   mSpeakerID (source->mID),
diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h
index 1a8c23f56a..da8dfdf548 100644
--- a/indra/newview/llspeakers.h
+++ b/indra/newview/llspeakers.h
@@ -67,6 +67,8 @@ public:
 
 	void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group);
 
+	bool isInVoiceChannel();
+
 	ESpeakerStatus	mStatus;			// current activity status in speech group
 	F32				mLastSpokeTime;		// timestamp when this speaker last spoke
 	F32				mSpeechVolume;		// current speech amplitude (timea average rms amplitude?)
-- 
cgit v1.2.3