From 5370d9f35bc5aac49dbb8f065c13f094879ed436 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Wed, 16 Dec 2009 14:44:55 +0200 Subject: Work on EXT-3431 Implement 'mute/unmute everyone else' moderation in the voice control panel -- code refactored: moderator actions are moved from UI to IM Speaker Manager (and just called from UI). --HG-- branch : product-engine --- indra/newview/llspeakers.cpp | 99 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 261bdbcfc0..1b9fee650e 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -36,6 +36,7 @@ #include "llagent.h" #include "llappviewer.h" +#include "llimview.h" #include "llmutelist.h" #include "llsdutil.h" #include "lluicolortable.h" @@ -575,6 +576,104 @@ void LLIMSpeakerMgr::updateSpeakers(const LLSD& update) } } +class ModerationResponder : public LLHTTPClient::Responder +{ +public: + ModerationResponder(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; +}; + +void LLIMSpeakerMgr::toggleAllowTextChat(const LLUUID& speaker_id) +{ + std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); + LLSD data; + data["method"] = "mute update"; + data["session-id"] = getSessionID(); + data["params"] = LLSD::emptyMap(); + data["params"]["agent_id"] = speaker_id; + data["params"]["mute_info"] = LLSD::emptyMap(); + //current value represents ability to type, so invert + data["params"]["mute_info"]["text"] = !findSpeaker(speaker_id)->mModeratorMutedText; + + LLHTTPClient::post(url, data, new ModerationResponder(getSessionID())); +} + +void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute) +{ + if (gAgentID == avatar_id) return; // do not process myself + + LLPointer speakerp = findSpeaker(avatar_id); + if (!speakerp) return; + + // *NOTE: mantipov: probably this condition will be incorrect when avatar will be blocked for + // text chat via moderation (LLSpeaker::mModeratorMutedText == TRUE) + bool is_in_voice = speakerp->mStatus <= LLSpeaker::STATUS_VOICE_ACTIVE || speakerp->mStatus == LLSpeaker::STATUS_MUTED; + + // do not send voice moderation changes for avatars not in voice channel + if (!is_in_voice) return; + + std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); + LLSD data; + data["method"] = "mute update"; + data["session-id"] = getSessionID(); + data["params"] = LLSD::emptyMap(); + data["params"]["agent_id"] = avatar_id; + data["params"]["mute_info"] = LLSD::emptyMap(); + data["params"]["mute_info"]["voice"] = !unmute; + + LLHTTPClient::post( + url, + data, + new ModerationResponder(getSessionID())); +} + +void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute) +{ + LLSpeakerMgr::speaker_list_t speakers; + getSpeakerList(&speakers, FALSE); + + 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; + + moderateVoiceParticipant(speaker_id, unmute); + } +} + // // LLActiveSpeakerMgr -- cgit v1.3 From 0ec2bacfac207451386b55006f94e917f1277edc Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Wed, 16 Dec 2009 18:14:15 +0200 Subject: Work on EXT-3431 Implement 'mute/unmute everyone else' moderation in the voice control panel -- changed behavior of 'mute/unmute everyone else' action to disable/enable voice chat and allow/disallow selected participant Improvements to have more intellectual processing of several following requests is necessary --HG-- branch : product-engine --- indra/newview/llimview.cpp | 5 +++++ indra/newview/llspeakers.cpp | 37 +++++++++++++++++++++++++++++++++++++ indra/newview/llspeakers.h | 7 +++++++ 3 files changed, 49 insertions(+) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 1d56fc0cab..ad30b844a9 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2733,6 +2733,11 @@ public: { im_floater->processSessionUpdate(input["body"]["info"]); } + LLIMSpeakerMgr* im_mgr = LLIMModel::getInstance()->getSpeakerManager(session_id); + if (im_mgr) + { + im_mgr->processSessionUpdate(input["body"]["info"]); + } } }; diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 1b9fee650e..da7910d8b4 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -659,6 +659,11 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute) { + // TODO: mantipov: add more intellectual processing of several following requests + + mReverseVoiceModeratedAvatarID = excluded_avatar_id; + moderateVoiceSession(getSessionID(), !unmute); +/* LLSpeakerMgr::speaker_list_t speakers; getSpeakerList(&speakers, FALSE); @@ -672,6 +677,38 @@ void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avata moderateVoiceParticipant(speaker_id, unmute); } +*/ +} + +void LLIMSpeakerMgr::processSessionUpdate(const LLSD& session_update) +{ + if (mReverseVoiceModeratedAvatarID.isNull()) return; + + if (session_update.has("moderated_mode") && + session_update["moderated_mode"].has("voice")) + { + BOOL voice_moderated = session_update["moderated_mode"]["voice"]; + + moderateVoiceParticipant(mReverseVoiceModeratedAvatarID, voice_moderated); + + mReverseVoiceModeratedAvatarID = LLUUID::null; + } +} + +void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallow_voice) +{ + std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); + LLSD data; + data["method"] = "session update"; + data["session-id"] = session_id; + data["params"] = LLSD::emptyMap(); + + data["params"]["update_info"] = LLSD::emptyMap(); + + data["params"]["update_info"]["moderated_mode"] = LLSD::emptyMap(); + data["params"]["update_info"]["moderated_mode"]["voice"] = disallow_voice; + + LLHTTPClient::post(url, data, new ModerationResponder(session_id)); } diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h index 6f7a1d2c49..55d2351cbf 100644 --- a/indra/newview/llspeakers.h +++ b/indra/newview/llspeakers.h @@ -186,8 +186,15 @@ public: * @see moderateVoiceParticipant() */ void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute); + + void processSessionUpdate(const LLSD& session_update); + protected: virtual void updateSpeakerList(); + + void moderateVoiceSession(const LLUUID& session_id, bool disallow_voice); + + LLUUID mReverseVoiceModeratedAvatarID; }; class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton -- cgit v1.3 From e921eac328f60a44b2671cba6ea0bf09c03c14f3 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Wed, 16 Dec 2009 19:19:42 +0200 Subject: Fixed line endings to unix format --HG-- branch : product-engine --- indra/newview/llspeakers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index da7910d8b4..6bbd3c6687 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -662,7 +662,7 @@ void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avata // TODO: mantipov: add more intellectual processing of several following requests mReverseVoiceModeratedAvatarID = excluded_avatar_id; - moderateVoiceSession(getSessionID(), !unmute); + moderateVoiceSession(getSessionID(), !unmute); /* LLSpeakerMgr::speaker_list_t speakers; getSpeakerList(&speakers, FALSE); -- cgit v1.3 From d2b0245d5886d823bf8ad343d61c6c6f0babc274 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Wed, 16 Dec 2009 20:43:12 +0200 Subject: rename values to be more descriptive --HG-- branch : product-engine --- indra/newview/llspeakers.cpp | 6 +++--- indra/newview/llspeakers.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 6bbd3c6687..6e5a867426 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -657,12 +657,12 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu new ModerationResponder(getSessionID())); } -void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute) +void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute_everyone_else) { // TODO: mantipov: add more intellectual processing of several following requests mReverseVoiceModeratedAvatarID = excluded_avatar_id; - moderateVoiceSession(getSessionID(), !unmute); + moderateVoiceSession(getSessionID(), !unmute_everyone_else); /* LLSpeakerMgr::speaker_list_t speakers; getSpeakerList(&speakers, FALSE); @@ -675,7 +675,7 @@ void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avata if (excluded_avatar_id == speaker_id) continue; - moderateVoiceParticipant(speaker_id, unmute); + moderateVoiceParticipant(speaker_id, unmute_everyone_else); } */ } diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h index 55d2351cbf..1a8c23f56a 100644 --- a/indra/newview/llspeakers.h +++ b/indra/newview/llspeakers.h @@ -181,11 +181,11 @@ public: * It based call moderateVoiceParticipant() for each avatar should be muted/unmuted. * * @param[in] excluded_avatar_id UUID of avatar NOT to be processed - * @param[in] unmute if true - avatars will be muted, otherwise - unmuted. + * @param[in] unmute_everyone_else if false - avatars will be muted, otherwise - unmuted. * * @see moderateVoiceParticipant() */ - void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute); + void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute_everyone_else); void processSessionUpdate(const LLSD& session_update); -- cgit v1.3 From 82929ee43b4fb7db6435f419d3e2818684b49eae Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 17 Dec 2009 13:00:16 +0200 Subject: Work on EXT-3431 Implement 'mute/unmute everyone else' moderation in the voice control panel -- added comment to test scenario when "Moderator sends the same second request before first response is come" --HG-- branch : product-engine --- indra/newview/llspeakers.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'indra/newview/llspeakers.cpp') diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 6e5a867426..3861a96355 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -659,25 +659,27 @@ void LLIMSpeakerMgr::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmu void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute_everyone_else) { - // TODO: mantipov: add more intellectual processing of several following requests + // *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; moderateVoiceSession(getSessionID(), !unmute_everyone_else); -/* - LLSpeakerMgr::speaker_list_t speakers; - getSpeakerList(&speakers, FALSE); - - 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; - - moderateVoiceParticipant(speaker_id, unmute_everyone_else); - } -*/ } void LLIMSpeakerMgr::processSessionUpdate(const LLSD& session_update) -- cgit v1.3