summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-07-28 16:33:28 +0800
committerErik Kundiman <erik@megapahit.org>2025-07-28 16:33:28 +0800
commit94f51d5a4b16d76e46e53802cc188da8c9eb795b (patch)
tree11c289a9439de160e6e3bc3fd3c94232c7debfb1 /indra/newview/llappviewer.cpp
parent649fb14b78e7f42acc5f5bdb3c16081d66865945 (diff)
Show display name too on Discord Rich Presence
Avatar name cache can be used right away upon login now after I moved the update call to the end of PRECACHE section in llstartup.
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 3d8dfd39e6..9124651e84 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -5982,11 +5982,21 @@ void LLAppViewer::handleDiscordSocial(bool enable)
void LLAppViewer::updateDiscordActivity()
{
+ if (gAgent.getID() == LLUUID::null)
+ return;
+
discordpp::Activity activity;
activity.SetType(discordpp::ActivityTypes::Playing);
- if (gAgentAvatarp)
- activity.SetDetails(gAgentAvatarp->getFullname());
- if (gAgent.getID() != LLUUID::null && gSavedSettings.getBOOL("ShowDiscordActivityState"))
+
+ LLAvatarName av_name;
+ LLAvatarNameCache::get(gAgent.getID(), &av_name);
+ auto name = av_name.getUserName();
+ auto displayName = av_name.getDisplayName();
+ if (name != displayName)
+ name = displayName + " (" + name + ")";
+ activity.SetDetails(name);
+
+ if (gSavedSettings.getBOOL("ShowDiscordActivityState"))
{
auto agent_pos_region = gAgent.getPositionAgent();
S32 pos_x = S32(agent_pos_region.mV[VX] + 0.5f);
@@ -6009,6 +6019,7 @@ void LLAppViewer::updateDiscordActivity()
}
activity.SetState(llformat("%s (%d, %d, %d)", gAgent.getRegion()->getName().c_str(), pos_x, pos_y, pos_z));
}
+
gDiscordClient->UpdateRichPresence(activity, [](discordpp::ClientResult) {});
}