From 77b5ee1b4d7fb03f757efdaa4169ab38fb754b25 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 11 Dec 2009 18:33:37 +0200 Subject: Implemented major task EXT-3390 - Move Moderation options into submenu. --HG-- branch : product-engine --- indra/newview/llparticipantlist.cpp | 19 ++++++++++++++++--- indra/newview/llparticipantlist.h | 5 +++++ .../skins/default/xui/en/menu_participant_list.xml | 5 +++++ 3 files changed, 26 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index e99a9a5d12..1986a98fb7 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -401,8 +401,13 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu() enable_registrar.add("ParticipantList.CheckItem", boost::bind(&LLParticipantList::LLParticipantListMenu::checkContextMenuItem, this, _2)); // create the context menu from the XUI - return LLUICtrlFactory::getInstance()->createFromFile( + LLContextMenu* main_menu = LLUICtrlFactory::getInstance()->createFromFile( "menu_participant_list.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); + + main_menu->setItemVisible("Moderator Options", isGroupModerator()); + main_menu->arrangeAndClear(); + + return main_menu; } void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const std::vector& uuids, S32 x, S32 y) @@ -483,6 +488,15 @@ void LLParticipantList::LLParticipantListMenu::toggleMuteVoice(const LLSD& userd toggleMute(userdata, LLMute::flagVoiceChat); } +bool LLParticipantList::LLParticipantListMenu::isGroupModerator() +{ + // Agent is in Group Call + bool is_in_group = gAgent.isInGroup(mParent.mSpeakerMgr->getSessionID()); + // Agent is Moderator + bool is_moderator = mParent.mSpeakerMgr->findSpeaker(gAgentID)->mIsModerator; + return is_in_group && is_moderator; +} + bool LLParticipantList::LLParticipantListMenu::isMuted(const LLUUID& avatar_id) { LLPointer selected_speakerp = mParent.mSpeakerMgr->findSpeaker(avatar_id); @@ -565,8 +579,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& else if (item == "can_allow_text_chat" || "can_moderate_voice" == item) { - LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mParent.mSpeakerMgr->getSessionID()); - return im_session->mType == IM_SESSION_GROUP_START && mParent.mSpeakerMgr->findSpeaker(gAgentID)->mIsModerator; + return isGroupModerator(); } return true; } diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index 229769ec09..9d7d3a0cbe 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -138,6 +138,11 @@ class LLParticipantList void toggleMuteText(const LLSD& userdata); void toggleMuteVoice(const LLSD& userdata); + /** + * Return true if Agent is group moderator(and moderator of group call). + */ + bool isGroupModerator(); + // Voice moderation support /** * Check whether specified by argument avatar is muted for group chat or not. diff --git a/indra/newview/skins/default/xui/en/menu_participant_list.xml b/indra/newview/skins/default/xui/en/menu_participant_list.xml index ffe5430c55..adf4bd70e1 100644 --- a/indra/newview/skins/default/xui/en/menu_participant_list.xml +++ b/indra/newview/skins/default/xui/en/menu_participant_list.xml @@ -76,6 +76,10 @@ function="ParticipantList.EnableItem" parameter="can_mute_text" /> + + -- cgit v1.2.3