Commit Graph

120 Commits (1bbad3fd00a9db28944bab1ec9c0e10fd5d1c2f2)

Author SHA1 Message Date
Andrey Kleshchev 61d53a8731 #4470 Plug in Discord SDK package 2025-08-05 18:26:29 +03:00
Erik Kundiman afcc64cb07
Rich Presence support using Discord Social SDK (#4457)
* Rich Presence support using Discord Social SDK

Download DiscordSocialSdk-1.4.9649.zip from
https://discord.com/developers/applications/1394782217405862001/social-sdk/downloads
Add -DUSE_DISCORD:BOOL=ON to your cmake line.
The Discord app needs to be set to be a public client in the OAuth2 tab.
All Discord-related code are contained within one file, llstartup.cpp,
and other classes access it through some opaque layer, static functions,
otherwise we'd get these "duplicate symbol" linking errors.

* 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.

* panel_preferences_privacy tabs

Add tab and checkboxes for discord social SDK integration options to panel_preferences_privacy.xml

* Shorten Discord-related local variable names

* Connect to Discord now through privacy tab

Now the access token is saved the way passwords are saved, but
without a username, so we can have some persistence without having
to implement an OAuth2 backend server cause we would have to store
those tokens there anyway still, and it's just simpler to not go
that way. Discord Social SDK doesn't have a helper for sending code
to a custom server anyway, that we would have to have some
asynchronous HTTP requestor ready.
Show location check button gets enabled only when Discord
integration is enabled, though it's not functioning yet.

* Location for Discord Rich Presence Activity State

I was going to use LLAgentUI::buildLocationString but there's no
location format that shows only region and coords without having
to have the parcel name empty, so I copied buildLocationString
implementation in the case of LOCATION_FORMAT_NO_MATURITY but when
the parcel name is empty.
I had to make updateDiscordActivity check agent's ID and the
existence of agent avatar pointer first before trying to set
Activity Details or State, cause I like the "Show location" button
be checkable not only after online when both the ID & pointer will
have existed. I think this way is simpler than programmatically
enabling the "Show location" button after the user is logged in.
I put a trigger to Activity update somewhere after the user is
logged in for now, not yet after a TP.
The elapsed time gets reset whenever Activity is updated for now,
but I'll try to make elapsed time extended instead.
No Party for now, because I couldn't find a way to make a Party
shown without showing its CurrentSize (I could still get away not
showing its MaxSize by setting it to 0), so the State (location)
is shown above the elapsed time, not on the right of it.
I'll try to figure out to get some representative numbers for its
CurrentSize & MaxSize next.
Also no privacy on hiding the username for now, until the UI is
ready.

* Update Rich Presence location on region change

I had to find a spot in source code where it doesn't cause a crash
(it did in LLAgent::setRegion), but I'm not removing the one in
llstartup.cpp because on login, the one in llviewermessage.cpp
gets only the placeholder coords (10, 10, 10).

* Show display name too on Discord Rich Presence

Avatar name cache can be used right away upon login now after I
moved the update call to the end of PRECACHE section in llstartup.

* Show Discord Rich Presence Activity Party

By setting CurrentSize to the number of people within chat radius,
and MaxSize to the number of people within near range.

* Call updateDiscordActivity too in Discord init

so when the user enables the integration after being logged in,
the init can show the name and location right away.

* 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

* 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.

* Cache bool setting retrievals in updateDiscordActivity

As suggested by Andrey Kleschev.
getBOOL and getF32 are expensive, so using `static LLCachedControl<>`
is the way to do it in llappviewer.cpp.

* Check Discord creds existence before getting token

as suggested by Andrey Kleshchev, anticipating external factors
such as user moving settings from another PC.

* Tracy visibility for looped Discord function calls

As suggested by Andrey Kleshchev. They likely can get pricey so
they need to be visible in the profiler.

* Discord-related error handling/logging

plus delay saving Discord credentials to only after the access
token is successfully updated on Discord, and try to disconnect
from Discord when the integration gets disabled regardless whether
there are credentials to delete or not and whether there's an
access token to revoke or not.

* Use getAvatars already called for Discord Party numbers

so we don't have to make any extra getAvatars calls just for this,
as it's pricy in crowds, and we'll just be piggybacking
`updateSpeakerList` and `updateNearbyList`.

* Assemble Discord Activity Details only once

by saving it to a static global string for reuse.

* Remove updateDiscordActivity call in startup loop

The State field (region & coords) is updated well enough without it
now.

* Rename handleDiscordSocial to toggleDiscordIntegration

* Update Discord Activity only when integration is enabled

No need to check setting for the status change callback one,
because getting there would need to be connected to Discord first,
which in turn needs the integration to be enabled first.

---------

Co-authored-by: Secret Foxtail <remmy@megapahit.net>
2025-07-31 08:54:39 -07:00
Brad Linden c106221726 Merge remote-tracking branch 'origin/release/2024.06-atlasaurus' into develop
# Conflicts:
 #	.github/workflows/build.yaml
 #	indra/llui/llscrolllistctrl.cpp
2024-08-09 15:43:06 -07:00
Brad Linden 3b2c32fdf9 Merge remote-tracking branch 'origin/release/webrtc-voice' into release/2024.06-atlasaurus
# Conflicts:
 #	.github/workflows/build.yaml
 #	indra/newview/CMakeLists.txt
 #	indra/newview/llspeakers.cpp
 #	indra/newview/llvoicechannel.cpp
 #	indra/newview/llvoicechannel.h
 #	indra/newview/llvoiceclient.cpp
 #	indra/newview/llvoiceclient.h
 #	indra/newview/llvoicewebrtc.cpp
2024-08-09 15:10:13 -07:00
Andrey Kleshchev 9094d0281d Adjust some LLVoiceClient functions
Feels like I should have made isParticipant and getParticipantList
static to minimize singleton dependency/calls
2024-08-07 14:19:49 +03:00
Rye Mutt c4e921828a Optimization and cleanup of various color finds during draw 2024-08-04 23:11:57 -04:00
Andrey Kleshchev 0f47b68e92 viewer#1821 Crash at getSessionID() 2024-06-25 11:01:58 -07:00
Andrey Kleshchev 9fb9e8f33c viewer#1821 Crash at getSessionID() 2024-06-21 19:31:46 +03:00
Roxie Linden 5e60392c27 Merge branch 'develop' of github.com:secondlife/viewer into roxie/webrtc-voice 2024-06-13 14:59:28 -07:00
Ansariel e2e37cced8 Fix line endlings 2024-05-22 22:40:26 +03:00
Ansariel 1b67dd855c Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
#	autobuild.xml
#	indra/cmake/CMakeLists.txt
#	indra/cmake/GoogleMock.cmake
#	indra/llaudio/llaudioengine_fmodstudio.cpp
#	indra/llaudio/llaudioengine_fmodstudio.h
#	indra/llaudio/lllistener_fmodstudio.cpp
#	indra/llaudio/lllistener_fmodstudio.h
#	indra/llaudio/llstreamingaudio_fmodstudio.cpp
#	indra/llaudio/llstreamingaudio_fmodstudio.h
#	indra/llcharacter/llmultigesture.cpp
#	indra/llcharacter/llmultigesture.h
#	indra/llimage/llimage.cpp
#	indra/llimage/llimagepng.cpp
#	indra/llimage/llimageworker.cpp
#	indra/llimage/tests/llimageworker_test.cpp
#	indra/llmessage/tests/llmockhttpclient.h
#	indra/llprimitive/llgltfmaterial.h
#	indra/llrender/llfontfreetype.cpp
#	indra/llui/llcombobox.cpp
#	indra/llui/llfolderview.cpp
#	indra/llui/llfolderviewmodel.h
#	indra/llui/lllineeditor.cpp
#	indra/llui/lllineeditor.h
#	indra/llui/lltextbase.cpp
#	indra/llui/lltextbase.h
#	indra/llui/lltexteditor.cpp
#	indra/llui/lltextvalidate.cpp
#	indra/llui/lltextvalidate.h
#	indra/llui/lluictrl.h
#	indra/llui/llview.cpp
#	indra/llwindow/llwindowmacosx.cpp
#	indra/newview/app_settings/settings.xml
#	indra/newview/llappearancemgr.cpp
#	indra/newview/llappearancemgr.h
#	indra/newview/llavatarpropertiesprocessor.cpp
#	indra/newview/llavatarpropertiesprocessor.h
#	indra/newview/llbreadcrumbview.cpp
#	indra/newview/llbreadcrumbview.h
#	indra/newview/llbreastmotion.cpp
#	indra/newview/llbreastmotion.h
#	indra/newview/llconversationmodel.h
#	indra/newview/lldensityctrl.cpp
#	indra/newview/lldensityctrl.h
#	indra/newview/llface.inl
#	indra/newview/llfloatereditsky.cpp
#	indra/newview/llfloatereditwater.cpp
#	indra/newview/llfloateremojipicker.h
#	indra/newview/llfloaterimsessiontab.cpp
#	indra/newview/llfloaterprofiletexture.cpp
#	indra/newview/llfloaterprofiletexture.h
#	indra/newview/llgesturemgr.cpp
#	indra/newview/llgesturemgr.h
#	indra/newview/llimpanel.cpp
#	indra/newview/llimpanel.h
#	indra/newview/llinventorybridge.cpp
#	indra/newview/llinventorybridge.h
#	indra/newview/llinventoryclipboard.cpp
#	indra/newview/llinventoryclipboard.h
#	indra/newview/llinventoryfunctions.cpp
#	indra/newview/llinventoryfunctions.h
#	indra/newview/llinventorygallery.cpp
#	indra/newview/lllistbrowser.cpp
#	indra/newview/lllistbrowser.h
#	indra/newview/llpanelobjectinventory.cpp
#	indra/newview/llpanelprofile.cpp
#	indra/newview/llpanelprofile.h
#	indra/newview/llpreviewgesture.cpp
#	indra/newview/llsavedsettingsglue.cpp
#	indra/newview/llsavedsettingsglue.h
#	indra/newview/lltooldraganddrop.cpp
#	indra/newview/llurllineeditorctrl.cpp
#	indra/newview/llvectorperfoptions.cpp
#	indra/newview/llvectorperfoptions.h
#	indra/newview/llviewerparceloverlay.cpp
#	indra/newview/llviewertexlayer.cpp
#	indra/newview/llviewertexturelist.cpp
#	indra/newview/macmain.h
#	indra/test/test.cpp
2024-05-22 19:04:52 +02:00
Roxie Linden 3a212d9608 Merge branch 'spaces-merge' into roxie/webrtc-voice 2024-05-20 12:59:59 -07:00
Andrey Lihatskiy 1b68f71348 #824 Process source files in bulk: replace tabs with spaces, convert CRLF to LF, and trim trailing whitespaces as needed 2024-04-29 07:56:09 +03:00
Roxie Linden 4c4d23acb0 Renegotiate voice if the voice server type has changed.
The server will send an update with new voice credentials
when another peer comes in requiring vivox, if the channel
was initially webrtc.
2024-04-26 21:31:06 -07:00
Ansariel 60d3dd98a4 Convert remaining BOOL to bool 2024-02-21 23:14:31 +02:00
Lars Næsbye Christensen 4419bb8709 more misc: BOOL (int) to real bool 2024-02-12 23:17:22 +02:00
Andrey Lihatskiy 91f9f2e9f7 DRTVWR-570 Mac build fix: unused variables cleanup 2022-10-27 23:08:09 +03:00
Andrey Kleshchev b6c7eee505 SL-16320 Remove references to AvaLine from the viewer 2021-11-05 21:01:45 +02:00
Mnikolenko Productengine 9ee708707e MAINT-7794 Wrap getCapability(..) calls to avoid crashes 2017-09-13 16:31:48 +03:00
andreykproductengine 605160d501 MAINT-7118 Swapping legacy people API with new cache 2017-02-15 20:40:03 +02:00
Oz Linden 9be58e915a merge with 4.0.3-release 2016-04-04 15:53:09 -04:00
Oz Linden c8726aba30 remove execute permission from many files that should not have it 2015-11-10 09:48:56 -05:00
Rider Linden 53b947e039 Merge from viewer release. 2015-10-19 12:03:08 -07:00
Rider Linden 75c6549fde Set consistent terminology for yield/wait -> suspend for coroutines. 2015-09-18 11:39:22 -07:00
Nat Goodspeed efa9a0f99c Backed out changeset bab1000e1b2d: restore 'selfless' changes 2015-07-10 19:30:10 -04:00
Rider Linden 247eb0c9c3 Backout selfles merge 738255dbbfd679d9e615baab3398e5e345bbb3c5 2015-07-07 19:41:27 +01:00
Nat Goodspeed b262ded7e0 MAINT-5351: Remove 'self' parameter from coroutine functions.
lleventcoro_test.cpp runs clean (as modified for new API), and all the rest
builds clean, but the resulting viewer is as yet untested.
2015-07-01 18:33:29 -04:00
AndreyL ProductEngine a63ab891dc MAINT-5240 FIXED Viewer will request the full group member list for group chat in some cases - need to remove this 2015-06-08 06:51:05 +03:00
Mnikolenko ProductEngine 77b4f1d51c build fix 2015-06-05 13:06:04 +03:00
Rider Linden 0d3fb07bfa Remove vestigial httpclient.h include from files that no longer need it. 2015-06-03 16:04:40 -07:00
AndreyL ProductEngine 71209a51af MAINT-5240 FIXED Per Kelly, added delay to GroupPropertiesRequest too 2015-06-04 19:40:21 +03:00
AndreyL ProductEngine adcd7030ea MAINT-5240 FIXED Viewer will request the full group member list for group chat in some cases 2015-06-04 18:25:28 +03:00
Rider Linden 4fb5881871 Set media viewer mime probe to follow redirection.
Coroutines for group moderation.
2015-05-29 10:22:46 -07:00
simon d524c76822 MAINT-4614 - fix viewer warning about bad membership list update 2014-10-24 12:23:26 -07:00
Aura Linden 78304e398f A patch for maint-4414 2014-09-17 10:33:08 -07:00
Brad Payne (Vir Linden) 7b9708a2e3 sunshine-external merge WIP 2014-05-13 10:02:26 -04:00
Richard Linden e340009fc5 second phase summer cleaning
replace llinfos, lldebugs, etc with new LL_INFOS(), LL_DEBUGS(), etc.
2013-08-09 17:11:19 -07:00
Richard Linden a2e22732f1 Summer cleaning - removed a lot of llcommon dependencies to speed up build times
consolidated most indra-specific constants in llcommon under indra_constants.h
fixed issues with operations on mixed unit types (implicit and explicit)
made LL_INFOS() style macros variadic in order to subsume other logging methods
such as ll_infos
added optional tag output to error recorders
2013-07-30 19:13:45 -07:00
Richard Linden a2a6bf20d7 merge with release 2013-06-20 16:46:23 -07:00
Richard Linden 0a96b47663 merge with viewer-release 2013-06-05 19:05:43 -07:00
Brad Payne (Vir Linden) a04a706c1b merge 2013-05-21 16:18:48 -04:00
Richard Linden 6b81b8629e Spring cleaning: removed unused .cpp and.h files, and cleaned up header dependencies 2013-05-05 17:45:35 -07:00
Oz Linden ddd5659f81 merge changes for DRTVWR-294 2013-04-19 10:11:29 -04:00
prep 985b7277e8 WIP SH-4035: confirmation when closing appearance window when changes present 2013-04-08 17:10:46 -04:00
Graham Madarasz bf6182daa8 Update Mac and Windows breakpad builds to latest 2013-03-29 07:50:08 -07:00
prep f345746161 Folded in changes from sunshine-stable 2013-03-21 11:21:45 -04:00
prep@lindenlab.com f2948cb1eb Merge with viewer-chui 2013-03-20 17:53:51 -05:00
Don Kjer 662d67e3b5 Merging LLCURL::Responder changes with CHUI changes. Fixed gcc 4.6 compile failures 2013-03-13 08:46:59 +00:00
Don Kjer f945415210 Large changes to the LLCurl::Responder API, as well as pulling in some changes to common libraries from the server codebase:
* Additional error checking in http handlers.
* Uniform log spam for http errors.
* Switch to using constants for http heads and status codes.
* Fixed bugs in incorrectly checking if parsing LLSD xml resulted in an error.
* Reduced spam regarding LLSD parsing errors in the default completedRaw http handler.  It should not longer be necessary to short-circuit completedRaw to avoid spam.
* Ported over a few bug fixes from the server code.
* Switch mode http status codes to use S32 instead of U32.
* Ported LLSD::asStringRef from server code; avoids copying strings all over the place.
* Ported server change to LLSD::asBinary; this always returns a reference now instead of copying the entire binary blob.
* Ported server pretty notation format (and pretty binary format) to llsd serialization.

* The new LLCurl::Responder API no longer has two error handlers to choose from.  Overriding the following methods have been deprecated:
** error - use httpFailure
** errorWithContent - use httpFailure
** result - use httpSuccess
** completed - use httpCompleted
** completedHeader - no longer necessary; call getResponseHeaders() from a completion method to obtain these headers.

* In order to 'catch' a completed http request, override one of these methods:
** httpSuccess - Called for any 2xx status code.
** httpFailure - Called for any non-2xx status code.
** httpComplete - Called for all status codes.  Default implementation is to call either httpSuccess or httpFailure.
* It is recommended to keep these methods protected/private in order to avoid triggering of these methods without using a 'push' method (see below).

* Uniform error handling should followed whenever possible by calling a variant of this during httpFailure:
** llwarns << dumpResponse() << llendl;
* Be sure to include LOG_CLASS(your_class_name) in your class in order for the log entry to give more context.

* In order to 'push' a result into the responder, you should no longer call error, errorWithContent, result, or completed.
* Nor should you directly call httpSuccess/Failure/Completed (unless passing a message up to a parent class).
* Instead, you can set the internal content of a responder and trigger a corresponding method using the following methods:
** successResult - Sets results and calls httpSuccess
** failureResult - Sets results and calls httpFailure
** completedResult - Sets results and calls httpCompleted

* To obtain information about a the response from a reponder method, use the following getters:
** getStatus - HTTP status code
** getReason - Reason string
** getContent - Content (Parsed body LLSD)
** getResponseHeaders - Response Headers (LLSD map)
** getHTTPMethod - HTTP method of the request
** getURL - URL of the request

* It is still possible to override completeRaw if you want to manipulate data directly out of LLPumpIO.

* See indra/llmessage/llcurl.h for more information.
2013-03-13 06:26:25 +00:00
merov ac63601a2a CHUI-793 : Fixed! Introduced ChatLoadGroupTimeout and ChatLoadGroupMaxMembers to mitigate slow group loading. 2013-03-11 21:32:40 -07:00