31#define UNREGISTERED_CLIENT_TIMEOUT 30
101 void handleClientData(
int fd);
107 void handleClientWrite(
int fd);
112 void checkClientTimeouts();
Represents an IRC client connected to the server.
Manages the registration, parsing, and execution of IRC commands.
Implements the core IRC server functionality as a Singleton.
Channel * getChannel(const std::string &name)
Retrieves a Channel object by its name.
Client * getClientByNickname(const std::string &nickname)
Retrieves a Client object by its nickname.
const std::map< int, Client * > & getClients() const
Gets a constant reference to the map of clients managed by the server.
const std::map< std::string, Channel * > & getChannels() const
Gets a constant reference to the map of channels managed by the server.
~Server()
Destroys the Server object, cleaning up all clients, channels, and the command manager.
static Server * getInstance(int port=-1, const std::string &password="")
Gets the single instance of the Server (Singleton pattern).
void removeChannel(const std::string &name)
Removes a channel from the server, deleting the Channel object.
const std::string & getPassword() const
Gets the server's password.
void removeClient(int fd)
Removes a client from the server, closing its socket and freeing resources.
void acceptNewClient()
Accepts a new incoming client connection.
const std::string & getServerName() const
Gets the server's name.
void addChannel(Channel *channel)
Adds a new channel to the server.
void addTestClient(Client *client)
Adds a client directly to the server's management for testing purposes.
static void resetInstance()
Resets the singleton instance of the Server for testing purposes.
Client * getClient(int fd)
Retrieves a Client object by its file descriptor.
void run()
Starts the IRC server, setting up the socket and entering the main event loop.