diff options
-rw-r--r-- | indra/newview/llappviewer.cpp | 17 | ||||
-rw-r--r-- | indra/newview/llstartup.cpp | 7 |
2 files changed, 18 insertions, 6 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) {}); } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 2f40beb9c4..dfad169813 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2082,9 +2082,6 @@ bool idle_startup() // We have a region, and just did a big inventory download. // We can estimate the user's connection speed, and set their // max bandwidth accordingly. JC -#ifdef LL_DISCORD - LLAppViewer::updateDiscordActivity(); -#endif if (gSavedSettings.getBOOL("FirstLoginThisInstall")) { // This is actually a pessimistic computation, because TCP may not have enough @@ -2330,6 +2327,10 @@ bool idle_startup() do_startup_frame(); } +#ifdef LL_DISCORD + LLAppViewer::updateDiscordActivity(); +#endif + return true; } |