Skip to content

[FEAT] Reject Adhoc Messages #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions indra/newview/app_settings/settings_per_account_alchemy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -319,5 +319,27 @@
<key>Value</key>
<string>This resident has turned on &apos;Autorespond mode&apos; like a boss.</string>
</map>
<key>AlchemyIgnoreAdHocSessions</key>
<map>
<key>Comment</key>
<string>Automatically ignore and leave all conference (ad-hoc) chats.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>AlchemyReportIgnoredAdHocSession</key>
<map>
<key>Comment</key>
<string>Reports to nearby chat if a conference (ad-hoc) has been ignored.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
</map>
</llsd>
3 changes: 1 addition & 2 deletions indra/newview/llagent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ LLAgent::LLAgent() :

mIsAutoRespond(false),
mIsAutoRespondNonFriends(false),

mIsDoNotDisturb(false),
mIsRejectTeleportOffers(false),
mIgnorePrejump(FALSE),
Expand Down Expand Up @@ -540,7 +540,6 @@ void LLAgent::init()
setAutoRespond(gSavedPerAccountSettings.getBOOL("AutoRespondModeSet"));
setAutoRespondNonFriends(gSavedPerAccountSettings.getBOOL("AutoRespondNonFriendsModeSet"));


if (!mTeleportFinishedSlot.connected())
{
mTeleportFinishedSlot = LLViewerParcelMgr::getInstance()->setTeleportFinishedCallback(boost::bind(&LLAgent::handleTeleportFinished, this));
Expand Down
6 changes: 6 additions & 0 deletions indra/newview/llfloaterpreference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3879,3 +3879,9 @@ void LLFloaterPreference::restoreIgnoredNotifications()
LLUI::getInstance()->mSettingGroups["ignores"]->setBOOL(it->first, it->second);
}
}

void LLFloaterPreference::onAdHocSelectionChange(const LLSD& newvalue)
{
S32 value = gSavedPerAccountSettings.getS32("AlchemyIgnoreAdHocSessions");
getChild<LLCheckBoxCtrl>("AlchemyReportIgnoredAdHocSession")->setEnabled(value != 0);
}
3 changes: 3 additions & 0 deletions indra/newview/llfloaterpreference.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ class LLFloaterPreference final : public LLFloater, public LLAvatarPropertiesObs
void onAutoRespondResponseChanged();
void onAutoRespondNonFriendsResponseChanged();

// This is used to control the enabling / disabling of the checkbox as the `enable_control="AlchemyIgnoreAdHocSessions"` is not boolean
void onAdHocSelectionChange(const LLSD& newValue);

// if the custom settings box is clicked
void onChangeCustom();
void updateMeterText(LLUICtrl* ctrl);
Expand Down
28 changes: 28 additions & 0 deletions indra/newview/llimview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
#include "llnotifications.h"
#include "llnotificationsutil.h"
#include "llfloaterimnearbychat.h"
#include "llslurl.h"
#include "llspeakers.h" //for LLIMSpeakerMgr
#include "lltextbox.h"
#include "lltoolbarview.h"
Expand Down Expand Up @@ -3201,6 +3202,7 @@ void LLIMMgr::addMessage(
fixed_session_name = session_name;
name_is_setted = true;
}
bool is_group_chat = false;
bool skip_message = false;
bool from_linden = LLMuteList::isLinden(from);
if (gSavedPerAccountSettings.getBOOL("VoiceCallsFriendsOnly") && !from_linden &&
Expand Down Expand Up @@ -3281,6 +3283,32 @@ void LLIMMgr::addMessage(
}
}

S32 is_rejecting_conferences = gSavedPerAccountSettings.getS32("AlchemyIgnoreAdHocSessions");
bool is_allowing_friend_conferences = (is_rejecting_conferences == 1);
bool is_friend = LLAvatarTracker::instance().isBuddy(other_participant_id);
is_group_chat = session->isGroupSessionType();

if (IM_NOTHING_SPECIAL != dialog && !is_group_chat && is_rejecting_conferences && !from_linden)
{
if (!is_allowing_friend_conferences || (is_allowing_friend_conferences && !is_friend))
{
bool report_ignored_conferences = gSavedPerAccountSettings.getBool("AlchemyReportIgnoredAdHocSession");
LLSD args;
args["AVATAR_NAME"] = LLSLURL("agent", other_participant_id, "about").getSLURLString();
LL_INFOS() << "Ignoring conference (ad-hoc) chat from " << args["AVATAR_NAME"] << LL_ENDL;
if (!gIMMgr->leaveSession(new_session_id))
{
LL_WARNS() << "Ad-hoc session " << new_session_id << " doesn't exist" << LL_ENDL;
}
else if (report_ignored_conferences)
{
LLNotificationsUtil::add("IgnoredAdHocSession", args);
}

return;
}
}

//Play sound for new conversations
if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation") == TRUE))
{
Expand Down
6 changes: 6 additions & 0 deletions indra/newview/skins/default/xui/en/notifications.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13356,4 +13356,10 @@ Incoming instant messages from anyone who is not your friend will now be answere
name="okignore"
yestext="OK"/>
</notification>
<notification
icon="notifytip.tga"
name="IgnoredAdHocSession"
type="notifytip">
You've been invited to a conference (ad-hoc) chat by [AVATAR_NAME], but the viewer automatically ignored it because of your settings.
</notification>
</notifications>
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,45 @@
name="ALDontRejectTeleportOffersFromFriends"
width="500"
control_name="ALDontRejectTeleportOffersFromFriends" />
<text
top_pad="15"
follows="left|top"
height="18"
type="string"
length="1"
layout="topleft"
left="15"
name="adhoc_ignore_label"
mouse_opaque="false"
width="500">
Reject Ad-Hoc (conferences):
</text>
<combo_box
control_name="AlchemyIgnoreAdHocSessions"
follows="left|top"
layout="topleft"
height="23"
name="adhoc_preference_combo"
width="115">
<item
label="Off"
name="adhoc_preference_allow_none"
value="0"/>
<item
label="Friends Only"
name="adhoc_preference_allow_friends"
value="1"/>
<item
label="All"
name="adhoc_preference_allow_all"
value="2"/>
</combo_box>
<check_box
layout="topleft"
follows="left|top"
left_delta="125"
height="18"
name="AlchemyReportIgnoredAdHocSession"
control_name="AlchemyReportIgnoredAdHocSession"
label="Report ignored conference chats"/>
</panel>
1 change: 1 addition & 0 deletions indra/newview/skins/default/xui/en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4576,4 +4576,5 @@ and report the problem.
</string>
<string name="AutoResponseModeDefault">The Resident you messaged has activated [APP_NAME] viewer&apos;s &apos;autorespond mode&apos; which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing.</string>
<string name="AutoResponseModeNonFriendsDefault">The Resident you messaged has activated [APP_NAME] viewer&apos;s &apos;autorespond mode&apos; which means they have requested not to be disturbed. Your message will still be shown in their IM panel for later viewing.</string>
<string name="IgnoredAdHocSession">You've been invited to a conference (ad-hoc) chat by [AVATAR_NAME], but the viewer automatically ignored it because of your settings.</string>
</strings>