27 if (channel == NULL) {
41 if (args.
size() == 1) {
66 if (args.
size() > 1) {
68 if (!newTopic.
empty() && newTopic.
at(0) ==
':') {
71 for (
size_t i = 2; i < args.
size(); ++i) {
72 newTopic +=
" " + args[i];
77 std::string topicMessage = client->
getPrefix() +
" TOPIC " + channelName +
" :" + newTopic +
"\r\n";
Manages channel members and states.
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_CHANOPRIVSNEEDED
#define ERR_NOSUCHCHANNEL
#define ERR_NEEDMOREPARAMS
Core IRC server implementation.
Handles the TOPIC command.
bool hasMode(char mode) const
bool isMember(Client *client) const
void setTopic(const std::string &topic)
void broadcast(const std::string &message, Client *excludeClient)
bool isOperator(Client *client) const
const std::string & getTopic() const
Represents an IRC client connected to the server.
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.
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.
TopicCommand(Server *server)
Constructs a TopicCommand object.
void execute(Client *client, const std::vector< std::string > &args)
Executes the TOPIC command.