blabla/Ping.cpp
Danny Jonker d426297b2a bla
2024-08-03 21:04:44 +02:00

27 lines
583 B
C++

#include "Ping.hpp"
#include "../IRC.hpp"
#include <string>
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);
}