diff options
author | Mike Antipov <mantipov@productengine.com> | 2009-12-10 14:45:41 +0200 |
---|---|---|
committer | Mike Antipov <mantipov@productengine.com> | 2009-12-10 14:45:41 +0200 |
commit | 08c0d3876bcddb2beeabb6fb2cd1a620eeb02576 (patch) | |
tree | c835daa30f89c7b7c0cde839cb63bd9fbdb318c8 /indra/newview | |
parent | 791465bab968a738568ddf0abaa5fa6766eb020d (diff) |
Work on major task EXT-2808 (Add speakers moderation (both voice and text) to the Voice Control Panel (Active Speakers List))
-- Implemented Actions to Mute/Unmute Participants without using Agent's Block List
-- Updated missing strings to show error while moderating
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llparticipantlist.cpp | 101 | ||||
-rw-r--r-- | indra/newview/llparticipantlist.h | 4 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 3 |
3 files changed, 90 insertions, 18 deletions
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 48a7a32a3b..a42b5e48cc 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -341,7 +341,7 @@ void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const if (uuids.size() == 0) return; const LLUUID speaker_id = mUUIDs.front(); - BOOL is_muted = LLMuteList::getInstance()->isMuted(speaker_id, LLMute::flagVoiceChat); + BOOL is_muted = isMuted(speaker_id); if (is_muted) { @@ -353,7 +353,6 @@ void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceUnMuteSelected", false); LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceUnMuteOthers", false); } - } void LLParticipantList::LLParticipantListMenu::toggleAllowTextChat(const LLSD& userdata) @@ -390,14 +389,14 @@ void LLParticipantList::LLParticipantListMenu::toggleAllowTextChat(const LLSD& u { gIMMgr->showSessionEventError( "mute", - "not_a_moderator", + "not_a_mod_error", mSessionID); } else { gIMMgr->showSessionEventError( "mute", - "generic", + "generic_request_error", mSessionID); } } @@ -450,34 +449,102 @@ void LLParticipantList::LLParticipantListMenu::toggleMuteVoice(const LLSD& userd toggleMute(userdata, LLMute::flagVoiceChat); } +bool LLParticipantList::LLParticipantListMenu::isMuted(const LLUUID& avatar_id) +{ + LLPointer<LLSpeaker> selected_speakerp = mParent.mSpeakerMgr->findSpeaker(avatar_id); + if (!selected_speakerp) return true; + + return selected_speakerp->mStatus == LLSpeaker::STATUS_MUTED; +} + void LLParticipantList::LLParticipantListMenu::moderateVoice(const LLSD& userdata) { + if (!gAgent.getRegion()) return; + bool moderate_selected = userdata.asString() == "selected"; + const LLUUID& selected_avatar_id = mUUIDs.front(); + bool is_muted = isMuted(selected_avatar_id); + + if (moderate_selected) + { + moderateVoiceParticipant(selected_avatar_id, is_muted); + } + else + { + moderateVoiceOtherParticipants(selected_avatar_id, is_muted); + } } -void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(const LLSD& userdata) + +void LLParticipantList::LLParticipantListMenu::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute) +{ + if (gAgentID == avatar_id) return; // do not process myself + + std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); + LLSD data; + data["method"] = "mute update"; + data["session-id"] = mParent.mSpeakerMgr->getSessionID(); + data["params"] = LLSD::emptyMap(); + data["params"]["agent_id"] = avatar_id; + data["params"]["mute_info"] = LLSD::emptyMap(); + data["params"]["mute_info"]["voice"] = !unmute; + + class MuteVoiceResponder : public LLHTTPClient::Responder + { + public: + MuteVoiceResponder(const LLUUID& session_id) + { + mSessionID = session_id; + } + + virtual void error(U32 status, const std::string& reason) + { + llwarns << status << ": " << reason << llendl; + + if ( gIMMgr ) + { + //403 == you're not a mod + //should be disabled if you're not a moderator + if ( 403 == status ) + { + gIMMgr->showSessionEventError( + "mute", + "not_a_mod_error", + mSessionID); + } + else + { + gIMMgr->showSessionEventError( + "mute", + "generic_request_error", + mSessionID); + } + } + } + + private: + LLUUID mSessionID; + }; + + LLHTTPClient::post( + url, + data, + new MuteVoiceResponder(mParent.mSpeakerMgr->getSessionID())); +} + +void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute) { LLSpeakerMgr::speaker_list_t speakers; mParent.mSpeakerMgr->getSpeakerList(&speakers, true); - const LLUUID& excluded_avatar_id = mUUIDs.front(); - bool should_mute = userdata.asString() == "mute"; for (LLSpeakerMgr::speaker_list_t::iterator iter = speakers.begin(); iter != speakers.end(); ++iter) { LLSpeaker* speakerp = (*iter).get(); LLUUID speaker_id = speakerp->mID; - if (excluded_avatar_id == speaker_id) continue; - LLMute mute(speaker_id, speakerp->mDisplayName, speakerp->mType == LLSpeaker::SPEAKER_AGENT ? LLMute::AGENT : LLMute::OBJECT); + if (excluded_avatar_id == speaker_id) continue; - if (should_mute) - { - LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat); - } - else - { - LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat); - } + moderateVoiceParticipant(speaker_id, unmute); } } diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index 83191a5b8d..388d0b4fee 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -130,8 +130,10 @@ class LLParticipantList void toggleMuteVoice(const LLSD& userdata); // Voice moderation support + bool isMuted(const LLUUID& avatar_id); void moderateVoice(const LLSD& userdata); - void moderateVoiceOtherParticipants(const LLSD& userdata); + void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute); + void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute); }; private: diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index c3650c71c3..8ac4ca95b9 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2900,6 +2900,9 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. <string name="message_session_event"> Unable to send your message to the chat session with [RECIPIENT]. </string> + <string name="mute"> + Error while moderating. + </string> <string name="removed_from_group"> You have been removed from the group. </string> |