From 2decea5693f944bdf72da026e53895a87c202d37 Mon Sep 17 00:00:00 2001 From: iZePlayzYT Date: Sat, 27 Sep 2025 20:40:24 +0200 Subject: [PATCH] Prevent duplicate messages in chat history --- src/pc/djui/djui_chat_box.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pc/djui/djui_chat_box.c b/src/pc/djui/djui_chat_box.c index 01710083f..393e876bd 100644 --- a/src/pc/djui/djui_chat_box.c +++ b/src/pc/djui/djui_chat_box.c @@ -54,6 +54,11 @@ void sent_history_init(ArrayList *arrayList) { void sent_history_add_message(ArrayList *arrayList, const char *newMessage) { if (!configUseStandardKeyBindingsChat && (!newMessage || newMessage[0] != '/')) { return; } + // Don't add duplicate messages - check if the new message is the same as the last one + if (arrayList->size > 0 && strcmp(arrayList->messages[arrayList->size - 1], newMessage) == 0) { + return; + } + if (arrayList->size == MAX_HISTORY_SIZE) { for (s32 i = 1; i < MAX_HISTORY_SIZE; i++) { snprintf(arrayList->messages[i-1], MAX_CHAT_MSG_LENGTH, "%s", arrayList->messages[i]);