From 07eb5961803775a55f0d9cc0fa86e78c181a5876 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Fri, 31 Jan 2025 14:49:37 +0100 Subject: [PATCH] checking for WHY2_CHAT_CODE_ACCEPT_MESSAGES from client it was using the first received message --- src/chat/misc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/chat/misc.c b/src/chat/misc.c index 948bf51..557c9b4 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -962,6 +962,8 @@ void *why2_listen_server(void *socket) if (server_uname == NULL) //GET SERVER USERNAME { + if (code == NULL || strcmp(code, WHY2_CHAT_CODE_ACCEPT_MESSAGES) != 0) goto deallocation; + server_uname = why2_strdup(username); //GET USERNAME //GET INFO @@ -1097,13 +1099,14 @@ void *why2_listen_server(void *socket) printf("\n\n%s%s: %s\n\n", WHY2_CLEAR_AND_GO_UP, username, message); } - if (!exiting && !continuing) { printf(">>> "); fflush(stdout); } + deallocation: + //DEALLOCATION why2_deallocate(read); why2_deallocate(username);