optimized client command checking

This commit is contained in:
Václav Šmejkal 2024-04-27 11:42:15 +02:00
parent 26c5b4d831
commit 0150414d1b
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -162,11 +162,14 @@ int main(void)
//TODO: Remove accents //TODO: Remove accents
if (strncmp(line, WHY2_CHAT_COMMAND_PREFIX, strlen(WHY2_CHAT_COMMAND_PREFIX)) == 0) //OPTIMIZE COMMANDS
{
//COMMANDS
if (command(line, WHY2_CHAT_COMMAND_EXIT, &cmd_arg)) //USER REQUESTED PROGRAM EXIT if (command(line, WHY2_CHAT_COMMAND_EXIT, &cmd_arg)) //USER REQUESTED PROGRAM EXIT
{ {
printf("Exiting...\n"); printf("Exiting...\n");
exit_client(0); exit_client(0);
} else if (command(line, WHY2_CHAT_COMMAND_HELP, &cmd_arg)) } else if (command(line, WHY2_CHAT_COMMAND_HELP, &cmd_arg)) //HELP CMD
{ {
printf printf
( (
@ -177,6 +180,7 @@ int main(void)
); );
fflush(stdout); fflush(stdout);
}
} else } else
{ {
why2_send_socket(line, NULL, listen_socket); //NULL IS SENT BECAUSE IT IS USELESS TO SEND USER FROM CLIENT - SERVER WON'T USE IT why2_send_socket(line, NULL, listen_socket); //NULL IS SENT BECAUSE IT IS USELESS TO SEND USER FROM CLIENT - SERVER WON'T USE IT