From 08c0d3876bcddb2beeabb6fb2cd1a620eeb02576 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 10 Dec 2009 14:45:41 +0200 Subject: Work on major task EXT-2808 (Add speakers moderation (both voice and text) to the Voice Control Panel (Active Speakers List)) -- Implemented Actions to Mute/Unmute Participants without using Agent's Block List -- Updated missing strings to show error while moderating --HG-- branch : product-engine --- indra/newview/llparticipantlist.cpp | 101 ++++++++++++++++++++----- indra/newview/llparticipantlist.h | 4 +- indra/newview/skins/default/xui/en/strings.xml | 3 + 3 files changed, 90 insertions(+), 18 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 48a7a32a3b..a42b5e48cc 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -341,7 +341,7 @@ void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const if (uuids.size() == 0) return; const LLUUID speaker_id = mUUIDs.front(); - BOOL is_muted = LLMuteList::getInstance()->isMuted(speaker_id, LLMute::flagVoiceChat); + BOOL is_muted = isMuted(speaker_id); if (is_muted) { @@ -353,7 +353,6 @@ void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceUnMuteSelected", false); LLMenuGL::sMenuContainer->childSetVisible("ModerateVoiceUnMuteOthers", false); } - } void LLParticipantList::LLParticipantListMenu::toggleAllowTextChat(const LLSD& userdata) @@ -390,14 +389,14 @@ void LLParticipantList::LLParticipantListMenu::toggleAllowTextChat(const LLSD& u { gIMMgr->showSessionEventError( "mute", - "not_a_moderator", + "not_a_mod_error", mSessionID); } else { gIMMgr->showSessionEventError( "mute", - "generic", + "generic_request_error", mSessionID); } } @@ -450,34 +449,102 @@ void LLParticipantList::LLParticipantListMenu::toggleMuteVoice(const LLSD& userd toggleMute(userdata, LLMute::flagVoiceChat); } +bool LLParticipantList::LLParticipantListMenu::isMuted(const LLUUID& avatar_id) +{ + LLPointer 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"; + const LLUUID& selected_avatar_id = mUUIDs.front(); + bool is_muted = isMuted(selected_avatar_id); + + if (moderate_selected) + { + moderateVoiceParticipant(selected_avatar_id, is_muted); + } + else + { + moderateVoiceOtherParticipants(selected_avatar_id, is_muted); + } } -void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(const LLSD& userdata) + +void LLParticipantList::LLParticipantListMenu::moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute) +{ + if (gAgentID == avatar_id) return; // do not process myself + + 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"] = avatar_id; + data["params"]["mute_info"] = LLSD::emptyMap(); + 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( + url, + data, + new MuteVoiceResponder(mParent.mSpeakerMgr->getSessionID())); +} + +void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute) { LLSpeakerMgr::speaker_list_t speakers; mParent.mSpeakerMgr->getSpeakerList(&speakers, true); - const LLUUID& excluded_avatar_id = mUUIDs.front(); - bool should_mute = userdata.asString() == "mute"; for (LLSpeakerMgr::speaker_list_t::iterator iter = speakers.begin(); iter != speakers.end(); ++iter) { LLSpeaker* speakerp = (*iter).get(); LLUUID speaker_id = speakerp->mID; - if (excluded_avatar_id == speaker_id) continue; - LLMute mute(speaker_id, speakerp->mDisplayName, speakerp->mType == LLSpeaker::SPEAKER_AGENT ? LLMute::AGENT : LLMute::OBJECT); + if (excluded_avatar_id == speaker_id) continue; - if (should_mute) - { - LLMuteList::getInstance()->add(mute, LLMute::flagVoiceChat); - } - else - { - LLMuteList::getInstance()->remove(mute, LLMute::flagVoiceChat); - } + moderateVoiceParticipant(speaker_id, unmute); } } diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index 83191a5b8d..388d0b4fee 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -130,8 +130,10 @@ class LLParticipantList void toggleMuteVoice(const LLSD& userdata); // Voice moderation support + bool isMuted(const LLUUID& avatar_id); void moderateVoice(const LLSD& userdata); - void moderateVoiceOtherParticipants(const LLSD& userdata); + void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute); + void moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute); }; private: diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index c3650c71c3..8ac4ca95b9 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -2900,6 +2900,9 @@ If you continue to receive this message, contact the [SUPPORT_SITE]. Unable to send your message to the chat session with [RECIPIENT]. + + Error while moderating. + You have been removed from the group. -- cgit v1.2.3 From e8d3afc99c3914a060384ee9eb6d2b673e76e36f Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Thu, 10 Dec 2009 15:15:45 +0200 Subject: 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 --- indra/newview/llparticipantlist.cpp | 118 +++++++++++++----------------------- indra/newview/llparticipantlist.h | 39 ++++++++++++ 2 files changed, 81 insertions(+), 76 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index a42b5e48cc..9a6cafe0de 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -47,6 +47,44 @@ #if LL_MSVC #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally #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*/): mSpeakerMgr(data_source), mAvatarList(avatar_list), @@ -369,47 +407,10 @@ void LLParticipantList::LLParticipantListMenu::toggleAllowTextChat(const LLSD& u //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_mod_error", - mSessionID); - } - else - { - gIMMgr->showSessionEventError( - "mute", - "generic_request_error", - mSessionID); - } - } - } - - private: - LLUUID mSessionID; - }; - LLHTTPClient::post( url, data, - new MuteTextResponder(mParent.mSpeakerMgr->getSessionID())); + new ModerationResponder(mParent.mSpeakerMgr->getSessionID())); } void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata, U32 flags) @@ -488,47 +489,10 @@ void LLParticipantList::LLParticipantListMenu::moderateVoiceParticipant(const LL data["params"]["mute_info"] = LLSD::emptyMap(); 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( url, data, - new MuteVoiceResponder(mParent.mSpeakerMgr->getSessionID())); + new ModerationResponder(mParent.mSpeakerMgr->getSessionID())); } void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(const LLUUID& excluded_avatar_id, bool unmute) @@ -583,3 +547,5 @@ bool LLParticipantList::LLParticipantListMenu::checkContextMenuItem(const LLSD& } return false; } + +//EOF diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h index 388d0b4fee..a130edb553 100644 --- a/indra/newview/llparticipantlist.h +++ b/indra/newview/llparticipantlist.h @@ -130,9 +130,48 @@ class LLParticipantList void toggleMuteVoice(const LLSD& userdata); // Voice moderation support + /** + * Check whether specified by argument avatar is muted for group chat or not. + */ 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); + + /** + * 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); + + /** + * 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); }; -- cgit v1.2.3 From 862681b53a61783d292782c2415e8c5caddde136 Mon Sep 17 00:00:00 2001 From: Eugene Mutavchi Date: Thu, 10 Dec 2009 20:07:16 +0200 Subject: Fixed normal bug EXT-3095 (Mute sign is shown in Voice control panel for speaking avatar (refer to screenshot)) --HG-- branch : product-engine --- indra/newview/llcallfloater.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 895b4ed80e..d9fc4d54ab 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -263,13 +263,18 @@ void LLCallFloater::updateTitle() void LLCallFloater::initAgentData() { - childSetValue("user_icon", gAgentID); + LLPanel* my_panel = getChild ("my_panel"); - std::string name; - gCacheName->getFullName(gAgentID, name); - childSetValue("user_text", name); + if ( my_panel ) + { + my_panel->childSetValue("user_icon", gAgentID); + + std::string name; + gCacheName->getFullName(gAgentID, name); + my_panel->childSetValue("user_text", name); - LLOutputMonitorCtrl* speaking_indicator = getChild("speaking_indicator"); - speaking_indicator->setSpeakerId(gAgentID); + LLOutputMonitorCtrl* speaking_indicator = my_panel->getChild("speaking_indicator"); + speaking_indicator->setSpeakerId(gAgentID); + } } //EOF -- cgit v1.2.3 From 1967034ca0a71f95ddcd793187a3e07d3acc6639 Mon Sep 17 00:00:00 2001 From: Denis Serdjuk Date: Thu, 10 Dec 2009 21:40:46 +0200 Subject: implemented task EXT-2609 Implement 'block' option for inventory offers --HG-- branch : product-engine --- indra/newview/llscreenchannel.cpp | 37 ++++++++++++++++++++++ indra/newview/llscreenchannel.h | 11 +++++++ indra/newview/lltoast.h | 1 + indra/newview/llviewermessage.cpp | 30 ++++++++++++++---- .../newview/skins/default/xui/en/notifications.xml | 8 ++--- 5 files changed, 76 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index f66f725070..790be83e74 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -151,6 +151,33 @@ LLScreenChannel::~LLScreenChannel() } +std::list LLScreenChannel::findToasts(const Matcher& matcher) +{ + std::list res; + + // collect stored toasts + for (std::vector::iterator it = mStoredToastList.begin(); it + != mStoredToastList.end(); it++) + { + if (matcher.matches(it->toast->getNotification())) + { + res.push_back(it->toast); + } + } + + // collect displayed toasts + for (std::vector::iterator it = mToastList.begin(); it + != mToastList.end(); it++) + { + if (matcher.matches(it->toast->getNotification())) + { + res.push_back(it->toast); + } + } + + return res; +} + //-------------------------------------------------------------------------- void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect) { @@ -375,6 +402,16 @@ void LLScreenChannel::killToastByNotificationID(LLUUID id) } } +void LLScreenChannel::killMatchedToasts(const Matcher& matcher) +{ + std::list to_delete = findToasts(matcher); + for (std::list::iterator it = to_delete.begin(); it + != to_delete.end(); it++) + { + killToastByNotificationID((*it)-> getNotificationID()); + } +} + //-------------------------------------------------------------------------- void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel) { diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h index b8efbb148f..321fb244a1 100644 --- a/indra/newview/llscreenchannel.h +++ b/indra/newview/llscreenchannel.h @@ -151,6 +151,16 @@ public: LLScreenChannel(LLUUID& id); virtual ~LLScreenChannel(); + class Matcher + { + public: + Matcher(){} + virtual ~Matcher() {} + virtual bool matches(const LLNotificationPtr) const = 0; + }; + + std::list findToasts(const Matcher& matcher); + // Channel's outfit-functions // update channel's size and position in the World View void updatePositionAndSize(LLRect old_world_rect, LLRect new_world_rect); @@ -162,6 +172,7 @@ public: void addToast(const LLToast::Params& p); // kill or modify a toast by its ID void killToastByNotificationID(LLUUID id); + void killMatchedToasts(const Matcher& matcher); void modifyToastByNotificationID(LLUUID id, LLPanel* panel); // hide all toasts from screen, but not remove them from a channel void hideToastsFromScreen(); diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h index 0c3c598704..3d25fd4f02 100644 --- a/indra/newview/lltoast.h +++ b/indra/newview/lltoast.h @@ -139,6 +139,7 @@ public: // set whether this toast considered as hidden or not void setIsHidden( bool is_toast_hidden ) { mIsHidden = is_toast_hidden; } + const LLNotificationPtr& getNotification() { return mNotification;} // Registers signals/callbacks for events toast_signal_t mOnFadeSignal; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 31bd264e3a..93d040844c 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -926,34 +926,40 @@ void open_inventory_offer(const std::vector& items, const std::string& f void inventory_offer_mute_callback(const LLUUID& blocked_id, const std::string& first_name, const std::string& last_name, - BOOL is_group) + BOOL is_group, LLOfferInfo* offer = NULL) { std::string from_name; LLMute::EType type; - if (is_group) { type = LLMute::GROUP; from_name = first_name; } + else if(offer && offer->mFromObject) + { + //we have to block object by name because blocked_id is an id of owner + type = LLMute::BY_NAME; + from_name = offer->mFromName; + } else { type = LLMute::AGENT; from_name = first_name + " " + last_name; } - LLMute mute(blocked_id, from_name, type); + // id should be null for BY_NAME mute, see LLMuteList::add for details + LLMute mute(type == LLMute::BY_NAME ? LLUUID::null : blocked_id, from_name, type); if (LLMuteList::getInstance()->add(mute)) { LLPanelBlockedList::showPanelAndSelect(blocked_id); } // purge the message queue of any previously queued inventory offers from the same source. - class OfferMatcher : public LLNotifyBoxView::Matcher + class OfferMatcher : public LLNotificationsUI::LLScreenChannel::Matcher { public: OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {} - BOOL matches(const LLNotificationPtr notification) const + bool matches(const LLNotificationPtr notification) const { if(notification->getName() == "ObjectGiveItem" || notification->getName() == "ObjectGiveItemUnknownUser" @@ -966,7 +972,17 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, private: const LLUUID& blocked_id; }; - gNotifyBoxView->purgeMessagesMatching(OfferMatcher(blocked_id)); + + using namespace LLNotificationsUI; + LLChannelManager* channel_manager = LLChannelManager::getInstance(); + LLScreenChannel + * screen_channel = + dynamic_cast (channel_manager->findChannelByID( + LLUUID(gSavedSettings.getString("NotificationChannelUUID")))); + if (screen_channel != NULL) + { + screen_channel->killMatchedToasts(OfferMatcher(blocked_id)); + } } LLOfferInfo::LLOfferInfo(const LLSD& sd) @@ -1196,7 +1212,7 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const // * we can't build two messages at once. if (2 == button) { - gCacheName->get(mFromID, mFromGroup, &inventory_offer_mute_callback); + gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4,this)); } LLMessageSystem* msg = gMessageSystem; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index a6ed1f4c86..8c69699bb5 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -5026,14 +5026,14 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you [O index="0" name="Keep" text="Keep"/> -