added definitions for sending and receiving messages
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#include "tlibc/filesystem.h"
|
||||
#include "tcp-chat/common_constants.h"
|
||||
#include "cli/ClientCLI/ClientCLI.h"
|
||||
#include "cli/term.h"
|
||||
#include "tcp-chat/common_constants.h"
|
||||
#include "tlibc/time.h"
|
||||
#include "tlibc/filesystem.h"
|
||||
#include "network/tcp-chat-protocol/v1.h"
|
||||
|
||||
static const str greeting_art = STR(
|
||||
" ^,,^ ╱|\n"
|
||||
@@ -108,11 +108,11 @@ static Result(void) ClientCLI_askUserNameAndPassword(str* username_out, str* pas
|
||||
try_void(term_readLine(username_buf.data, username_buf.size));
|
||||
username = str_from_cstr(username_buf.data);
|
||||
str_trim(&username, true);
|
||||
if(username.size < USERNAME_SIZE_MIN || username.size > USERNAME_SIZE_MAX){
|
||||
printf("ERROR: username length (in bytes) must be >= %i and <= %i\n",
|
||||
USERNAME_SIZE_MIN, USERNAME_SIZE_MAX);
|
||||
str name_error_str = validateUsername_str(username);
|
||||
if(name_error_str.data){
|
||||
printf("ERROR: "FMT_str"\n",
|
||||
name_error_str.size, name_error_str.data);
|
||||
}
|
||||
//TODO: validate username characters
|
||||
else break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user