2023-11-25 09:22:55 -08:00
|
|
|
#include "ping_thread.hpp"
|
|
|
|
|
|
|
|
#include "irc_parse_thread.hpp"
|
|
|
|
#include "write_irc.hpp"
|
|
|
|
|
2023-11-27 14:12:20 -08:00
|
|
|
auto PingThread::start(Connection& connection) -> void
|
2023-11-25 09:22:55 -08:00
|
|
|
{
|
2023-11-26 15:40:40 -08:00
|
|
|
connection.add_listener<IrcMsgEvent>([&connection](IrcMsgEvent& event)
|
2023-11-25 09:22:55 -08:00
|
|
|
{
|
2023-11-25 20:09:20 -08:00
|
|
|
auto& irc = event.irc;
|
2023-11-26 15:08:55 -08:00
|
|
|
if (IrcCommand::PING == event.command)
|
2023-11-25 09:22:55 -08:00
|
|
|
{
|
2023-11-26 15:40:40 -08:00
|
|
|
send_pong(connection, irc.args[0]);
|
2023-11-25 20:09:20 -08:00
|
|
|
event.handled_ = true;
|
2023-11-25 09:22:55 -08:00
|
|
|
}
|
2023-11-25 20:09:20 -08:00
|
|
|
});
|
2023-11-25 09:22:55 -08:00
|
|
|
}
|