From cf2268635ca6aef99b1d6c01083be4b4a292646a Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 27 May 2010 17:36:34 +0300 Subject: EXT-6937 FIXED Implemented initializing of moderate_mode on first join voice chat. This is a workaround until a way to request the current voice channel moderation mode is implemented in the viewer. Details: * Added method to initialize Speaker manager's Voice moderate_mode once Agent's participant state is known. * Once agent's voice participant is updated this method is called. * This method initializes Voice moderate_mode only once. This is necessary to process "Mute everyone" menu item calls properly. Also renamed moderateVoiceOtherParticipants methods with moderateVoiceAllParticipants and related staff. Reviewed by Aimee Walton at https://codereview.productengine.com/secondlife/r/448/ --HG-- branch : product-engine --- indra/newview/llspeakers.cpp | 65 ++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 33 deletions(-) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 9da3db3032..bf00b47c21 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -251,6 +251,8 @@ bool LLSpeakersDelayActionsStorage::onTimerActionCallback(const LLUUID& speaker_ LLSpeakerMgr::LLSpeakerMgr(LLVoiceChannel* channelp) : mVoiceChannel(channelp) +, mVoiceModerated(false) +, mModerateModeHandledFirstTime(false) { static LLUICachedControl remove_delay ("SpeakerParticipantRemoveDelay", 10.0); @@ -297,6 +299,33 @@ LLPointer LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin return speakerp; } +// *TODO: Once way to request the current voice channel moderation mode is implemented +// this method with related code should be removed. +/* + Initializes "moderate_mode" of voice session on first join. + + This is WORKAROUND because a way to request the current voice channel moderation mode exists + but is not implemented in viewer yet. See EXT-6937. +*/ +void LLSpeakerMgr::initVoiceModerateMode() +{ + if (!mModerateModeHandledFirstTime && (mVoiceChannel && mVoiceChannel->isActive())) + { + LLPointer speakerp; + + if (mSpeakers.find(gAgentID) != mSpeakers.end()) + { + speakerp = mSpeakers[gAgentID]; + } + + if (speakerp.notNull()) + { + mVoiceModerated = speakerp->mModeratorMutedVoice; + mModerateModeHandledFirstTime = true; + } + } +} + void LLSpeakerMgr::update(BOOL resort_ok) { if (!LLVoiceClient::getInstance()) @@ -529,7 +558,6 @@ BOOL LLSpeakerMgr::isVoiceActive() // LLIMSpeakerMgr // LLIMSpeakerMgr::LLIMSpeakerMgr(LLVoiceChannel* channel) : LLSpeakerMgr(channel) -, mVoiceModerated(false) { } @@ -762,31 +790,9 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu new ModerationResponder(getSessionID())); } -void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute_everyone_else) +void LLIMSpeakerMgr::moderateVoiceAllParticipants( bool unmute_everyone ) { - // *TODO: mantipov: add more intellectual processing of several following requests if it is needed. - /* - Such situation should be tested: - "Moderator sends the same second request before first response is come" - Moderator sends "mute everyone else" for A and then for B - two requests to disallow voice chat are sent - UUID of B is stored. - Then first response (to disallow voice chat) is come - request to allow voice for stored avatar (B) - Then second response (to disallow voice chat) is come - have nothing to do, the latest selected speaker is already enabled - - What can happen? - If request to allow voice for stored avatar (B) is processed on server BEFORE - second request to disallow voice chat all speakers will be disabled on voice. - But I'm not sure such situation is possible. - See EXT-3431. - */ - - mReverseVoiceModeratedAvatarID = excluded_avatar_id; - - - if (mVoiceModerated == !unmute_everyone_else) + if (mVoiceModerated == !unmute_everyone) { // session already in requested state. Just force participants which do not match it. forceVoiceModeratedMode(mVoiceModerated); @@ -794,7 +800,7 @@ void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avata else { // otherwise set moderated mode for a whole session. - moderateVoiceSession(getSessionID(), !unmute_everyone_else); + moderateVoiceSession(getSessionID(), !unmute_everyone); } } @@ -804,13 +810,6 @@ void LLIMSpeakerMgr::processSessionUpdate(const LLSD& session_update) session_update["moderated_mode"].has("voice")) { mVoiceModerated = session_update["moderated_mode"]["voice"]; - - if (mReverseVoiceModeratedAvatarID.notNull()) - { - moderateVoiceParticipant(mReverseVoiceModeratedAvatarID, mVoiceModerated); - - mReverseVoiceModeratedAvatarID = LLUUID::null; - } } } -- cgit v1.2.3