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.cpp46
1 files changed, 34 insertions, 12 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 756f3b33ed..0a941403f2 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -73,6 +73,7 @@
#include "llviewerregion.h"
#include "llcorehttputil.h"
#include "lluiusage.h"
+#include "llurlregistry.h"
#include <array>
@@ -199,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;
@@ -232,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");
}
@@ -243,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");
}
@@ -251,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");
}
@@ -260,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");
}
@@ -268,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:
@@ -325,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)
{
@@ -345,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);
}
}
}
@@ -3144,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())
@@ -3243,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
@@ -3257,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
@@ -3265,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));
}
}