|
57 | 57 | #include "llsdserialize.h" |
58 | 58 | #include "llviewermenu.h" // is_agent_mappable |
59 | 59 | #include "llviewerobjectlist.h" |
| 60 | +#include "llvoavatar.h" |
| 61 | +#include "llnearbyvoicemoderation.h" |
60 | 62 |
|
61 | 63 |
|
62 | 64 | const S32 EVENTS_PER_IDLE_LOOP_CURRENT_SESSION = 80; |
@@ -502,12 +504,13 @@ void LLFloaterIMContainer::idleUpdate() |
502 | 504 | const LLConversationItem *current_session = getCurSelectedViewModelItem(); |
503 | 505 | if (current_session) |
504 | 506 | { |
505 | | - if (current_session->getType() == LLConversationItem::CONV_SESSION_GROUP) |
| 507 | + bool is_nearby_chat = current_session->getType() == LLConversationItem::CONV_SESSION_NEARBY; |
| 508 | + if (current_session->getType() == LLConversationItem::CONV_SESSION_GROUP || is_nearby_chat) |
506 | 509 | { |
507 | 510 | // Update moderator options visibility |
508 | 511 | LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = current_session->getChildrenBegin(); |
509 | 512 | LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = current_session->getChildrenEnd(); |
510 | | - bool is_moderator = isGroupModerator(); |
| 513 | + bool is_moderator = isGroupModerator() || (is_nearby_chat && isNearbyChatModerator()); |
511 | 514 | bool can_ban = haveAbilityToBan(); |
512 | 515 | while (current_participant_model != end_participant_model) |
513 | 516 | { |
@@ -1685,6 +1688,10 @@ bool LLFloaterIMContainer::visibleContextMenuItem(const LLSD& userdata) |
1685 | 1688 | { |
1686 | 1689 | return isMuted(conversation_item->getUUID()); |
1687 | 1690 | } |
| 1691 | + else if ("can_allow_text_chat" == item) |
| 1692 | + { |
| 1693 | + return !isNearbyChatSpeakerSelected(); |
| 1694 | + } |
1688 | 1695 |
|
1689 | 1696 | return true; |
1690 | 1697 | } |
@@ -2009,9 +2016,27 @@ LLConversationViewParticipant* LLFloaterIMContainer::createConversationViewParti |
2009 | 2016 |
|
2010 | 2017 | bool LLFloaterIMContainer::enableModerateContextMenuItem(const std::string& userdata, bool is_self) |
2011 | 2018 | { |
2012 | | - // only group moderators can perform actions related to this "enable callback" |
2013 | | - if (!isGroupModerator()) |
| 2019 | + if (isNearbyChatModerator() && isNearbyChatSpeakerSelected()) |
| 2020 | + { |
| 2021 | + // Determine here which actions are allowed |
| 2022 | + if ("can_moderate_voice" == userdata) |
| 2023 | + { |
| 2024 | + return true; |
| 2025 | + } |
| 2026 | + else if (("can_mute" == userdata)) |
| 2027 | + { |
| 2028 | + return true; |
| 2029 | + } |
| 2030 | + else if ("can_unmute" == userdata) |
| 2031 | + { |
| 2032 | + return true; |
| 2033 | + } |
| 2034 | + |
| 2035 | + return false; |
| 2036 | + } |
| 2037 | + else if (!isGroupModerator()) |
2014 | 2038 | { |
| 2039 | + // only group moderators can perform actions related to this "enable callback" |
2015 | 2040 | return false; |
2016 | 2041 | } |
2017 | 2042 |
|
@@ -2144,7 +2169,37 @@ void LLFloaterIMContainer::banSelectedMember(const LLUUID& participant_uuid) |
2144 | 2169 |
|
2145 | 2170 | void LLFloaterIMContainer::moderateVoice(const std::string& command, const LLUUID& userID) |
2146 | 2171 | { |
2147 | | - if (!gAgent.getRegion()) return; |
| 2172 | + if (!gAgent.getRegion()) |
| 2173 | + { |
| 2174 | + return; |
| 2175 | + } |
| 2176 | + |
| 2177 | + if (isNearbyChatSpeakerSelected()) |
| 2178 | + { |
| 2179 | + if ("selected" == command) |
| 2180 | + { |
| 2181 | + // Toggle the voice icon display |
| 2182 | + LLAvatarActions::toggleMuteVoice(userID); |
| 2183 | + |
| 2184 | + // Request a mute/unmute using a capability request via the simulator |
| 2185 | + const bool mute_state = LLAvatarActions::isVoiceMuted(userID); |
| 2186 | + LLNearbyVoiceModeration::getInstance()->requestMuteChange(userID, mute_state); |
| 2187 | + } |
| 2188 | + else |
| 2189 | + if ("mute_all" == command) |
| 2190 | + { |
| 2191 | + // TODO: the SpatialVoiceModerationRequest has an mute_all/unmute_all |
| 2192 | + // verb but we do not have an equivalent of LLAvatarActions::toggleMuteVoice(userID); |
| 2193 | + // to visually mute all the speaker icons in the conversation floater |
| 2194 | + } |
| 2195 | + else |
| 2196 | + if ("unmute_all" == command) |
| 2197 | + { |
| 2198 | + // TODO: same idea as "mute_all" above |
| 2199 | + } |
| 2200 | + |
| 2201 | + return; |
| 2202 | + } |
2148 | 2203 |
|
2149 | 2204 | if (command.compare("selected")) |
2150 | 2205 | { |
@@ -2262,6 +2317,37 @@ LLSpeaker * LLFloaterIMContainer::getSpeakerOfSelectedParticipant(LLSpeakerMgr * |
2262 | 2317 | return speaker_managerp->findSpeaker(participant_itemp->getUUID()); |
2263 | 2318 | } |
2264 | 2319 |
|
| 2320 | +bool LLFloaterIMContainer::isNearbyChatSpeakerSelected() |
| 2321 | +{ |
| 2322 | + LLFolderViewItem *selectedItem = mConversationsRoot->getCurSelectedItem(); |
| 2323 | + if (NULL == selectedItem) |
| 2324 | + { |
| 2325 | + LL_WARNS() << "Current selected item is null" << LL_ENDL; |
| 2326 | + return NULL; |
| 2327 | + } |
| 2328 | + |
| 2329 | + conversations_widgets_map::const_iterator iter = mConversationsWidgets.begin(); |
| 2330 | + conversations_widgets_map::const_iterator end = mConversationsWidgets.end(); |
| 2331 | + const LLUUID * conversation_uuidp = NULL; |
| 2332 | + while(iter != end) |
| 2333 | + { |
| 2334 | + if (iter->second == selectedItem || iter->second == selectedItem->getParentFolder()) |
| 2335 | + { |
| 2336 | + conversation_uuidp = &iter->first; |
| 2337 | + break; |
| 2338 | + } |
| 2339 | + ++iter; |
| 2340 | + } |
| 2341 | + // Nearby chat ID is LLUUID::null |
| 2342 | + return conversation_uuidp->isNull(); |
| 2343 | +} |
| 2344 | + |
| 2345 | +bool LLFloaterIMContainer::isNearbyChatModerator() |
| 2346 | +{ |
| 2347 | + // TODO: Need a better heurestic for determining if this person is a moderator :) |
| 2348 | + return true; |
| 2349 | +} |
| 2350 | + |
2265 | 2351 | void LLFloaterIMContainer::toggleAllowTextChat(const LLUUID& participant_uuid) |
2266 | 2352 | { |
2267 | 2353 | LLIMSpeakerMgr * speaker_managerp = dynamic_cast<LLIMSpeakerMgr*>(getSpeakerMgrForSelectedParticipant()); |
|
0 commit comments