diff options
author | Mike Antipov <mantipov@productengine.com> | 2010-04-19 15:50:45 +0300 |
---|---|---|
committer | Mike Antipov <mantipov@productengine.com> | 2010-04-19 15:50:45 +0300 |
commit | a16195fb81d7f4c7a5dd60f91d067bbdcac0f44d (patch) | |
tree | 51ae1da47c9d66bdf716d49f4b6ee8f18a4e6614 /indra/newview/llparticipantlist.cpp | |
parent | 59d296e2008847b944678f6e3b873435e6d5f826 (diff) |
Fixed normal bug EXT-6864 (Resident-related menu items are enabled/displayed for PSTN bridge callers)
* Disabled all currently processed menu items related to interaction with a resident for Avaline callers.
* Added enable callback for View Profile menu item to disable it for Avaline callers.
* Disabled menu items related to text chat.
Full list is:
- View Profile
- Add Friend
- IM
- Call
- Share
- Pay
- Block Text
- Moderate Options:
-- Allow Text chat
DEV notes: To process moderation options separate "on_enable handler" was created for group moderate actions.
Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/261/
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llparticipantlist.cpp')
-rw-r--r-- | indra/newview/llparticipantlist.cpp | 57 |
1 files changed, 39 insertions, 18 deletions
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 53f92f7ad1..c3748ca81d 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -643,6 +643,7 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu() registrar.add("ParticipantList.ModerateVoice", boost::bind(&LLParticipantList::LLParticipantListMenu::moderateVoice, this, _2)); enable_registrar.add("ParticipantList.EnableItem", boost::bind(&LLParticipantList::LLParticipantListMenu::enableContextMenuItem, this, _2)); + enable_registrar.add("ParticipantList.EnableItem.Moderate", boost::bind(&LLParticipantList::LLParticipantListMenu::enableModerateContextMenuItem, this, _2)); enable_registrar.add("ParticipantList.CheckItem", boost::bind(&LLParticipantList::LLParticipantListMenu::checkContextMenuItem, this, _2)); // create the context menu from the XUI @@ -667,7 +668,7 @@ void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const if (uuids.size() == 0) return; - const LLUUID speaker_id = mUUIDs.front(); + const LLUUID& speaker_id = mUUIDs.front(); BOOL is_muted = isMuted(speaker_id); if (is_muted) @@ -801,28 +802,18 @@ void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(co bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); + const LLUUID& participant_id = mUUIDs.front(); + + // For now non of "can_view_profile" action and menu actions listed below except "can_block" + // can be performed for Avaline callers. + bool is_participant_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(participant_id); + if (!is_participant_avatar && "can_block" != item) return false; + if (item == "can_mute_text" || "can_block" == item || "can_share" == item || "can_im" == item || "can_pay" == item) { return mUUIDs.front() != gAgentID; } - else if (item == "can_allow_text_chat") - { - return isGroupModerator(); - } - else if ("can_moderate_voice" == item) - { - if (isGroupModerator()) - { - LLPointer<LLSpeaker> speakerp = mParent.mSpeakerMgr->findSpeaker(mUUIDs.front()); - if (speakerp.notNull()) - { - // not in voice participants can not be moderated - return speakerp->isInVoiceChannel(); - } - } - return false; - } else if (item == std::string("can_add")) { // We can add friends if: @@ -855,6 +846,36 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& return true; } +/* +Processed menu items with such parameters: + can_allow_text_chat + can_moderate_voice +*/ +bool LLParticipantList::LLParticipantListMenu::enableModerateContextMenuItem(const LLSD& userdata) +{ + // only group moderators can perform actions related to this "enable callback" + if (!isGroupModerator()) return false; + + const LLUUID& participant_id = mUUIDs.front(); + LLPointer<LLSpeaker> speakerp = mParent.mSpeakerMgr->findSpeaker(participant_id); + + // not in voice participants can not be moderated + bool speaker_in_voice = speakerp.notNull() && speakerp->isInVoiceChannel(); + + const std::string& item = userdata.asString(); + + if ("can_moderate_voice" == item) + { + return speaker_in_voice; + } + + // For now non of menu actions except "can_moderate_voice" can be performed for Avaline callers. + bool is_participant_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(participant_id); + if (!is_participant_avatar) return false; + + return true; +} + bool LLParticipantList::LLParticipantListMenu::checkContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); |