67 if (rawMessage[0] ==
':') {
68 start = rawMessage.
find(
' ');
69 if (start == std::string::npos)
74 size_t end = rawMessage.
find(
' ', start);
75 if (end == std::string::npos) {
76 command = rawMessage.
substr(start);
78 command = rawMessage.
substr(start, end - start);
97 if (!token.
empty() && token[0] ==
':') {
101 while (ss >> token) {
102 if (!token.
empty() && token[0] ==
':') {
106 if (!lastArg.
empty() && (lastArg[lastArg.
size() - 1] ==
'\r')) {
118 if (rawMessage.
empty() || !client) {
123 if (command.
empty()) {
128 if (it != _commands.
end()) {
130 it->second->execute(client, args);
Manages client connection and state.
Manages IRC commands and their execution.
Handles the INVITE command.
Handles the JOIN command.
Handles the KICK command.
Handles the LIST command.
Handles the MODE command.
Handles the NAMES command.
Handles the NICK command.
Handles the NOTICE command.
Handles the PART command.
Handles the PASS command.
Handles the PING command.
Handles the PONG command.
Handles the PRIVMSG command.
Handles the QUIT command.
std::string formatReply(const std::string &serverName, const std::string &clientNickname, const std::string &replyCodeAndText)
Formats an IRC reply message without extra parameters.
Defines IRC numeric replies and error messages.
#define ERR_UNKNOWNCOMMAND
Core IRC server implementation.
Handles the TOPIC command.
Handles the USER command.
Handles the WHOIS command.
Represents an IRC client connected to the server.
void updateActivityTime()
Updates the client's last activity time to the current time.
virtual void sendMessage(const std::string &message) const
Sends a message to the client by appending it to the send buffer.
const std::string & getNickname() const
Gets the client's nickname.
CommandManager(Server *server)
Constructs a new CommandManager object.
void parseAndExecute(Client *client, const std::string &rawMessage)
Parses a raw message and executes the corresponding command.
~CommandManager()
Destroys the CommandManager object and frees all registered command objects.
Implements the INVITE command.
Implements the JOIN command.
Implements the KICK command.
Implements the LIST command.
Implements the MODE command.
Implements the NAMES command.
Implements the NICK command.
Implements the NOTICE command.
Implements the PART command.
Implements the PASS command.
Implements the PING command.
Implements the PONG command.
Implements the PRIVMSG command.
Implements the QUIT command.
Implements the core IRC server functionality as a Singleton.
const std::string & getServerName() const
Gets the server's name.
Implements the TOPIC command.
Implements the USER command.
Implements the WHO command.
Implements the WHOIS command.