waiting for WHY2_CHAT_CODE_USERNAME

This commit is contained in:
Václav Šmejkal 2025-02-01 20:57:07 +01:00
parent 6c53169f09
commit 4d64d73c07
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -554,11 +554,24 @@ void *why2_communicate_thread(void *arg)
goto deallocation; goto deallocation;
} }
if ((raw = read_user(connection, &raw_ptr)) == NULL) //READ //KEEP READING UNTIL CODE ARRIVES
char *code = NULL;
why2_bool exiting_read = 0;
do
{ {
force_exiting = 1; //FAILURE //DEALLOCATE
goto deallocation; why2_deallocate(code);
}
if ((raw = read_user(connection, &raw_ptr)) == NULL) //READ
{
force_exiting = 1; //FAILURE
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