16void UserCommand::registerClient(
Client *client) {
44 if (args.
size() < 4) {
57 for (
size_t i = 3; i < args.
size(); ++i) {
58 if (!realname.
empty()) {
63 if (!realname.
empty() && realname[0] ==
':') {
69 registerClient(client);
Manages client connection and state.
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_ALREADYREGISTRED
#define ERR_NEEDMOREPARAMS
Core IRC server implementation.
Handles the USER command.
Represents an IRC client connected to the server.
void setUsername(const std::string &username)
Sets the client's username.
bool isRegistered() const
Checks if the client is registered.
std::string getPrefix() const
Generates the client's IRC prefix (e.g., :nick!user@host).
void setRealname(const std::string &realname)
Sets the client's real name.
bool isAuthenticated() const
Checks if the client is authenticated.
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.
void setRegistered(bool value)
Sets the client's registration status.
Abstract base class (interface) for all IRC commands.
Server * _server
Pointer to the IRC server instance.
Implements the core IRC server functionality as a Singleton.
const std::string & getServerName() const
Gets the server's name.
UserCommand(Server *server)
Constructs a UserCommand object.
void execute(Client *client, const std::vector< std::string > &args)
Executes the USER command.