This code checks if a new connection has been made on the listening socket. If a new connection has been made, it accepts the connection and adds the new client to the client list. If the client is already in the list, it cleans up the arguments for processing. If the client is not in the list, it prompts the client for their username and adds the user to the user list. It then creates a new client object and adds it to the client list.
if (FD_ISSET(listen_soc, &listen_fds))
        {
            client_fd = accept_connection(listen_soc, client_list);
            printf("main (test) client fd: %d\n", client_fd);
            if (client_fd == -1)
            {
                perror("accept");
                return -1;
            }
            printf("clinet_fd: %d\n", client_fd);
            printf("max_fd: %d\n", max_fd);

            Client *client_ptr = find_client(client_fd, client_list);

            if (client_ptr != NULL){
                printf("client found\n");
            }
            if (client_ptr == NULL){ // this is a new socket
                printf("main _ new connection\n");
                write(client_fd, "What is your user name?\n", 24);
                User *user = check_and_add_user(user_list, client_fd);
             //   strncpy(client_ptr->username, name, MAX_NAME);

                // add client_fd into client_list
                Client *temp_client = client_list;
                while (temp_client != NULL){
                    temp_client = temp_client->next;
                }
                temp_client->fd = client_fd;
                temp_client->user = user;
                temp_client->username = user->name;
                temp_client->next = NULL;

            } else { // this is not a new socket
                cleanup_args_for_processing(user_list, client_fd, client_list);
            }
