diff --git a/examples/send-presence/send-presence.c b/examples/send-presence/send-presence.c index 082a396..20e211b 100644 --- a/examples/send-presence/send-presence.c +++ b/examples/send-presence/send-presence.c @@ -40,12 +40,6 @@ static void handleDiscordError(int errcode, const char* message) printf("\nDiscord: error (%d: %s)\n", errcode, message); } -static void handleDiscordPresenceRequested() -{ - printf("\nDiscord: requests presence\n"); - updateDiscordPresence(); -} - static int prompt(char* line, size_t size) { int res; @@ -102,7 +96,6 @@ int main(int argc, char* argv[]) handlers.ready = handleDiscordReady; handlers.disconnected = handleDiscordDisconnected; handlers.errored = handleDiscordError; - handlers.presenceRequested = handleDiscordPresenceRequested; Discord_Initialize(APPLICATION_ID, &handlers, 1); gameLoop(); diff --git a/include/discord-rpc.h b/include/discord-rpc.h index 3be1f9b..1f7a651 100644 --- a/include/discord-rpc.h +++ b/include/discord-rpc.h @@ -27,7 +27,6 @@ typedef struct DiscordEventHandlers { void (*ready)(); void (*disconnected)(int errorCode, const char* message); void (*errored)(int errorCode, const char* message); - void (*presenceRequested)(); void (*joinGame)(const char* joinSecret); void (*spectateGame)(const char* spectateSecret); } DiscordEventHandlers; diff --git a/src/discord-rpc.cpp b/src/discord-rpc.cpp index 74271bf..fc2e929 100644 --- a/src/discord-rpc.cpp +++ b/src/discord-rpc.cpp @@ -26,7 +26,6 @@ static DiscordEventHandlers Handlers{}; static std::atomic_bool WasJustConnected{false}; static std::atomic_bool WasJustDisconnected{false}; static std::atomic_bool GotErrorMessage{false}; -static std::atomic_bool WasPresenceRequested{false}; static std::atomic_bool WasJoinGame{false}; static std::atomic_bool WasSpectateGame{false}; static char JoinGameSecret[256]; @@ -117,17 +116,13 @@ extern "C" void Discord_UpdateConnection() continue; } - // todo ug - if (strcmp(evtName, "PRESENCE_REQUESTED") == 0) { - WasPresenceRequested.store(true); - } - else if (strcmp(evtName, "JOIN_GAME") == 0) { + if (strcmp(evtName, "GAME_JOIN") == 0) { auto data = message.FindMember("data"); auto secret = data->value["secret"].GetString(); StringCopy(JoinGameSecret, secret); WasJoinGame.store(true); } - else if (strcmp(evtName, "SPECTATE_GAME") == 0) { + else if (strcmp(evtName, "GAME_SPECTATE") == 0) { auto data = message.FindMember("data"); auto secret = data->value["secret"].GetString(); StringCopy(SpectateGameSecret, secret); @@ -201,16 +196,12 @@ extern "C" void Discord_Initialize(const char* applicationId, WasJustConnected.exchange(true); ReconnectTimeMs.reset(); - if (Handlers.presenceRequested) { - RegisterForEvent("PRESENCE_REQUESTED"); - } - if (Handlers.joinGame) { - RegisterForEvent("JOIN_GAME"); + RegisterForEvent("GAME_JOIN"); } if (Handlers.spectateGame) { - RegisterForEvent("SPECTATE_GAME"); + RegisterForEvent("GAME_SPECTATE"); } }; Connection->onDisconnect = [](int err, const char* message) { @@ -265,10 +256,6 @@ extern "C" void Discord_RunCallbacks() Handlers.ready(); } - if (WasPresenceRequested.exchange(false) && Handlers.presenceRequested) { - Handlers.presenceRequested(); - } - if (WasJoinGame.exchange(false) && Handlers.joinGame) { Handlers.joinGame(JoinGameSecret); }