summaryrefslogtreecommitdiff
path: root/indra/newview/llnotificationhandlerutil.cpp
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@geenzo.com>2026-10-13 14:34:41 -0400
committerJonathan "Geenz" Goodman <geenz@geenzo.com>2026-10-13 14:34:41 -0400
commit181fd93f799e15a6ff924362c4a05be8db3639af (patch)
treef3a3a530b80b1b17e71c7b6d7fa8b981b52c61f9 /indra/newview/llnotificationhandlerutil.cpp
parent8ba5d1a8adc47c21b23d9482e72de9517f9a98fc (diff)
parent083db782e29434ab17963fcac76b0ec3cd93b9d0 (diff)
Merge remote-tracking branch 'origin/release/26.5' into geenz/main-26.5
Diffstat (limited to 'indra/newview/llnotificationhandlerutil.cpp')
-rw-r--r--indra/newview/llnotificationhandlerutil.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index cdf7f05ada..935094fdc0 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -72,7 +72,7 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification)
void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
const std::string& session_name, const std::string& from_name,
const std::string& message, const LLUUID& session_owner_id,
- const LLUUID& from_id)
+ const LLUUID& from_id, const LLUUID& notification_id)
{
std::string from = from_name;
if (from_name.empty())
@@ -111,6 +111,14 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
S32 participant_unread = session->mParticipantUnreadMessageCount;
LLIMModel::instance().addMessageSilently(session_id, from, from_id,
message);
+
+ // Link the text fallback to its inline offer before the floater sees it.
+ // Name lookup may complete after other messages have arrived.
+ if (notification_id.notNull())
+ {
+ session->mMsgs.front()["notification_log_id"] = notification_id;
+ }
+
// we shouldn't increment counters when logging, so restore them
session->mNumUnread = unread;
session->mParticipantUnreadMessageCount = participant_unread;
@@ -121,15 +129,17 @@ void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
}
void log_name_callback(const LLAvatarName& av_name, const std::string& from_name,
- const std::string& message, const LLUUID& from_id)
+ const std::string& message, const LLUUID& from_id,
+ const LLUUID& notification_id)
{
LLHandlerUtil::logToIM(IM_NOTHING_SPECIAL, av_name.getUserName(), from_name, message,
- from_id, LLUUID());
+ from_id, LLUUID(), notification_id);
}
// static
-void LLHandlerUtil::logToIMP2P(const LLUUID& from_id, const std::string& message, bool to_file_only)
+void LLHandlerUtil::logToIMP2P(const LLUUID& from_id, const std::string& message, bool to_file_only,
+ const LLUUID& notification_id)
{
if (!gCacheName)
{
@@ -145,19 +155,20 @@ void LLHandlerUtil::logToIMP2P(const LLUUID& from_id, const std::string& message
if(to_file_only)
{
- LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, "", message, LLUUID()));
+ LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, "", message, LLUUID(), notification_id));
}
else
{
- LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, message, from_id));
+ LLAvatarNameCache::get(from_id, boost::bind(&log_name_callback, _2, INTERACTIVE_SYSTEM_FROM, message, from_id, notification_id));
}
}
// static
-void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only)
+void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_file_only,
+ const LLUUID& notification_id)
{
LLUUID from_id = notification->getPayload()["from_id"];
- logToIMP2P(from_id, notification->getMessage(), to_file_only);
+ logToIMP2P(from_id, notification->getMessage(), to_file_only, notification_id);
}
// static
@@ -327,11 +338,12 @@ void LLHandlerUtil::decIMMesageCounter(const LLNotificationPtr& notification)
{
LLSD arg;
arg["session_id"] = session_id;
- session->mNumUnread--;
+ // Keep the decrements clamped if notification dismissal follows session cleanup.
+ session->mNumUnread = llmax(0, session->mNumUnread - 1);
arg["num_unread"] = session->mNumUnread;
- session->mParticipantUnreadMessageCount--;
+ session->mParticipantUnreadMessageCount =
+ llmax(0, session->mParticipantUnreadMessageCount - 1);
arg["participant_unread"] = session->mParticipantUnreadMessageCount;
LLIMModel::getInstance()->mNewMsgSignal(arg);
}
}
-