From 3c8270c4dd60938c16c6f25110a10f71352156c5 Mon Sep 17 00:00:00 2001 From: Eugene Kondrashev Date: Mon, 9 Nov 2009 18:32:17 +0200 Subject: Implemented Sub-task EXT-1906 All speakers handling functional in old IM Floaters (Communicate) should be present in new IM Floaters/IM control panels, EXCLUDING voice related mute/moderation stuff --HG-- branch : product-engine --- indra/newview/llparticipantlist.cpp | 146 +++++++++++++++++++++ indra/newview/llparticipantlist.h | 23 ++++ .../skins/default/xui/en/menu_participant_list.xml | 31 +++++ 3 files changed, 200 insertions(+) create mode 100644 indra/newview/skins/default/xui/en/menu_participant_list.xml (limited to 'indra/newview') diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 2be0781487..21b40e25a0 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -32,14 +32,19 @@ #include "llviewerprecompiledheaders.h" +#include "llmenugl.h" +#include "lluictrlfactory.h" + // common includes #include "lltrans.h" #include "llavataractions.h" #include "llagent.h" +#include "llimview.h" #include "llparticipantlist.h" #include "llavatarlist.h" #include "llspeakers.h" +#include "llviewermenu.h" //LLParticipantList retrieves add, clear and remove events and updates view accordingly #if LL_MSVC @@ -64,6 +69,9 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av mAvatarList->setDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList)); mAvatarList->setRefreshCompleteCallback(boost::bind(&LLParticipantList::onAvatarListRefreshed, this, _1, _2)); + mParticipantListMenu = new LLParticipantListMenu(*this); + mAvatarList->setContextMenu(mParticipantListMenu); + //Lets fill avatarList with existing speakers LLAvatarList::uuid_vector_t& group_members = mAvatarList->getIDs(); @@ -83,6 +91,8 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av LLParticipantList::~LLParticipantList() { + delete mParticipantListMenu; + mParticipantListMenu = NULL; } void LLParticipantList::onAvatarListDoubleClicked(LLAvatarList* list) @@ -265,3 +275,139 @@ bool LLParticipantList::SpeakerModeratorUpdateListener::handleEvent(LLPointercreateFromFile( + "menu_participant_list.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance()); +} + +void LLParticipantList::LLParticipantListMenu::toggleAllowTextChat(const LLSD& userdata) +{ + const LLUUID speaker_id = mUUIDs.front(); + + std::string url = gAgent.getRegion()->getCapability("ChatSessionRequest"); + LLSD data; + data["method"] = "mute update"; + data["session-id"] = mParent.mSpeakerMgr->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"] = !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_moderator", + mSessionID); + } + else + { + gIMMgr->showSessionEventError( + "mute", + "generic", + mSessionID); + } + } + } + + private: + LLUUID mSessionID; + }; + + LLHTTPClient::post( + url, + data, + new MuteTextResponder(mParent.mSpeakerMgr->getSessionID())); +} + +void LLParticipantList::LLParticipantListMenu::toggleMuteText(const LLSD& userdata) +{ + const LLUUID speaker_id = mUUIDs.front(); + BOOL is_muted = LLMuteList::getInstance()->isMuted(speaker_id, LLMute::flagTextChat); + std::string name; + + //fill in name using voice client's copy of name cache + LLPointer speakerp = mParent.mSpeakerMgr->findSpeaker(speaker_id); + if (speakerp.isNull()) + { + return; + } + + name = speakerp->mDisplayName; + + LLMute mute(speaker_id, name, speakerp->mType == LLSpeaker::SPEAKER_AGENT ? LLMute::AGENT : LLMute::OBJECT); + + if (!is_muted) + { + LLMuteList::getInstance()->add(mute, LLMute::flagTextChat); + } + else + { + LLMuteList::getInstance()->remove(mute, LLMute::flagTextChat); + } +} + +bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& userdata) +{ + std::string item = userdata.asString(); + if (item == "can_mute_text") + { + return mUUIDs.front() != gAgentID; + } + else + if (item == "can_allow_text_chat") + { + LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mParent.mSpeakerMgr->getSessionID()); + return im_session->mType == IM_SESSION_GROUP_START && mParent.mSpeakerMgr->findSpeaker(gAgentID)->mIsModerator; + } + 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 selected_speakerp = mParent.mSpeakerMgr->findSpeaker(id); + + if (selected_speakerp.notNull()) + { + return !selected_speakerp->mModeratorMutedText; + } + } + return false; +} diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index fc34dd308b..1ff1515d16 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -32,6 +32,8 @@ #include "llviewerprecompiledheaders.h" #include "llevent.h" +#include "llpanelpeoplemenus.h" +#include "llimview.h" class LLSpeakerMgr; class LLAvatarList; @@ -105,6 +107,25 @@ class LLParticipantList SpeakerModeratorUpdateListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {} /*virtual*/ bool handleEvent(LLPointer event, const LLSD& userdata); }; + + /** + * Menu used in the participant list. + */ + class LLParticipantListMenu : public LLPanelPeopleMenus::ContextMenu + { + public: + LLParticipantListMenu(LLParticipantList& parent):mParent(parent){}; + /*virtual*/ LLContextMenu* createMenu(); + protected: + LLParticipantList& mParent; + private: + bool enableContextMenuItem(const LLSD& userdata); + bool checkContextMenuItem(const LLSD& userdata); + + void toggleAllowTextChat(const LLSD& userdata); + void toggleMuteText(const LLSD& userdata); + + }; private: void onAvatarListDoubleClicked(LLAvatarList* list); @@ -121,5 +142,7 @@ class LLParticipantList LLPointer mSpeakerClearListener; LLPointer mSpeakerModeratorListener; + LLParticipantListMenu* mParticipantListMenu; + EParticipantSortOrder mSortOrder; }; diff --git a/indra/newview/skins/default/xui/en/menu_participant_list.xml b/indra/newview/skins/default/xui/en/menu_participant_list.xml new file mode 100644 index 0000000000..802064992e --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_participant_list.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + -- cgit v1.2.3