From 26355988f03b6d809c2e6b1ef9d59262e898d7fd Mon Sep 17 00:00:00 2001 From: cinder <cinder@cinderblocks.biz> Date: Sun, 27 Nov 2022 14:03:17 -0600 Subject: [PATCH] Plumbing for group mutes/Katherine Berry derived --- indra/newview/llgroupactions.cpp | 2 ++ indra/newview/llimview.cpp | 3 ++- indra/newview/llmutelist.cpp | 21 ++++++++++++++++++++- indra/newview/llmutelist.h | 5 +++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index e63c84cfd26..f76f8ea22e6 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -497,6 +497,8 @@ LLUUID LLGroupActions::startIM(const LLUUID& group_id) LLGroupData group_data; if (gAgent.getGroupData(group_id, group_data)) { + // Unmute the group if the user tries to start a session with it. + LLMuteList::instance().removeGroup(group_id); LLUUID session_id = gIMMgr->addSession( group_data.mName, IM_SESSION_GROUP_START, diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 35235d31e5d..075d44b9e29 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2780,7 +2780,8 @@ void LLIMMgr::addMessage( // // Logically it would make more sense to reject the session sooner, in another area of the // // code, but the session has to be established inside the server before it can be left. -// if (LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !from_linden) +// if ((LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !from_linden) + || LLMuteList::getInstance()->isGroupMuted(new_session_id)) // { // LL_WARNS() << "Leaving IM session from initiating muted resident " << from << LL_ENDL; // if (!gIMMgr->leaveSession(new_session_id)) diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 625f04589f8..c6102a9d722 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -70,7 +70,7 @@ namespace { // This method is used to return an object to mute given an object id. // Its used by the LLMute constructor and LLMuteList::isMuted. - LLViewerObject* get_object_to_mute_from_id(LLUUID object_id) + LLViewerObject* get_object_to_mute_from_id(const LLUUID& object_id) { LLViewerObject *objectp = gObjectList.findObject(object_id); if ((objectp) && (!objectp->isAvatar())) @@ -793,6 +793,25 @@ void LLMuteList::cache(const LLUUID& agent_id) } } +//----------------------------------------------------------------------------- +// Group muting +//----------------------------------------------------------------------------- + +BOOL LLMuteList::addGroup(const LLUUID& group_id) +{ + return add(LLMute(LLUUID::null, std::string("Group:" + group_id.asString()), LLMute::BY_NAME)); +} + +BOOL LLMuteList::removeGroup(const LLUUID& group_id) +{ + return remove(LLMute(LLUUID::null, std::string("Group:" + group_id.asString()), LLMute::BY_NAME)); +} + +BOOL LLMuteList::isGroupMuted(const LLUUID& group_id) +{ + return isMuted(LLUUID::null, std::string("Group:" + group_id.asString())); +} + //----------------------------------------------------------------------------- // Static message handlers //----------------------------------------------------------------------------- diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index 234a2aa28ee..34ae0201b5d 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -117,6 +117,11 @@ class LLMuteList final : public LLSingleton<LLMuteList> // call this method on logout to save everything. void cache(const LLUUID& agent_id); + // group functions + BOOL addGroup(const LLUUID& group_id); + BOOL removeGroup(const LLUUID& group_id); + BOOL isGroupMuted(const LLUUID& group_id); + private: BOOL loadFromFile(const std::string& filename); BOOL saveToFile(const std::string& filename); -- GitLab