20 if (args.
size() < 2) {
33 if (channel == NULL) {
48 for (
size_t i = 0; i < users.
size(); ++i) {
52 if (targetClient == NULL) {
59 if (!channel->
isMember(targetClient)) {
69 client->
getPrefix() +
" KICK " + channelName +
" " + targetNick +
" :" + reason +
"\r\n";
Manages channel members and states.
Manages client connection and state.
std::vector< std::string > split(const std::string &s, char delimiter)
Splits a string into a vector of strings based on a delimiter.
Utility functions for command handling.
Handles the KICK 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_CHANOPRIVSNEEDED
#define ERR_NOSUCHCHANNEL
#define ERR_USERNOTINCHANNEL
#define ERR_NEEDMOREPARAMS
Core IRC server implementation.
const std::map< int, Client * > & getMembers() const
bool isMember(Client *client) const
void broadcast(const std::string &message, Client *excludeClient)
bool isOperator(Client *client) const
void removeMember(Client *client)
Represents an IRC client connected to the server.
void removeChannel(Channel *channel)
Removes a channel from the client's list of joined channels.
std::string getPrefix() const
Generates the client's IRC prefix (e.g., :nick!user@host).
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.
Abstract base class (interface) for all IRC commands.
Server * _server
Pointer to the IRC server instance.
void execute(Client *client, const std::vector< std::string > &args)
Executes the KICK command.
KickCommand(Server *server)
Constructs a KickCommand object.
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.
void removeChannel(const std::string &name)
Removes a channel from the server, deleting the Channel object.
const std::string & getServerName() const
Gets the server's name.