ft_irc 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
PingCommand.cpp
[詳解]
1
8#include "PingCommand.hpp"
9
11
13
15 if (args.empty()) {
16 // PINGコマンドにパラメータがない場合、ERR_NOORIGINを返す
19 return;
20 }
21
22 // PONG <server_name> :<parameter>
23 std::string pongMessage = "PONG " + this->_server->getServerName() + " :" + args[0];
24 client->sendMessage(pongMessage);
25}
Handles the PING command.
std::string formatReply(const std::string &serverName, const std::string &clientNickname, const std::string &replyCodeAndText)
Formats an IRC reply message without extra parameters.
Definition Replies.cpp:14
#define ERR_NOORIGIN
Definition Replies.hpp:69
Represents an IRC client connected to the server.
Definition Client.hpp:25
virtual void sendMessage(const std::string &message) const
Sends a message to the client by appending it to the send buffer.
Definition Client.cpp:135
const std::string & getNickname() const
Gets the client's nickname.
Definition Client.cpp:25
Abstract base class (interface) for all IRC commands.
Definition ICommand.hpp:26
Server * _server
Pointer to the IRC server instance.
Definition ICommand.hpp:28
virtual void execute(Client *client, const std::vector< std::string > &args)
Executes the PING command.
virtual ~PingCommand()
Destroys the PingCommand object.
PingCommand(Server *server)
Constructs a PingCommand object.
Implements the core IRC server functionality as a Singleton.
Definition Server.hpp:49
const std::string & getServerName() const
Gets the server's name.
Definition Server.cpp:381
T empty(T... args)