summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-08-01 18:25:28 +0800
committerErik Kundiman <erik@megapahit.org>2025-08-01 18:25:28 +0800
commit7588afc86a016c00e6263284bc0db6d684c43895 (patch)
tree85391f8de1d9b142d09c7d3f7403826e165a617d /indra
parent3c464b4d8bb9bed58edc0418a8c91e8a609b5160 (diff)
Increase chance of arrival notification, correctlyHEADmain
Full (user) name should suffice for the chat log, as it's the one that is more of a reference anyway instead of display name. The other avatar's display name is still displayed on the header anyway. Seems like display names have higher chance of being empty, that we would miss it being logged/notified because of that. Also, now that we've optimised the avatars' positions' retrieval, the numbers can come later after some avatar arrives, that getting the position using the avatar's ID as the key would result in zero. In that case, rather than reporting wrong distances (like 403996.2), it's better to just skip distance information (it shouldn't matter that much anyway).
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llvoavatar.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 082b1349cf..f52d45b4b9 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -821,13 +821,11 @@ LLVOAvatar::~LLVOAvatar()
static LLCachedControl<bool> show_arrival_departures(gSavedSettings, "IMShowArrivalsDepartures", false);
if (show_arrival_departures)
{
- LLAvatarName av_name;
- LLAvatarNameCache::get(getID(), &av_name);
- auto display_name = av_name.getDisplayName();
- if (!display_name.empty())
+ auto full_name = getFullname();
+ if (!full_name.empty())
{
- LLChat chat{llformat("%s left.", display_name.c_str())};
- chat.mFromName = display_name;
+ LLChat chat{llformat("%s left.", full_name.c_str())};
+ chat.mFromName = full_name;
chat.mFromID = getID();
LLSD args;
args["COLOR"] = "ChatHistoryTextColor";
@@ -2587,15 +2585,15 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys,
static LLCachedControl<bool> show_arrival_departures(gSavedSettings, "IMShowArrivalsDepartures", false);
if (show_arrival_departures)
{
- LLAvatarName av_name;
- LLAvatarNameCache::get(getID(), &av_name);
- auto display_name = av_name.getDisplayName();
- if (!display_name.empty())
+ auto full_name = getFullname();
+ if (!full_name.empty())
{
auto avatarsPositions = gAgent.getAvatarsPositions();
- LLChat chat{llformat("%s arrived (%.1f m).", display_name.c_str(), dist_vec(avatarsPositions[getID()], gAgent.getPositionGlobal()))};
- chat.mFromName = display_name;
- chat.mFromID = getID();
+ auto id = getID();
+ auto avatarPosition = avatarsPositions[id];
+ LLChat chat{std::string{full_name + " arrived" + (avatarPosition.isExactlyZero() ? "" : llformat(" (%.1f m)", dist_vec(avatarPosition, gAgent.getPositionGlobal()))) + "."}};
+ chat.mFromName = full_name;
+ chat.mFromID = id;
LLSD args;
args["COLOR"] = "ChatHistoryTextColor";
LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);