From b9e85da4dc513754b537490658dfccab1f46f4df Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 28 Jan 2024 13:46:00 +0100 Subject: [PATCH] fixed max user ask count --- src/chat/misc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/chat/misc.c b/src/chat/misc.c index 32a2040..49f5344 100644 --- a/src/chat/misc.c +++ b/src/chat/misc.c @@ -390,16 +390,16 @@ void *why2_communicate_thread(void *arg) if (config_username == NULL || strcmp(config_username, "true") == 0) { - if (usernames_n++ == WHY2_MAX_USERNAME_TRIES) //ASKED CLIENT WAY TOO FUCKING MANY TIMES FOR USERNAME, KICK HIM - { - exiting = 1; - goto deallocation; - } - if (config_username == NULL) fprintf(stderr, "Your config doesn't contain 'user_pick_username'. Please update your configuration.\n"); while (invalid_username) { + if (usernames_n++ == WHY2_MAX_USERNAME_TRIES) //ASKED CLIENT WAY TOO FUCKING MANY TIMES FOR USERNAME, KICK HIM + { + exiting = 1; + goto deallocation; + } + why2_send_socket(WHY2_CHAT_CODE_PICK_USERNAME, WHY2_CHAT_SERVER_USERNAME, connection); //ASK USER FOR USERNAME if ((raw = read_user(connection, &raw_ptr)) == NULL) //READ @@ -422,6 +422,7 @@ void *why2_communicate_thread(void *arg) if (invalid_username) { why2_send_socket(WHY2_CHAT_CODE_INVALID_USERNAME, WHY2_CHAT_SERVER_USERNAME, connection); //TELL THE USER HE IS DUMB AS FUCK + continue; } printf("User set username.\t%d\t%s\n", connection, decoded_buffer);