26 std::string partMessageSuffix = (args.
size() > 1) ?
" :" + args[1] :
"";
28 for (
size_t i = 0; i < channels.
size(); ++i) {
32 if (channel == NULL) {
47 std::string partMessage = client->
getPrefix() +
" PART " + channelName + partMessageSuffix +
"\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 PART 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_NOSUCHCHANNEL
#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)
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 PART command.
PartCommand(Server *server)
Constructs a PartCommand object.
Implements the core IRC server functionality as a Singleton.
Channel * getChannel(const std::string &name)
Retrieves a Channel object by its name.
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.