28 if (channelStr ==
"0") {
30 for (
size_t i = 0; i < joinedChannels.
size(); ++i) {
31 Channel *channel = joinedChannels[i];
46 for (
size_t i = 0; i < channels.
size(); ++i) {
49 if (channelName.
empty() || channelName[0] !=
'#') {
58 if (channel == NULL) {
59 channel =
new Channel(channelName);
127 names += it->second->getNickname() +
" ";
130 if (!names.
empty()) {
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 JOIN 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_INVITEONLYCHAN
#define ERR_BADCHANNELKEY
#define ERR_CHANNELISFULL
#define ERR_NOSUCHCHANNEL
#define ERR_NEEDMOREPARAMS
Core IRC server implementation.
void addMember(Client *client)
const std::map< int, Client * > & getMembers() const
unsigned int getLimit() const
const std::string & getName() const
bool hasMode(char mode) const
bool isMember(Client *client) const
void addOperator(Client *client)
bool isInvitedUser(Client *client) const
void broadcast(const std::string &message, Client *excludeClient)
bool isOperator(Client *client) const
void removeMember(Client *client)
bool checkKey(const std::string &key) const
void removeInvitedUser(Client *client)
const std::string & getTopic() const
Represents an IRC client connected to the server.
const std::vector< Channel * > & getChannels() const
Gets the list of channels the client is in.
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.
void addChannel(Channel *channel)
Adds a channel to the client's list of joined channels.
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 JOIN command.
JoinCommand(Server *server)
Constructs a JoinCommand object.
Implements the core IRC server functionality as a Singleton.
Channel * getChannel(const std::string &name)
Retrieves a Channel object by its name.
const std::string & getServerName() const
Gets the server's name.
void addChannel(Channel *channel)
Adds a new channel to the server.