From 3d067637b51f8cec0f404bf19827c160a288eca2 Mon Sep 17 00:00:00 2001 From: MysterD Date: Mon, 2 Aug 2021 19:35:32 -0700 Subject: [PATCH] Added list of patch names to Discord's activity information --- src/pc/network/discord/activity.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/pc/network/discord/activity.c b/src/pc/network/discord/activity.c index b41f625c..8a0f8d65 100644 --- a/src/pc/network/discord/activity.c +++ b/src/pc/network/discord/activity.c @@ -2,6 +2,7 @@ #include "lobby.h" #include "discord_network.h" #include "pc/debuglog.h" +#include "pc/network/network.h" #include "pc/network/version.h" #include "pc/djui/djui.h" @@ -68,7 +69,20 @@ void discord_activity_update(bool hosting) { gCurActivity.party.size.max_size = 1; } - snprintf(gCurActivity.details, MAX_VERSION_LENGTH, "%s", get_version()); + if (gCurActivity.details[0] == '\0') { + snprintf(gCurActivity.details, 128, "%s", get_version()); + if (gRegisteredMods.string != NULL) { + strncat(gCurActivity.details, " - ", 127); + struct StringLinkedList* node = &gRegisteredMods; + while (node != NULL && node->string != NULL) { + strncat(gCurActivity.details, node->string, 127); + node = node->next; + if (node != NULL && node->string != NULL) { + strncat(gCurActivity.details, ", ", 127); + } + } + } + } app.activities->update_activity(app.activities, &gCurActivity, NULL, on_activity_update_callback); LOG_INFO("set activity");