From b7d33485406150bf466f61477cfd33d9bdacb705 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Mon, 28 Jul 2025 20:36:54 +0800 Subject: Discord time elapsed not reset on region change Time elapses right after viewer launch even before login. Plus parameter name change in header to make it the same as in implementation. --- indra/newview/llappviewer.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'indra/newview/llappviewer.cpp') diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2ea8b65ee1..b5175fbf71 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -282,6 +282,7 @@ using namespace LL; #define DISCORDPP_IMPLEMENTATION #include static std::shared_ptr gDiscordClient; +static uint64_t gDiscordTimestampsStart; #endif static LLAppViewerListener sAppViewerListener(LLAppViewer::instance); @@ -5922,6 +5923,7 @@ void LLAppViewer::metricsSend(bool enable_reporting) void LLAppViewer::initDiscordSocial() { + gDiscordTimestampsStart = time(nullptr); gDiscordClient = std::make_shared(); gDiscordClient->SetStatusChangedCallback([](discordpp::Client::Status status, discordpp::Client::Error, int32_t) { if (status == discordpp::Client::Status::Ready) @@ -5980,11 +5982,17 @@ void LLAppViewer::handleDiscordSocial(const LLSD& value) void LLAppViewer::updateDiscordActivity() { - if (gAgent.getID() == LLUUID::null) - return; - discordpp::Activity activity; activity.SetType(discordpp::ActivityTypes::Playing); + discordpp::ActivityTimestamps timestamps; + timestamps.SetStart(gDiscordTimestampsStart); + activity.SetTimestamps(timestamps); + + if (gAgent.getID() == LLUUID::null) + { + gDiscordClient->UpdateRichPresence(activity, [](discordpp::ClientResult) {}); + return; + } if (gSavedSettings.getBOOL("ShowDiscordActivityDetails")) { -- cgit v1.2.3