waiting for WHY2_CHAT_CODE_USERNAME
This commit is contained in:
parent
6c53169f09
commit
4d64d73c07
@ -554,12 +554,25 @@ void *why2_communicate_thread(void *arg)
|
|||||||
goto deallocation;
|
goto deallocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//KEEP READING UNTIL CODE ARRIVES
|
||||||
|
char *code = NULL;
|
||||||
|
why2_bool exiting_read = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
//DEALLOCATE
|
||||||
|
why2_deallocate(code);
|
||||||
|
|
||||||
if ((raw = read_user(connection, &raw_ptr)) == NULL) //READ
|
if ((raw = read_user(connection, &raw_ptr)) == NULL) //READ
|
||||||
{
|
{
|
||||||
force_exiting = 1; //FAILURE
|
force_exiting = 1; //FAILURE
|
||||||
goto deallocation;
|
goto deallocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//COMPARE CODE
|
||||||
|
code = get_string_from_json_string(raw, "code");
|
||||||
|
exiting_read = code != NULL && strcmp(code, WHY2_CHAT_CODE_USERNAME) == 0;
|
||||||
|
} while (!exiting_read);
|
||||||
|
|
||||||
decoded_buffer = get_string_from_json_string(raw, "message"); //DECODE
|
decoded_buffer = get_string_from_json_string(raw, "message"); //DECODE
|
||||||
|
|
||||||
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
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user