From d428d17aaaa44533073ebaa41b64ffa2afc85920 Mon Sep 17 00:00:00 2001 From: Liny Date: Wed, 25 Sep 2019 01:01:25 -0700 Subject: [PATCH] After feedback from discord, add the client key into Variables.cmake. Note to any other third party client, please obtain your own key for your client so you can customize the rich presence features. --- indra/cmake/Discord.cmake | 34 ++++++++----------- indra/cmake/Variables.cmake | 3 ++ indra/newview/CMakeLists.txt | 17 ++++++---- indra/newview/fsdiscordconnect.cpp | 4 +-- indra/newview/fsdiscordkey.h.in | 4 +++ indra/newview/llviewerfloaterreg.cpp | 4 --- indra/newview/llviewermenu.cpp | 14 -------- indra/newview/llvoavatar.cpp | 2 -- .../skins/default/xui/en/menu_viewer.xml | 2 -- 9 files changed, 32 insertions(+), 52 deletions(-) create mode 100644 indra/newview/fsdiscordkey.h.in diff --git a/indra/cmake/Discord.cmake b/indra/cmake/Discord.cmake index b035123194..908f08612b 100644 --- a/indra/cmake/Discord.cmake +++ b/indra/cmake/Discord.cmake @@ -1,23 +1,17 @@ # -*- cmake -*- -if (DISCORD_API_KEY) - include(Prebuilt) - use_prebuilt_binary(discord-rpc) - set(DISCORD_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/discord-rpc) +include(Prebuilt) +use_prebuilt_binary(discord-rpc) +set(DISCORD_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/discord-rpc) - if (WINDOWS) - if (ADDRESS_SIZE EQUAL 32) - set(DISCORD_LIBRARY discord-rpc) - else () - set(DISCORD_LIBRARY discord-rpc_x64) - endif(ADDRESS_SIZE EQUAL 32) - elseif (LINUX) - set(DISCORD_LIBRARY discord-rpc) - elseif (DARWIN) - set(DISCORD_LIBRARY discord-rpc) - endif (WINDOWS) - - add_definitions( -DDISCORD_API_KEY=\"${DISCORD_API_KEY}\") - add_definitions( -DHAS_DISCORD ) - set(USE_DISCORD TRUE) -endif (DISCORD_API_KEY) +if (WINDOWS) +if (ADDRESS_SIZE EQUAL 32) + set(DISCORD_LIBRARY discord-rpc) +else () + set(DISCORD_LIBRARY discord-rpc_x64) +endif(ADDRESS_SIZE EQUAL 32) +elseif (LINUX) +set(DISCORD_LIBRARY discord-rpc) +elseif (DARWIN) +set(DISCORD_LIBRARY discord-rpc) +endif (WINDOWS) diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index ea98beedb6..12fc7b295f 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -210,6 +210,9 @@ set(GRID agni CACHE STRING "Target Grid") set(FLICKR_API_KEY "daaabff93a967e0f37fa18863bb43b29") set(FLICKR_API_SECRET "846f0958020b553e") +# Discord client key. +set(DDISCORD_API_KEY "427641535253708801") + set(ENABLE_SIGNING OFF CACHE BOOL "Enable signing the viewer") set(SIGNING_IDENTITY "" CACHE STRING "Specifies the signing identity to use, if necessary.") diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 2bcb6a09a4..2b0df3a849 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1632,10 +1632,15 @@ list(APPEND viewer_HEADER_FILES ${CMAKE_CURRENT_BINARY_DIR}/exoflickrkeys.h) # # Discord rich presence - if (USE_DISCORD) - LIST(APPEND viewer_HEADER_FILES fsfloaterdiscord.h fsdiscordconnect.h) - LIST(APPEND viewer_SOURCE_FILES fsfloaterdiscord.cpp fsdiscordconnect.cpp) - endif (USE_DISCORD) + +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/fsdiscordkey.h.in + ${CMAKE_CURRENT_BINARY_DIR}/fsdiscordkey.h + @ONLY +) +list(APPEND viewer_HEADER_FILES ${CMAKE_CURRENT_BINARY_DIR}/fsdiscordkey.h) +LIST(APPEND viewer_HEADER_FILES fsfloaterdiscord.h fsdiscordconnect.h) +LIST(APPEND viewer_SOURCE_FILES fsfloaterdiscord.cpp fsdiscordconnect.cpp) # # Generate the version information header file. @@ -2438,9 +2443,7 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${GROWL_LIBRARY} ) -if( USE_DISCORD ) - target_link_libraries(${VIEWER_BINARY_NAME} ${DISCORD_LIBRARY} ) -endif() +target_link_libraries(${VIEWER_BINARY_NAME} ${DISCORD_LIBRARY} ) if (BUGSPLAT_DB) target_link_libraries(${VIEWER_BINARY_NAME} diff --git a/indra/newview/fsdiscordconnect.cpp b/indra/newview/fsdiscordconnect.cpp index 0b658842ae..4aa9921578 100644 --- a/indra/newview/fsdiscordconnect.cpp +++ b/indra/newview/fsdiscordconnect.cpp @@ -48,9 +48,7 @@ #include "boost/algorithm/string/case_conv.hpp" -#ifndef DISCORD_API_KEY -#define DISCORD_API_KEY "" -#endif +#include "fsdiscordkey.h" boost::scoped_ptr FSDiscordConnect::sStateWatcher(new LLEventStream("DiscordConnectState")); boost::scoped_ptr FSDiscordConnect::sInfoWatcher(new LLEventStream("DiscordConnectInfo")); diff --git a/indra/newview/fsdiscordkey.h.in b/indra/newview/fsdiscordkey.h.in new file mode 100644 index 0000000000..269745e453 --- /dev/null +++ b/indra/newview/fsdiscordkey.h.in @@ -0,0 +1,4 @@ +// THIS FILE IS AUTOGENERATED BY THE BUILD PROCESS +// You can either set the keys in Variables.cmake or at the autobuild command + +#define DISCORD_API_KEY "@DDISCORD_API_KEY@" \ No newline at end of file diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 6204952de8..365cd22c91 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -179,9 +179,7 @@ #include "fsfloateravatarrendersettings.h" #include "fsfloatercontacts.h" #include "fsfloatercontactsetconfiguration.h" -#ifdef HAS_DISCORD #include "fsfloaterdiscord.h" -#endif #include "fsfloaterexport.h" #include "fsfloaterblocklist.h" #include "fsfloatergroup.h" @@ -465,9 +463,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("fs_blocklist", "floater_fs_blocklist.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_add_contact", "floater_fs_contact_add.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_contact_set_config", "floater_fs_contact_set_configuration.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); -#ifdef HAS_DISCORD LLFloaterReg::add("fs_discord", "floater_fs_discord.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); -#endif LLFloaterReg::add("fs_group", "floater_fs_group.xml",&LLFloaterReg::build); LLFloaterReg::add("fs_group_titles", "floater_fs_group_titles.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_export", "floater_fs_export.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index efdfc14a87..f3d29c3c9a 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -11125,17 +11125,6 @@ class FSObjectExportCollada : public view_listener_t }; // -// Discord integration -bool enable_discord_integration() -{ -#if HAS_DISCORD - return true; -#else - return false; -#endif -} -// - // Make sure to call this before any of the UI is set up, so all text editors can // pick up the menu properly. void initialize_edit_menu() @@ -11854,7 +11843,4 @@ void initialize_menus() view_listener_t::addMenu(new FSObjectExportCollada(), "Object.ExportCollada"); enable.add("Object.EnableExport", boost::bind(&enable_export_object)); // - - // Discord integration - enable.add("FSDiscordEnabled", std::bind(&enable_discord_integration)); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 27c5c1c39d..33f87ecac1 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -130,9 +130,7 @@ #include "llsidepanelappearance.h" #include "fsavatarrenderpersistence.h" -#ifdef HAS_DISCORD #include "fsdiscordconnect.h" // tapping a place that happens on landing in world to start up discord -#endif extern F32 SPEED_ADJUST_MAX; extern F32 SPEED_ADJUST_MAX_SEC; diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index a91a98ef6e..a1607bd5f3 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -604,8 +604,6 @@ -