added WHY2 into some chat-flags' identificator

This commit is contained in:
Václav Šmejkal 2024-02-21 09:01:35 +01:00
parent 92ab33a594
commit a6f37b1aa3
Signed by: ENGO150
GPG Key ID: 4A57E86482968843
4 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ extern "C" {
//MACROS
#define WHY2_SA struct sockaddr
#define WHY2_SERVER_PORT 1204 //PORT
#define WHY2_CHAT_SERVER_PORT 1204 //PORT
#define WHY2_MAX_CONNECTIONS 1000 //MAX USERS CONNECTED AT ONE TIME
#define WHY2_COMMUNICATION_TIME 300 //SECONDS WAITING BEFORE KICKING USER (TIMEOUT)
@ -34,7 +34,7 @@ extern "C" {
#define WHY2_CLEAR_AND_GO_UP "\33[2K\r\033[A" //i mean read the name
#define WHY2_INVALID_POINTER (void*) 0xffffffffffffffff
#define WHY2_DEFAULT_USERNAME "anon"
#define WHY2_CHAT_DEFAULT_USERNAME "anon"
#define WHY2_MAX_USERNAME_LENGTH 20 //MAXIMAL USERNAME LENGTH
#define WHY2_MIN_USERNAME_LENGTH 4 //MINIMAL USERNAME LENGTH

View File

@ -47,7 +47,7 @@ int main(void)
//DEFINE SERVER ADDRESS
struct sockaddr_in server_addr;
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(WHY2_SERVER_PORT);
server_addr.sin_port = htons(WHY2_CHAT_SERVER_PORT);
//GET IP
printf("Welcome.\n\n");

View File

@ -46,7 +46,7 @@ int main(void)
//DEFINE SERVER ADDRESS
struct sockaddr_in server_addr;
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(WHY2_SERVER_PORT);
server_addr.sin_port = htons(WHY2_CHAT_SERVER_PORT);
server_addr.sin_addr.s_addr = INADDR_ANY;
//BIND SOCKET

View File

@ -199,7 +199,7 @@ why2_bool check_username(char *username)
if (username == NULL) return 0;
if (username_equal(username, WHY2_CHAT_SERVER_USERNAME)) return 0; //DISABLE 'server' USERNAME
if (username_equal(username, WHY2_DEFAULT_USERNAME)) return 0; //DISABLE 'anon' USERNAME DUE TO ONE USERNAME PER SERVER
if (username_equal(username, WHY2_CHAT_DEFAULT_USERNAME)) return 0; //DISABLE 'anon' USERNAME DUE TO ONE USERNAME PER SERVER
for (unsigned long i = 0; i < strlen(username); i++)
{
@ -378,7 +378,7 @@ void *why2_communicate_thread(void *arg)
why2_bool invalid_username = 1;
why2_bool exiting = 0;
char *decoded_buffer = NULL;
char *username = why2_strdup(WHY2_DEFAULT_USERNAME);
char *username = why2_strdup(WHY2_CHAT_DEFAULT_USERNAME);
int usernames_n = 0;
struct json_object *json = json_tokener_parse("{}");