Skip to content
Snippets Groups Projects
Commit e8d3afc9 authored by Mike Antipov's avatar Mike Antipov
Browse files

Work on major task EXT-2808 (Add speakers moderation (both voice and text) to...

Work on major task EXT-2808 (Add speakers moderation (both voice and text) to the Voice Control Panel (Active Speakers List))
 -- Refactored moderating of text & voice chats to use the only LLHTTPClient::Responder class
 -- added doxygen comments for voice moderation functions

--HG--
branch : product-engine
parent 08c0d387
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,44 @@ ...@@ -47,6 +47,44 @@
#if LL_MSVC #if LL_MSVC
#pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
#endif #endif
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;
};
LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu/* = true*/): LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu/* = true*/):
mSpeakerMgr(data_source), mSpeakerMgr(data_source),
mAvatarList(avatar_list), mAvatarList(avatar_list),
...@@ -369,47 +407,10 @@ void LLParticipantList::LLParticipantListMenu::toggleAllowTextChat(const LLSD& u ...@@ -369,47 +407,10 @@ void LLParticipantList::LLParticipantListMenu::toggleAllowTextChat(const LLSD& u
//current value represents ability to type, so invert //current value represents ability to type, so invert
data["params"]["mute_info"]["text"] = !mParent.mSpeakerMgr->findSpeaker(speaker_id)->mModeratorMutedText; data["params"]["mute_info"]["text"] = !mParent.mSpeakerMgr->findSpeaker(speaker_id)->mModeratorMutedText;
class MuteTextResponder : public LLHTTPClient::Responder
{
public:
MuteTextResponder(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( LLHTTPClient::post(
url, url,
data, data,
new MuteTextResponder(mParent.mSpeakerMgr->getSessionID())); new ModerationResponder(mParent.mSpeakerMgr->getSessionID()));
} }
void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata, U32 flags) void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata, U32 flags)
...@@ -488,47 +489,10 @@ void LLParticipantList::LLParticipantListMenu::moderateVoiceParticipant(const LL ...@@ -488,47 +489,10 @@ void LLParticipantList::LLParticipantListMenu::moderateVoiceParticipant(const LL
data["params"]["mute_info"] = LLSD::emptyMap(); data["params"]["mute_info"] = LLSD::emptyMap();
data["params"]["mute_info"]["voice"] = !unmute; 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( LLHTTPClient::post(
url, url,
data, data,
new MuteVoiceResponder(mParent.mSpeakerMgr->getSessionID())); new ModerationResponder(mParent.mSpeakerMgr->getSessionID()));
} }
void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute) void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute)
...@@ -583,3 +547,5 @@ bool LLParticipantList::LLParticipantListMenu::checkContextMenuItem(const LLSD& ...@@ -583,3 +547,5 @@ bool LLParticipantList::LLParticipantListMenu::checkContextMenuItem(const LLSD&
} }
return false; return false;
} }
//EOF
...@@ -130,9 +130,48 @@ class LLParticipantList ...@@ -130,9 +130,48 @@ class LLParticipantList
void toggleMuteVoice(const LLSD& userdata); void toggleMuteVoice(const LLSD& userdata);
// Voice moderation support // Voice moderation support
/**
* Check whether specified by argument avatar is muted for group chat or not.
*/
bool isMuted(const LLUUID& avatar_id); bool isMuted(const LLUUID& avatar_id);
/**
* Processes Voice moderation menu items.
*
* It calls either moderateVoiceParticipant() or moderateVoiceParticipant() depend on
* passed parameter.
*
* @param userdata can be "selected" or "others".
*
* @see moderateVoiceParticipant()
* @see moderateVoiceOtherParticipants()
*/
void moderateVoice(const LLSD& userdata); void moderateVoice(const LLSD& userdata);
/**
* Mutes/Unmutes avatar for current group voice chat.
*
* It only marks avatar as muted for session and does not use local Agent's Block list.
* It does not mute Agent itself.
*
* @param[in] avatar_id UUID of avatar to be processed
* @param[in] unmute if true - specified avatar will be muted, otherwise - unmuted.
*
* @see moderateVoiceOtherParticipants()
*/
void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute); void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute);
/**
* Mutes/Unmutes all avatars except specified for current group voice chat.
*
* It only marks avatars as muted for session and does not use local Agent's Block list.
* 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.
*
* @see moderateVoiceParticipant()
*/
void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute); void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute);
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment