From 73d0f64fc992b347674c1925042fb1f9c634b919 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sat, 27 Jan 2024 22:19:38 +0100 Subject: [PATCH] implemented WHY2_MIN_USERNAME_LENGTH --- src/chat/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chat/misc.c b/src/chat/misc.c index 7687fe1..c29b9e2 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -403,7 +403,7 @@ void *why2_communicate_thread(void *arg) decoded_buffer = get_string_from_json_string(raw, "message"); //DECODE - invalid_username = (strlen(decoded_buffer) > WHY2_MAX_USERNAME_LENGTH) || !check_username(decoded_buffer); //CHECK FOR USERNAMES LONGER THAN 20 CHARACTERS + invalid_username = (strlen(decoded_buffer) > WHY2_MAX_USERNAME_LENGTH) || (strlen(decoded_buffer) < WHY2_MIN_USERNAME_LENGTH) || (!check_username(decoded_buffer)); //CHECK FOR USERNAMES LONGER THAN 20 CHARACTERS why2_deallocate(username); username = decoded_buffer; @@ -604,7 +604,7 @@ void *why2_listen_server(void *socket) exiting = 1; //EXIT THIS THREAD } else if (strcmp(read + 8, WHY2_CHAT_CODE_PICK_USERNAME) == 0) //PICK USERNAME { - printf("%sEnter username (a-Z, 0-9; max %d characters):\n", WHY2_CLEAR_AND_GO_UP, WHY2_MAX_USERNAME_LENGTH); + printf("%sEnter username (a-Z, 0-9; %d-%d characters):\n", WHY2_CLEAR_AND_GO_UP, WHY2_MAX_USERNAME_LENGTH, WHY2_MAX_USERNAME_LENGTH); fflush(stdout); goto continue_input;