summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-12-29 16:59:46 +0800
committerErik Kundiman <erik@megapahit.org>2024-12-29 16:59:46 +0800
commit078a69ba818694911a5ca2c5e38f03452c0d71a7 (patch)
tree2231c5fbcb5124470f8d9f5a90f40827fe69c433
parent7a4ec2d83393171dc9321337536983c1af514ecd (diff)
Group chat blocker
https://megapahit.com/show_bug.cgi?id=9 At first I was trying to implement it without any peeking, but I got stuck at making the group IM blocking state synced across logins and user accounts, and found that there wasn't any data block reserved for it in SL group-related message protocols. I took a peek at Kokua's code, and the feature seemed to have been imported from Exodus viewer. There were exogroupmutelist files, which had some implementation of saving to a list named muted_groups.xml, which was also how I thought the information was stored at first, locally, meaning would have to be synced manually across user accounts. I tested the feature on Kokua, and found it didn't generate any file that lists the muted groups locally, instead it was indeed synced across devices, which meant that there must have been a way to store such information in SL servers. After looking carefully at the logs, only then I noticed a call from llmutelist, which I then realised it was wrapped by exogroupmutelist. So, this implementation forwards Exodus' way of using llmutelist to llpanelgroupgeneral, for saving and loading the states to and from SL server without using the exogroupmutelist files which contained more, but unused, code. Exodus' way is to use legacy mute, and construct the name by prepending "Group:" to the group ID (I had tried setting LLMute's enum to GROUP, instead of BY_NAME, and it didn't work). This implementation also differs in how the chat gets blocked in llimview.cpp, I just tried some few lines and it worked, though I don't know yet whether this implementation is good/better or not, so I leave it to others to improve it if they want.
-rw-r--r--indra/newview/llimview.cpp5
-rw-r--r--indra/newview/llpanelgroupgeneral.cpp57
-rw-r--r--indra/newview/llpanelgroupgeneral.h1
-rw-r--r--indra/newview/skins/default/xui/en/panel_group_general.xml12
4 files changed, 75 insertions, 0 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 609536f92d..cfd2535930 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -267,6 +267,11 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
}
else if(session->isGroupSessionType())
{
+ if (LLMuteList::getInstance()->isMuted(LLUUID::null, std::string{"Group:" + session_id.asString()}))
+ {
+ gIMMgr->leaveSession(session_id);
+ return;
+ }
user_preferences = gSavedSettings.getString("NotificationGroupChatOptions");
if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM")))
{
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index ca429ae2f8..0c331b4cec 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -34,6 +34,7 @@
#include "llsdparam.h"
#include "lluictrlfactory.h"
#include "roles_constants.h"
+#include "llmutelist.h"
// UI elements
#include "llbutton.h"
@@ -76,6 +77,7 @@ LLPanelGroupGeneral::LLPanelGroupGeneral()
mCtrlEnrollmentFee(NULL),
mSpinEnrollmentFee(NULL),
mCtrlReceiveNotices(NULL),
+ mCtrlReceiveGroupChat(NULL), // <exodus/>
mCtrlListGroup(NULL),
mActiveTitleLabel(NULL),
mComboActiveTitle(NULL)
@@ -154,6 +156,18 @@ bool LLPanelGroupGeneral::postBuild()
mCtrlReceiveNotices->set(accept_notices);
mCtrlReceiveNotices->setEnabled(data.mID.notNull());
}
+ // <exodus>
+ mCtrlReceiveGroupChat = getChild<LLCheckBoxCtrl>("receive_chat", recurse);
+ if(mCtrlReceiveGroupChat)
+ {
+ mCtrlReceiveGroupChat->setCommitCallback(onCommitUserOnly, this);
+ mCtrlReceiveGroupChat->setEnabled(data.mID.notNull());
+ if(data.mID.notNull())
+ {
+ mCtrlReceiveGroupChat->set(!LLMuteList::getInstance()->isMuted(LLUUID::null, std::string{"Group:" + data.mID.asString()}));
+ }
+ }
+ // </exodus>
mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse);
if (mCtrlListGroup)
@@ -389,6 +403,19 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
list_in_profile = mCtrlListGroup->get();
gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);
+ // <exodus>
+ if(mCtrlReceiveGroupChat)
+ {
+ if(mCtrlReceiveGroupChat->get())
+ {
+ LLMuteList::getInstance()->remove(LLMute(LLUUID::null, std::string{"Group:" + mGroupID.asString()}));
+ }
+ else
+ {
+ LLMuteList::getInstance()->add(LLMute(LLUUID::null, std::string{"Group:" + mGroupID.asString()}));
+ }
+ }
+ // </exodus>
resetDirty();
@@ -556,6 +583,16 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
}
}
+ // <exodus>
+ if (mCtrlReceiveGroupChat)
+ {
+ mCtrlReceiveGroupChat->setVisible(is_member);
+ if (is_member)
+ {
+ mCtrlReceiveGroupChat->setEnabled(mAllowEdit);
+ }
+ }
+ // </exodus>
if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
@@ -598,6 +635,7 @@ void LLPanelGroupGeneral::updateChanged()
mCtrlEnrollmentFee,
mSpinEnrollmentFee,
mCtrlReceiveNotices,
+ mCtrlReceiveGroupChat, // <exodus/>
mCtrlListGroup,
mActiveTitleLabel,
mComboActiveTitle
@@ -653,6 +691,12 @@ void LLPanelGroupGeneral::reset()
mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
+ // <exodus>
+ mCtrlReceiveGroupChat->set(false);
+ mCtrlReceiveGroupChat->setEnabled(false);
+ mCtrlReceiveGroupChat->setVisible(true);
+ // </exodus>
+
{
std::string empty_str = "";
mEditCharter->setText(empty_str);
@@ -684,6 +728,7 @@ void LLPanelGroupGeneral::resetDirty()
mCtrlEnrollmentFee,
mSpinEnrollmentFee,
mCtrlReceiveNotices,
+ mCtrlReceiveGroupChat, // <exodus/>
mCtrlListGroup,
mActiveTitleLabel,
mComboActiveTitle
@@ -730,6 +775,18 @@ void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
mCtrlListGroup->setEnabled(data.mID.notNull());
}
+ // <exodus>
+ mCtrlReceiveGroupChat = getChild<LLCheckBoxCtrl>("receive_chat");
+ if (mCtrlReceiveGroupChat)
+ {
+ if(data.mID.notNull())
+ {
+ mCtrlReceiveGroupChat->set(!LLMuteList::getInstance()->isMuted(LLUUID::null, std::string{"Group:" + data.mID.asString()}));
+ }
+ mCtrlReceiveGroupChat->setEnabled(data.mID.notNull());
+ }
+ // </exodus>
+
mCtrlShowInGroupList->setEnabled(data.mID.notNull());
mActiveTitleLabel = getChild<LLTextBox>("active_title_label");
diff --git a/indra/newview/llpanelgroupgeneral.h b/indra/newview/llpanelgroupgeneral.h
index e5d766dc40..37db2e96a0 100644
--- a/indra/newview/llpanelgroupgeneral.h
+++ b/indra/newview/llpanelgroupgeneral.h
@@ -98,6 +98,7 @@ private:
LLTextBox *mActiveTitleLabel;
LLComboBox *mComboActiveTitle;
LLComboBox *mComboMature;
+ LLCheckBoxCtrl *mCtrlReceiveGroupChat; // <exodus/>
};
#endif
diff --git a/indra/newview/skins/default/xui/en/panel_group_general.xml b/indra/newview/skins/default/xui/en/panel_group_general.xml
index 7290cbb5c6..aac4037bb3 100644
--- a/indra/newview/skins/default/xui/en/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_general.xml
@@ -145,6 +145,18 @@ Hover your mouse over the options for more help.
tool_tip="Sets whether you want to receive Notices from this group. Uncheck this box if this group is spamming you."
top_pad="5"
width="300" />
+ <!-- <exodus> -->
+ <check_box
+ height="16"
+ font="SansSerifSmall"
+ label="Receive group instant messages"
+ layout="topleft"
+ left="10"
+ name="receive_chat"
+ tool_tip="Sets whether you want to participate in group chat for this group."
+ top_pad="5"
+ width="300" />
+ <!-- </exodus> -->
<check_box
height="16"
label="Show in my profile"