catching WHY2_CHAT_CODE_INVALID_USERNAME and WHY2_CHAT_CODE_PICK_USERNAME as client

This commit is contained in:
Václav Šmejkal 2024-01-27 17:46:45 +01:00
parent e36b2ffa61
commit 7042e3c971
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -537,12 +537,21 @@ void *why2_listen_server(void *socket)
exiting = 1; //EXIT THIS THREAD exiting = 1; //EXIT THIS THREAD
} else if (strcmp(read + 8, WHY2_CHAT_CODE_PICK_USERNAME) == 0) //PICK USERNAME } else if (strcmp(read + 8, WHY2_CHAT_CODE_PICK_USERNAME) == 0) //PICK USERNAME
{ {
//TODO: Check username printf("%sEnter username (a-Z, 0-9; max %d characters):\n", WHY2_CLEAR_AND_GO_UP, WHY2_MAX_USERNAME_LENGTH);
fflush(stdout);
goto continue_input;
} else if (strcmp(read + 8, WHY2_CHAT_CODE_INVALID_COMMAND) == 0) //PICK USERNAME } else if (strcmp(read + 8, WHY2_CHAT_CODE_INVALID_COMMAND) == 0) //PICK USERNAME
{ {
printf("\nInvalid command!\n\n"); printf("\nInvalid command!\n\n");
fflush(stdout); fflush(stdout);
goto continue_input;
} else if (strcmp(read + 8, WHY2_CHAT_CODE_INVALID_USERNAME) == 0) //PICK USERNAME
{
printf("\nInvalid username!\n\n\n");
fflush(stdout);
goto continue_input; goto continue_input;
} }
} else } else