diff options
-rw-r--r-- | indra/newview/llappviewer.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llappviewer.h | 2 |
2 files changed, 12 insertions, 4 deletions
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 <discordpp.h> static std::shared_ptr<discordpp::Client> 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<discordpp::Client>(); 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")) { diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 2185295b30..283975833e 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -252,7 +252,7 @@ public: #ifdef LL_DISCORD static void initDiscordSocial(); - static void handleDiscordSocial(const LLSD& newvalue); + static void handleDiscordSocial(const LLSD& value); static void updateDiscordActivity(); #endif |