diff options
| author | Erik Kundiman <erik@megapahit.org> | 2025-07-27 14:26:47 +0800 | 
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2025-07-27 14:26:47 +0800 | 
| commit | dccf087d652ecf98d24927a397c38cc0c9db3ab4 (patch) | |
| tree | 5674accffb95357ed057da983f1886f73e5151a1 /indra/newview/llstartup.cpp | |
| parent | 145ae5aeea43080bbf14de66d3d3886e01b8bb34 (diff) | |
Move Discord-related code to llappviewer.cpp
The doFrame is the one called over and over again, so running the
Discord callbacks from there shouldn't have one extra function
overhead, while running the Discord initialisation is only once so
it's much more okay to have the extra function overhead there.
Diffstat (limited to 'indra/newview/llstartup.cpp')
| -rw-r--r-- | indra/newview/llstartup.cpp | 44 | 
1 files changed, 1 insertions, 43 deletions
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 834b99555e..8d010553a0 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -217,12 +217,6 @@  #include "fsfloatersearch.h" -#ifdef LL_DISCORD -#define DISCORDPP_IMPLEMENTATION -#include <discordpp.h> -static std::shared_ptr<discordpp::Client> gDiscordClient; -#endif -  //  // exported globals  // @@ -758,14 +752,7 @@ bool idle_startup()          }  #ifdef LL_DISCORD -        gDiscordClient = std::make_shared<discordpp::Client>(); -        gDiscordClient->SetStatusChangedCallback([](discordpp::Client::Status status, discordpp::Client::Error, int32_t) { -            if (status == discordpp::Client::Status::Ready) { -                discordpp::Activity activity; -                activity.SetType(discordpp::ActivityTypes::Playing); -                gDiscordClient->UpdateRichPresence(activity, [](discordpp::ClientResult) {}); -            } -        }); +        LLAppViewer::initDiscordSocial();  #endif          // @@ -3447,35 +3434,6 @@ bool LLStartUp::startLLProxy()      return proxy_ok;  } -#ifdef LL_DISCORD - -void LLStartUp::runDiscordCallbacks() -{ -    discordpp::RunCallbacks(); -} - -void LLStartUp::handleDiscordSocial() -{ -    static const uint64_t DISCORD_APPLICATION_ID = 1393451183741599796; -    discordpp::AuthorizationArgs discordAuthArgs{}; -    discordAuthArgs.SetClientId(DISCORD_APPLICATION_ID); -    discordAuthArgs.SetScopes(discordpp::Client::GetDefaultPresenceScopes()); -    auto discordCodeVerifier = gDiscordClient->CreateAuthorizationCodeVerifier(); -    discordAuthArgs.SetCodeChallenge(discordCodeVerifier.Challenge()); -    gDiscordClient->Authorize(discordAuthArgs, [discordCodeVerifier](auto result, auto code, auto redirectUri) { -        if (result.Successful()) { -            gDiscordClient->GetToken(DISCORD_APPLICATION_ID, code, discordCodeVerifier.Verifier(), redirectUri, [](discordpp::ClientResult result, std::string accessToken, std::string, discordpp::AuthorizationTokenType, int32_t, std::string) { -                gDiscordClient->UpdateToken(discordpp::AuthorizationTokenType::Bearer, accessToken, [](discordpp::ClientResult result) { -                    if (result.Successful()) -                        gDiscordClient->Connect(); -                    }); -            }); -        } -    }); -} - -#endif -  bool login_alert_done(const LLSD& notification, const LLSD& response)  {      LLPanelLogin::giveFocus();  | 
