summaryrefslogtreecommitdiff
path: root/indra/newview/llimview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llimview.cpp')
-rw-r--r--indra/newview/llimview.cpp51
1 files changed, 39 insertions, 12 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 34a4b5b230..0a941403f2 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -24,6 +24,8 @@
* $/LicenseInfo$
*/
+#include <array>
+
#include "llviewerprecompiledheaders.h"
#include "llimview.h"
@@ -71,6 +73,7 @@
#include "llviewerregion.h"
#include "llcorehttputil.h"
#include "lluiusage.h"
+#include "llurlregistry.h"
#include <array>
@@ -197,6 +200,9 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
LLFloaterIMSessionTab* session_floater = LLFloaterIMSessionTab::getConversation(session_id);
bool store_dnd_message = false; // flag storage of a dnd message
bool is_session_focused = session_floater->isTornOff() && session_floater->hasFocus();
+ bool contains_mention = LLUrlRegistry::getInstance()->containsAgentMention(msg["message"].asString());
+ static LLCachedControl<bool> play_snd_mention_pref(gSavedSettings, "PlaySoundChatMention", false);
+ bool play_snd_mention = contains_mention && play_snd_mention_pref && (msg["source_type"].asInteger() != CHAT_SOURCE_OBJECT);
if (!LLFloater::isVisible(im_box) || im_box->isMinimized())
{
conversations_floater_status = CLOSED;
@@ -230,7 +236,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
else
{
user_preferences = gSavedSettings.getString("NotificationNearbyChatOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM")))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNearbyChatIM")) && !play_snd_mention)
{
make_ui_sound("UISndNewIncomingIMSession");
}
@@ -241,7 +247,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
if (LLAvatarTracker::instance().isBuddy(participant_id))
{
user_preferences = gSavedSettings.getString("NotificationFriendIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM")))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundFriendIM")) && !play_snd_mention)
{
make_ui_sound("UISndNewIncomingIMSession");
}
@@ -249,7 +255,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
else
{
user_preferences = gSavedSettings.getString("NotificationNonFriendIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM")))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNonFriendIM")) && !play_snd_mention)
{
make_ui_sound("UISndNewIncomingIMSession");
}
@@ -258,7 +264,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
else if (session->isAdHocSessionType())
{
user_preferences = gSavedSettings.getString("NotificationConferenceIMOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM")))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundConferenceIM")) && !play_snd_mention)
{
make_ui_sound("UISndNewIncomingIMSession");
}
@@ -266,11 +272,18 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
else if(session->isGroupSessionType())
{
user_preferences = gSavedSettings.getString("NotificationGroupChatOptions");
- if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM")))
+ if (!gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundGroupChatIM")) && !play_snd_mention)
{
make_ui_sound("UISndNewIncomingIMSession");
}
}
+ if (play_snd_mention)
+ {
+ if (!gAgent.isDoNotDisturb())
+ {
+ make_ui_sound("UISndChatMention");
+ }
+ }
// actions:
@@ -323,7 +336,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
if ("openconversations" == user_preferences
|| ON_TOP == conversations_floater_status
|| ("toast" == user_preferences && ON_TOP != conversations_floater_status)
- || ("flash" == user_preferences && (CLOSED == conversations_floater_status
+ || (("flash" == user_preferences || contains_mention) && (CLOSED == conversations_floater_status
|| NOT_ON_TOP == conversations_floater_status))
|| is_dnd_msg)
{
@@ -343,7 +356,7 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
}
else
{
- im_box->flashConversationItemWidget(session_id, true);
+ im_box->flashConversationItemWidget(session_id, true, contains_mention);
}
}
}
@@ -3142,9 +3155,16 @@ void LLIMMgr::addMessage(
const LLUUID& region_id,
const LLVector3& position,
bool is_region_msg,
- U32 timestamp) // May be zero
+ U32 timestamp, // May be zero
+ LLUUID display_id,
+ std::string_view display_name)
{
LLUUID other_participant_id = target_id;
+ std::string message_display_name = (display_name.empty()) ? from : std::string(display_name);
+ if (display_id.isNull() && (display_name.empty()))
+ {
+ display_id = other_participant_id;
+ }
LLUUID new_session_id = session_id;
if (new_session_id.isNull())
@@ -3192,6 +3212,7 @@ void LLIMMgr::addMessage(
if (session)
{
skip_message &= !session->isGroupSessionType(); // Do not skip group chats...
+ skip_message |= LLMuteList::getInstance()->isMuted(LLUUID::null, std::string{"Group:" + new_session_id.asString()}); // unless the group is muted.
if (skip_message)
{
gIMMgr->leaveSession(new_session_id);
@@ -3240,9 +3261,13 @@ void LLIMMgr::addMessage(
}
//Play sound for new conversations
- if (!skip_message & !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation")))
+ if (!skip_message && !gAgent.isDoNotDisturb() && (gSavedSettings.getBOOL("PlaySoundNewConversation")))
{
- make_ui_sound("UISndNewIncomingIMSession");
+ static LLCachedControl<bool> play_snd_mention_pref(gSavedSettings, "PlaySoundChatMention", false);
+ if (!play_snd_mention_pref || !LLUrlRegistry::getInstance()->containsAgentMention(msg))
+ {
+ make_ui_sound("UISndNewIncomingIMSession");
+ }
}
}
else
@@ -3254,7 +3279,7 @@ void LLIMMgr::addMessage(
if (!LLMuteList::getInstance()->isMuted(other_participant_id, LLMute::flagTextChat) && !skip_message)
{
- LLIMModel::instance().addMessage(new_session_id, from, other_participant_id, msg, true, is_region_msg, timestamp);
+ LLIMModel::instance().addMessage(new_session_id, message_display_name, display_id, msg, true, is_region_msg, timestamp);
}
// Open conversation floater if offline messages are present
@@ -3262,7 +3287,7 @@ void LLIMMgr::addMessage(
{
LLFloaterReg::showInstance("im_container");
LLFloaterReg::getTypedInstance<LLFloaterIMContainer>("im_container")->
- flashConversationItemWidget(new_session_id, true);
+ flashConversationItemWidget(new_session_id, true, LLUrlRegistry::getInstance()->containsAgentMention(msg));
}
}
@@ -3550,6 +3575,7 @@ void LLIMMgr::inviteToSession(
&& voice_invite && "VoiceInviteQuestionDefault" == question_type)
{
LL_INFOS("IMVIEW") << "Rejecting voice call from initiating muted resident " << caller_name << LL_ENDL;
+ payload["voice_channel_info"] = voice_channel_info;
LLIncomingCallDialog::processCallResponse(1, payload);
return;
}
@@ -3598,6 +3624,7 @@ void LLIMMgr::inviteToSession(
send_do_not_disturb_message(gMessageSystem, caller_id, session_id);
}
// silently decline the call
+ payload["voice_channel_info"] = voice_channel_info;
LLIncomingCallDialog::processCallResponse(1, payload);
return;
}