/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Server.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: aortigos # include # include # include # include # include # include # include "../User/User.hpp" # include "../Channel/Channel.hpp" # define SERVER_NAME "irc.server" # define PORT_DEFAULT 9898 class Server { private: static const int kConnectionQueueLimit; int port_; int serverSocket_; std::string password_; std::vector sockets_; std::map clients_; std::map channels_; std::map commands_; bool handleClient(User& client); void addClient(); std::vector::iterator removeClient(std::vector::iterator& client); void parseCommand(User& client); Server(const Server& other); Server &operator=(const Server& other); // Commands void pass_cmd(User &client, std::istringstream &ss); void nick_cmd(User &client, std::istringstream &ss); void user_cmd(User &client, std::istringstream &ss); public: Server(); Server(int port, const std::string& password); ~Server(); void run(); }; #endif // SERVER_HPP