implemented default_username from server config
This commit is contained in:
parent
e450032f26
commit
8c742b1884
@ -32,7 +32,6 @@ extern "C" {
|
|||||||
#define WHY2_CLEAR_AND_GO_UP "\33[2K\r\033[A" //i mean read the name
|
#define WHY2_CLEAR_AND_GO_UP "\33[2K\r\033[A" //i mean read the name
|
||||||
|
|
||||||
#define WHY2_INVALID_POINTER (void*) 0xffffffffffffffff
|
#define WHY2_INVALID_POINTER (void*) 0xffffffffffffffff
|
||||||
#define WHY2_CHAT_DEFAULT_USERNAME "anon"
|
|
||||||
|
|
||||||
#define WHY2_MAX_USERNAME_LENGTH 20 //MAXIMAL USERNAME LENGTH
|
#define WHY2_MAX_USERNAME_LENGTH 20 //MAXIMAL USERNAME LENGTH
|
||||||
#define WHY2_MIN_USERNAME_LENGTH 4 //MINIMAL USERNAME LENGTH
|
#define WHY2_MIN_USERNAME_LENGTH 4 //MINIMAL USERNAME LENGTH
|
||||||
|
@ -405,10 +405,15 @@ void *why2_communicate_thread(void *arg)
|
|||||||
why2_bool invalid_username = 1;
|
why2_bool invalid_username = 1;
|
||||||
why2_bool exiting = 0;
|
why2_bool exiting = 0;
|
||||||
char *decoded_buffer = NULL;
|
char *decoded_buffer = NULL;
|
||||||
char *username = why2_strdup(WHY2_CHAT_DEFAULT_USERNAME);
|
char *username;
|
||||||
int usernames_n = 0;
|
int usernames_n = 0;
|
||||||
struct json_object *json = json_tokener_parse("{}");
|
struct json_object *json = json_tokener_parse("{}");
|
||||||
|
|
||||||
|
//GET DEFAULT USERNAME
|
||||||
|
char *default_username = why2_chat_server_config("default_username");
|
||||||
|
username = why2_strdup(default_username);
|
||||||
|
why2_toml_read_free(default_username);
|
||||||
|
|
||||||
if (config_username == NULL || strcmp(config_username, "true") == 0)
|
if (config_username == NULL || strcmp(config_username, "true") == 0)
|
||||||
{
|
{
|
||||||
if (config_username == NULL) fprintf(stderr, "Your config doesn't contain 'user_pick_username'. Please update your configuration.\n");
|
if (config_username == NULL) fprintf(stderr, "Your config doesn't contain 'user_pick_username'. Please update your configuration.\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user