summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCallum Prentice <callum@lindenlab.com>2025-10-13 14:57:01 -0700
committerCallum Prentice <callum@lindenlab.com>2025-10-13 14:57:01 -0700
commit53d83104522fc683126ba764b3e2101dc7442547 (patch)
treeae860b4b886e071c4cedb0a323186f6926716ca5
parent219da2a16b3ae6e1d2e02b05159b37fa1aca1f47 (diff)
Improve robustness of when moderator options appear and add some initial code for muting indivudual / everyone via the capability
-rw-r--r--indra/newview/llfloaterimcontainer.cpp42
-rw-r--r--indra/newview/llnearbyvoicemoderation.cpp97
-rw-r--r--indra/newview/llnearbyvoicemoderation.h6
3 files changed, 111 insertions, 34 deletions
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 9a016f6286..2b9fb9dd37 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -504,13 +504,12 @@ void LLFloaterIMContainer::idleUpdate()
const LLConversationItem *current_session = getCurSelectedViewModelItem();
if (current_session)
{
- bool is_nearby_chat = current_session->getType() == LLConversationItem::CONV_SESSION_NEARBY;
- if (current_session->getType() == LLConversationItem::CONV_SESSION_GROUP || is_nearby_chat)
+ if (current_session->getType() == LLConversationItem::CONV_SESSION_GROUP)
{
// Update moderator options visibility
LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = current_session->getChildrenBegin();
LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = current_session->getChildrenEnd();
- bool is_moderator = isGroupModerator() || (is_nearby_chat && isNearbyChatModerator());
+ bool is_moderator = isGroupModerator();
bool can_ban = haveAbilityToBan();
while (current_participant_model != end_participant_model)
{
@@ -533,6 +532,23 @@ void LLFloaterIMContainer::idleUpdate()
mGeneralTitleInUse = !needs_override;
setTitle(needs_override ? conversation_floaterp->getTitle() : mGeneralTitle);
}
+ const LLConversationItem* nearby_session = getSessionModel(LLUUID());
+ if (nearby_session)
+ {
+ LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = nearby_session->getChildrenBegin();
+ LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = nearby_session->getChildrenEnd();
+ while (current_participant_model != end_participant_model)
+ {
+ LLConversationItemParticipant* participant_model =
+ dynamic_cast<LLConversationItemParticipant*>((*current_participant_model).get());
+ if (participant_model)
+ {
+ participant_model->setModeratorOptionsVisible(isNearbyChatModerator());
+ }
+
+ current_participant_model++;
+ }
+ }
}
mParticipantRefreshTimer.setTimerExpirySec(1.0f);
@@ -2183,7 +2199,7 @@ void LLFloaterIMContainer::moderateVoice(const std::string& command, const LLUUI
// Request a mute/unmute using a capability request via the simulator
const bool mute_state = LLAvatarActions::isVoiceMuted(userID);
- LLNearbyVoiceModeration::getInstance()->requestMuteChange(userID, mute_state);
+ LLNearbyVoiceModeration::getInstance()->requestMuteIndividual(userID, mute_state);
}
else
if ("mute_all" == command)
@@ -2191,11 +2207,29 @@ void LLFloaterIMContainer::moderateVoice(const std::string& command, const LLUUI
// TODO: the SpatialVoiceModerationRequest has an mute_all/unmute_all
// verb but we do not have an equivalent of LLAvatarActions::toggleMuteVoice(userID);
// to visually mute all the speaker icons in the conversation floater
+
+ // Mute visually too
+ conversations_widgets_map::const_iterator iter = mConversationsWidgets.begin();
+ conversations_widgets_map::const_iterator end = mConversationsWidgets.end();
+ const LLUUID * conversation_uuidp = NULL;
+ while(iter != end)
+ {
+ const LLUUID id = (*iter).first;
+ ++iter;
+ }
+
+ // Send the mute_all request to the server
+ const bool mute_state = true;
+ LLNearbyVoiceModeration::getInstance()->requestMuteAll(mute_state);
}
else
if ("unmute_all" == command)
{
// TODO: same idea as "mute_all" above
+
+ // Send the unmute_all request to the server
+ const bool mute_state = false;
+ LLNearbyVoiceModeration::getInstance()->requestMuteAll(mute_state);
}
return;
diff --git a/indra/newview/llnearbyvoicemoderation.cpp b/indra/newview/llnearbyvoicemoderation.cpp
index d714fc36b4..5ae8feba08 100644
--- a/indra/newview/llnearbyvoicemoderation.cpp
+++ b/indra/newview/llnearbyvoicemoderation.cpp
@@ -50,53 +50,92 @@ LLVOAvatar* LLNearbyVoiceModeration::getVOAvatarFromId(const LLUUID& agent_id)
}
}
-void LLNearbyVoiceModeration::requestMuteChange(const LLUUID& agent_id, bool mute)
+const std::string LLNearbyVoiceModeration::getCapUrlFromRegion(LLViewerRegion* region)
+{
+ if (! region || ! region->capabilitiesReceived())
+ {
+ // TODO: Retry if fails since the capabilities may not have been received
+ // if this is called early into a region entry
+ LL_INFOS() << "Region or region capabilities unavailable." << LL_ENDL;
+ return std::string();
+ }
+ LL_INFOS() << "Capabilities for region " << region->getName() << " received." << LL_ENDL;
+
+ std::string url = region->getCapability("SpatialVoiceModerationRequest");
+ if (url.empty())
+ {
+ // TODO: Retry if fails since URL may not have not be available
+ // if this is called early into a region entry
+ LL_INFOS() << "Capability URL for region " << region->getName() << " is empty" << LL_ENDL;
+ return std::string();
+ }
+ LL_INFOS() << "Capability URL for region " << region->getName() << " is " << url << LL_ENDL;
+
+ return url;
+}
+
+void LLNearbyVoiceModeration::requestMuteIndividual(const LLUUID& agent_id, bool mute)
{
LLVOAvatar* avatar = getVOAvatarFromId(agent_id);
if (avatar)
{
- LLViewerRegion* region = avatar->getRegion();
- if (! region || ! region->capabilitiesReceived())
+ const std::string cap_url = getCapUrlFromRegion(avatar->getRegion());
+ if (cap_url.length())
{
- // TODO: Retry if fails since the capabilities may not have been received
- // if this is called early into a region entry
- LL_INFOS() << "Region or region capabilities unavailable" << LL_ENDL;
- return;
- }
- LL_INFOS() << "Region name is " << region->getName() << LL_ENDL;
+ const std::string operand = mute ? "mute" : "unmute";
- std::string url = region->getCapability("SpatialVoiceModerationRequest");
- if (url.empty())
- {
- // TODO: Retry if fails since URL may not have not be available
- // if this is called early into a region entry
- LL_INFOS() << "Capability URL is empty" << LL_ENDL;
- return;
+ LLSD body;
+ body["operand"] = operand;
+ body["agent_id"] = agent_id;
+ body["moderator_id"] = gAgent.getID();
+
+ const std::string agent_name = avatar->getFullname();
+ LL_INFOS() << "Resident " << agent_name
+ << " (" << agent_id << ")" << " applying " << operand << LL_ENDL;
+
+ std::string success_msg =
+ STRINGIZE("Resident " << agent_name
+ << " (" << agent_id << ")" << " nearby voice was set to " << operand);
+
+ std::string failure_msg =
+ STRINGIZE("Unable to change voice muting for resident "
+ << agent_name << " (" << agent_id << ")");
+
+ LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(
+ cap_url,
+ body,
+ success_msg,
+ failure_msg);
}
- LL_INFOS() << "Capability URL is " << url << LL_ENDL;
+ }
+}
- const std::string agent_name = avatar->getFullname();
+void LLNearbyVoiceModeration::requestMuteAll(bool mute)
+{
+ // Use our own avatar to get the region name
+ LLViewerRegion* region = gAgent.getRegion();
- const std::string operand = mute ? "mute" : "unmute";
+ const std::string cap_url = getCapUrlFromRegion(region);
+ if (cap_url.length())
+ {
+ const std::string operand = mute ? "mute_all" : "unmute_all";
LLSD body;
body["operand"] = operand;
- body["agent_id"] = agent_id;
body["moderator_id"] = gAgent.getID();
- LL_INFOS() << "Resident " << agent_name
- << " (" << agent_id << ")" << " applying " << operand << LL_ENDL;
+ LL_INFOS() << "For all residents in this region, applying: " << operand << LL_ENDL;
std::string success_msg =
- STRINGIZE("Resident " << agent_name
- << " (" << agent_id << ")" << " nearby voice was set to " << operand);
+ STRINGIZE("Nearby voice for all residents was set to: " << operand);
std::string failure_msg =
- STRINGIZE("Unable to change voice muting for resident "
- << agent_name << " (" << agent_id << ")");
+ STRINGIZE("Unable to set nearby voice for all residents to: " << operand);
- LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, body,
- success_msg,
- failure_msg);
+ LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(
+ cap_url,
+ body,
+ success_msg,
+ failure_msg);
}
}
diff --git a/indra/newview/llnearbyvoicemoderation.h b/indra/newview/llnearbyvoicemoderation.h
index 4275754dbf..8a1ca5af6b 100644
--- a/indra/newview/llnearbyvoicemoderation.h
+++ b/indra/newview/llnearbyvoicemoderation.h
@@ -37,5 +37,9 @@ class LLNearbyVoiceModeration :
public:
LLVOAvatar* getVOAvatarFromId(const LLUUID& id);
- void requestMuteChange(const LLUUID& userID, bool mute);
+ void requestMuteIndividual(const LLUUID& userID, bool mute);
+ void requestMuteAll(bool mute);
+
+ private:
+ const std::string getCapUrlFromRegion(LLViewerRegion* region);
};