#include "Ping.hpp" #include "../IRC.hpp" #include Ping::Ping() : pingID("") {} Ping::~Ping() {} bool Ping::validate(const User &user, const std::string &msg) { size_t pos; size_t leng; leng = msg.length(); // get the length of the message pos = msg.find(" ") + 1; // get position of start of PingID this->pingID = msg.substr(pos, leng - pos); // set PingID return true; } int Ping::run(User &user, IRC::t_send_f &send) { send(user, "PONG " + this->pingID); std::cout << "PONG " + this->pingID << " Sent to " << user.getUserName() << std::endl; return (0); }