summaryrefslogtreecommitdiff
path: root/indra/newview/llparticipantlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llparticipantlist.cpp')
-rw-r--r--indra/newview/llparticipantlist.cpp361
1 files changed, 0 insertions, 361 deletions
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 90226e7fba..b263143bd1 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -213,7 +213,6 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source,
LLConversationItemSession(data_source->getSessionID(), root_view_model),
mSpeakerMgr(data_source),
mAvatarList(avatar_list),
- mParticipantListMenu(NULL),
mExcludeAgent(exclude_agent),
mValidateSpeakerCallback(NULL)
{
@@ -248,8 +247,6 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source,
if (use_context_menu)
{
- //mParticipantListMenu = new LLParticipantListMenu(*this);
- //mAvatarList->setContextMenu(mParticipantListMenu);
mAvatarList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu);
}
else
@@ -316,20 +313,6 @@ LLParticipantList::~LLParticipantList()
mAvatarListToggleIconsConnection.disconnect();
}
- // It is possible Participant List will be re-created from LLCallFloater::onCurrentChannelChanged()
- // See ticket EXT-3427
- // hide menu before deleting it to stop enable and check handlers from triggering.
- if(mParticipantListMenu && !LLApp::isExiting())
- {
- mParticipantListMenu->hide();
- }
-
- if (mParticipantListMenu)
- {
- delete mParticipantListMenu;
- mParticipantListMenu = NULL;
- }
-
if (mAvatarList)
{
mAvatarList->setContextMenu(NULL);
@@ -786,350 +769,6 @@ bool LLParticipantList::SpeakerMuteListener::handleEvent(LLPointer<LLOldEvents::
return mParent.onSpeakerMuteEvent(event, userdata);
}
-/*LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu()
-{
- // set up the callbacks for all of the avatar menu items
- LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
- LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
-
- registrar.add("ParticipantList.Sort", boost::bind(&LLParticipantList::LLParticipantListMenu::sortParticipantList, this, _2));
- registrar.add("ParticipantList.ToggleAllowTextChat", boost::bind(&LLParticipantList::LLParticipantListMenu::toggleAllowTextChat, this, _2));
- registrar.add("ParticipantList.ToggleMuteText", boost::bind(&LLParticipantList::LLParticipantListMenu::toggleMuteText, this, _2));
-
- registrar.add("Avatar.Profile", boost::bind(&LLAvatarActions::showProfile, mUUIDs.front()));
- registrar.add("Avatar.IM", boost::bind(&LLAvatarActions::startIM, mUUIDs.front()));
- registrar.add("Avatar.AddFriend", boost::bind(&LLAvatarActions::requestFriendshipDialog, mUUIDs.front()));
- registrar.add("Avatar.BlockUnblock", boost::bind(&LLParticipantList::LLParticipantListMenu::toggleMuteVoice, this, _2));
- registrar.add("Avatar.Share", boost::bind(&LLAvatarActions::share, mUUIDs.front()));
- registrar.add("Avatar.Pay", boost::bind(&LLAvatarActions::pay, mUUIDs.front()));
- registrar.add("Avatar.Call", boost::bind(&LLAvatarActions::startCall, mUUIDs.front()));
-
- 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
- LLContextMenu* main_menu = createFromFile("menu_participant_list.xml");
-
- // Don't show sort options for P2P chat
- bool is_sort_visible = (mParent.mAvatarList && mParent.mAvatarList->size() > 1);
- main_menu->setItemVisible("SortByName", is_sort_visible);
- main_menu->setItemVisible("SortByRecentSpeakers", is_sort_visible);
- main_menu->setItemVisible("Moderator Options Separator", isGroupModerator());
- main_menu->setItemVisible("Moderator Options", isGroupModerator());
- main_menu->setItemVisible("View Icons Separator", mParent.mAvatarListToggleIconsConnection.connected());
- main_menu->setItemVisible("View Icons", mParent.mAvatarListToggleIconsConnection.connected());
- main_menu->arrangeAndClear();
-
- return main_menu;
-}*/
-
-void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
-{
- if (uuids.size() == 0) return;
-
- LLListContextMenu::show(spawning_view, uuids, x, y);
-
- const LLUUID& speaker_id = mUUIDs.front();
- BOOL is_muted = isMuted(speaker_id);
-
- if (is_muted)
- {
- LLMenuGL::sMenuContainer->getChildView("ModerateVoiceMuteSelected")->setVisible( false);
- }
- else
- {
- LLMenuGL::sMenuContainer->getChildView("ModerateVoiceUnMuteSelected")->setVisible( false);
- }
-}
-
-void LLParticipantList::LLParticipantListMenu::sortParticipantList(const LLSD& userdata)
-{
- std::string param = userdata.asString();
- if ("sort_by_name" == param)
- {
- mParent.setSortOrder(E_SORT_BY_NAME);
- }
- else if ("sort_by_recent_speakers" == param)
- {
- mParent.setSortOrder(E_SORT_BY_RECENT_SPEAKERS);
- }
-}
-
-void LLParticipantList::LLParticipantListMenu::toggleAllowTextChat(const LLSD& userdata)
-{
-
- LLIMSpeakerMgr* mgr = dynamic_cast<LLIMSpeakerMgr*>(mParent.mSpeakerMgr);
- if (mgr)
- {
- const LLUUID speaker_id = mUUIDs.front();
- mgr->toggleAllowTextChat(speaker_id);
- }
-}
-
-void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata, U32 flags)
-{
- const LLUUID speaker_id = mUUIDs.front();
- BOOL is_muted = LLMuteList::getInstance()->isMuted(speaker_id, flags);
- std::string name;
-
- //fill in name using voice client's copy of name cache
- LLPointer<LLSpeaker> speakerp = mParent.mSpeakerMgr->findSpeaker(speaker_id);
- if (speakerp.isNull())
- {
- LL_WARNS("Speakers") << "Speaker " << speaker_id << " not found" << llendl;
- return;
- }
- LLAvatarListItem* item = (mParent.mAvatarList ? dynamic_cast<LLAvatarListItem*>(mParent.mAvatarList->getItemByValue(speaker_id)) : NULL);
- if (NULL == item) return;
-
- name = item->getAvatarName();
-
- LLMute::EType mute_type;
- switch (speakerp->mType)
- {
- case LLSpeaker::SPEAKER_AGENT:
- mute_type = LLMute::AGENT;
- break;
- case LLSpeaker::SPEAKER_OBJECT:
- mute_type = LLMute::OBJECT;
- break;
- case LLSpeaker::SPEAKER_EXTERNAL:
- default:
- mute_type = LLMute::EXTERNAL;
- break;
- }
- LLMute mute(speaker_id, name, mute_type);
-
- if (!is_muted)
- {
- LLMuteList::getInstance()->add(mute, flags);
- }
- else
- {
- LLMuteList::getInstance()->remove(mute, flags);
- }
-}
-
-void LLParticipantList::LLParticipantListMenu::toggleMuteText(const LLSD& userdata)
-{
- toggleMute(userdata, LLMute::flagTextChat);
-}
-
-void LLParticipantList::LLParticipantListMenu::toggleMuteVoice(const LLSD& userdata)
-{
- toggleMute(userdata, LLMute::flagVoiceChat);
-}
-
-bool LLParticipantList::LLParticipantListMenu::isGroupModerator()
-{
- if (!mParent.mSpeakerMgr)
- {
- llwarns << "Speaker manager is missing" << llendl;
- return false;
- }
-
- // Is session a group call/chat?
- if(gAgent.isInGroup(mParent.mSpeakerMgr->getSessionID()))
- {
- LLSpeaker* speaker = mParent.mSpeakerMgr->findSpeaker(gAgentID).get();
-
- // Is agent a moderator?
- return speaker && speaker->mIsModerator;
- }
- return false;
-}
-
-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";
-
- if (moderate_selected)
- {
- const LLUUID& selected_avatar_id = mUUIDs.front();
- bool is_muted = isMuted(selected_avatar_id);
- moderateVoiceParticipant(selected_avatar_id, is_muted);
- }
- else
- {
- bool unmute_all = userdata.asString() == "unmute_all";
- moderateVoiceAllParticipants(unmute_all);
- }
-}
-
-void LLParticipantList::LLParticipantListMenu::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute)
-{
- LLIMSpeakerMgr* mgr = dynamic_cast<LLIMSpeakerMgr*>(mParent.mSpeakerMgr);
- if (mgr)
- {
- mgr->moderateVoiceParticipant(avatar_id, unmute);
- }
-}
-
-void LLParticipantList::LLParticipantListMenu::moderateVoiceAllParticipants(bool unmute)
-{
- LLIMSpeakerMgr* mgr = dynamic_cast<LLIMSpeakerMgr*>(mParent.mSpeakerMgr);
- if (mgr)
- {
- if (!unmute)
- {
- LLSD payload;
- payload["session_id"] = mgr->getSessionID();
- LLNotificationsUtil::add("ConfirmMuteAll", LLSD(), payload, confirmMuteAllCallback);
- return;
- }
-
- mgr->moderateVoiceAllParticipants(unmute);
- }
-}
-
-// static
-void LLParticipantList::LLParticipantListMenu::confirmMuteAllCallback(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- // if Cancel pressed
- if (option == 1)
- {
- return;
- }
-
- const LLSD& payload = notification["payload"];
- const LLUUID& session_id = payload["session_id"];
-
- LLIMSpeakerMgr * speaker_manager = dynamic_cast<LLIMSpeakerMgr*> (
- LLIMModel::getInstance()->getSpeakerManager(session_id));
- if (speaker_manager)
- {
- speaker_manager->moderateVoiceAllParticipants(false);
- }
-
- return;
-}
-
-
-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 == std::string("can_add"))
- {
- // We can add friends if:
- // - there are selected people
- // - and there are no friends among selection yet.
-
- bool result = (mUUIDs.size() > 0);
-
- uuid_vec_t::const_iterator
- id = mUUIDs.begin(),
- uuids_end = mUUIDs.end();
-
- for (;id != uuids_end; ++id)
- {
- if ( *id == gAgentID || LLAvatarActions::isFriend(*id) )
- {
- result = false;
- break;
- }
- }
- return result;
- }
- else if (item == "can_call")
- {
- bool not_agent = mUUIDs.front() != gAgentID;
- bool can_call = not_agent && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
- return can_call;
- }
-
- 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();
- const LLUUID& id = mUUIDs.front();
-
- if (item == "is_muted")
- {
- return LLMuteList::getInstance()->isMuted(id, LLMute::flagTextChat);
- }
- else if (item == "is_allowed_text_chat")
- {
- LLPointer<LLSpeaker> selected_speakerp = mParent.mSpeakerMgr->findSpeaker(id);
-
- if (selected_speakerp.notNull())
- {
- return !selected_speakerp->mModeratorMutedText;
- }
- }
- else if(item == "is_blocked")
- {
- return LLMuteList::getInstance()->isMuted(id, LLMute::flagVoiceChat);
- }
- else if(item == "is_sorted_by_name")
- {
- return E_SORT_BY_NAME == mParent.getSortOrder();
- }
- else if(item == "is_sorted_by_recent_speakers")
- {
- return E_SORT_BY_RECENT_SPEAKERS == mParent.getSortOrder();
- }
-
- return false;
-}
-
bool LLParticipantList::LLAvatarItemRecentSpeakerComparator::doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const
{
if (mParent.mSpeakerMgr)