implemented max/min username

This commit is contained in:
Václav Šmejkal 2024-02-21 21:38:38 +01:00
parent c2b9c7c57a
commit fd68b0d01a
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
2 changed files with 1 additions and 4 deletions

View File

@ -32,9 +32,6 @@ extern "C" {
#define WHY2_INVALID_POINTER (void*) 0xffffffffffffffff
#define WHY2_MAX_USERNAME_LENGTH 20 //MAXIMAL USERNAME LENGTH
#define WHY2_MIN_USERNAME_LENGTH 4 //MINIMAL USERNAME LENGTH
//CODES
#define WHY2_CHAT_CODE_ACCEPT_MESSAGES "code_000"
#define WHY2_CHAT_CODE_PICK_USERNAME "code_001"

View File

@ -485,7 +485,7 @@ void *why2_communicate_thread(void *arg)
decoded_buffer = get_string_from_json_string(raw, "message"); //DECODE
invalid_username = decoded_buffer == NULL || (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
invalid_username = decoded_buffer == NULL || (strlen(decoded_buffer) > (unsigned long) server_config_int("max_username_length")) || (strlen(decoded_buffer) < (unsigned long) server_config_int("min_username_length")) || (!check_username(decoded_buffer)); //CHECK FOR USERNAMES LONGER THAN 20 CHARACTERS
username = decoded_buffer;