IRC SERVER
The goal of this project is to make you write your own IRC server.
Ping.hpp
Go to the documentation of this file.
1 #ifndef PING_H
2 #define PING_H
3 
4 // Our includes
5 #include "../Command.hpp"
6 
7 class Ping : public Command
8 {
9  public:
10  Ping()
11  {
12  _name = "ping";
13  _description = "Just ping-pong the server";
14  _usage = "ping";
15  _example[0] = "ping";
16  }
17 
18  void execute()
19  {
20  std::map<size_t, std::string> p = _message->getParams();
21  _sender->message("PONG " + p[0]);
22  }
23 };
24 #endif
Ping
Definition: Ping.hpp:7
Command::_description
std::string _description
Definition: Command.hpp:12
Command::_name
std::string _name
Definition: Command.hpp:11
Command
Definition: Command.hpp:7
Client::message
void message(char const *message)
Definition: client.cpp:15
Command::_message
Message * _message
Definition: Command.hpp:21
Command::_example
std::map< size_t, std::string > _example
Definition: Command.hpp:16
Ping::execute
void execute()
Definition: Ping.hpp:18
Message::getParams
std::map< size_t, std::string > getParams(void) const
Definition: message.cpp:79
Command::_usage
std::string _usage
Definition: Command.hpp:13
Command::_sender
Client * _sender
Definition: Command.hpp:19
Ping::Ping
Ping()
Definition: Ping.hpp:10