From c1adf320af2ca2afd9ed05cccc9031b99fc7ee60 Mon Sep 17 00:00:00 2001 From: Secret Foxtail Date: Mon, 28 Jul 2025 05:23:18 -0600 Subject: Discord Rich Presence: Hide name & connect to llappviewer.cpp Add option to show/hide avatar name in privacy panel & connect rich presense directly to llappviewer.cpp --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llappviewer.cpp | 21 ++++++++++++--------- indra/newview/llappviewer.h | 2 +- indra/newview/llfloaterpreference.cpp | 19 +++---------------- .../default/xui/en/panel_preferences_privacy.xml | 12 ++++++++++++ 5 files changed, 39 insertions(+), 26 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index bb7211514d..7ada2925bf 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -1172,6 +1172,17 @@ Value 0 + ShowDiscordActivityDetails + + Comment + When set, show avatar name on Discord Rich Presence + Persist + 1 + Type + Boolean + Value + 0 + ShowDiscordActivityState Comment diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index caf56d5c79..2ea8b65ee1 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -5938,10 +5938,10 @@ void LLAppViewer::initDiscordSocial() } } -void LLAppViewer::handleDiscordSocial(bool enable) +void LLAppViewer::handleDiscordSocial(const LLSD& value) { static const uint64_t APPLICATION_ID = 1393451183741599796; - if (enable) + if (value.asBoolean()) { discordpp::AuthorizationArgs args{}; args.SetClientId(APPLICATION_ID); @@ -5986,13 +5986,16 @@ void LLAppViewer::updateDiscordActivity() discordpp::Activity activity; activity.SetType(discordpp::ActivityTypes::Playing); - 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("ShowDiscordActivityDetails")) + { + 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")) { diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 79db515970..2185295b30 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(bool enable); + static void handleDiscordSocial(const LLSD& newvalue); static void updateDiscordActivity(); #endif diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index c6e839c5de..4c8122bf71 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -237,20 +237,6 @@ void handleAppearanceCameraMovementChanged(const LLSD& newvalue) } } -#ifdef LL_DISCORD - -void handleDiscordSocial(const LLSD& newvalue) -{ - LLAppViewer::handleDiscordSocial(newvalue.asBoolean()); -} - -void handleDiscordActivityState(const LLSD& newvalue) -{ - LLAppViewer::updateDiscordActivity(); -} - -#endif - void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator) { numerator = 0; @@ -381,8 +367,9 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", boost::bind(&LLFloaterPreference::onDeleteTranscripts, this)); mCommitCallbackRegistrar.add("UpdateFilter", boost::bind(&LLFloaterPreference::onUpdateFilterTerm, this, false)); // Hook up for filtering #ifdef LL_DISCORD - gSavedSettings.getControl("EnableDiscord")->getCommitSignal()->connect(boost::bind(&handleDiscordSocial, _2)); - gSavedSettings.getControl("ShowDiscordActivityState")->getCommitSignal()->connect(boost::bind(&handleDiscordActivityState, _2)); + gSavedSettings.getControl("EnableDiscord")->getCommitSignal()->connect(boost::bind(&LLAppViewer::handleDiscordSocial, _2)); + gSavedSettings.getControl("ShowDiscordActivityDetails")->getCommitSignal()->connect(boost::bind(&LLAppViewer::updateDiscordActivity)); + gSavedSettings.getControl("ShowDiscordActivityState")->getCommitSignal()->connect(boost::bind(&LLAppViewer::updateDiscordActivity)); #endif } diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml index 86bc23d699..809c001904 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml @@ -148,6 +148,18 @@ top_pad="20" width="350" /> + +