xbot/ping_thread.cpp
2023-11-27 19:09:45 -08:00

20 lines
463 B
C++

#include "ping_thread.hpp"
#include "connection.hpp"
#include "irc_parse_thread.hpp"
#include "ircmsg.hpp"
#include "write_irc.hpp"
auto PingThread::start(Connection& connection) -> void
{
connection.add_listener<IrcMsgEvent>([&connection](IrcMsgEvent& event)
{
auto& irc = event.irc;
if (IrcCommand::PING == event.command)
{
send_pong(connection, irc.args[0]);
event.handled_ = true;
}
});
}