#include "ping_thread.hpp" #include "irc_parse_thread.hpp" #include "write_irc.hpp" PingThread::PingThread(Connection * connection) noexcept : connection_{connection} {} auto PingThread::priority() const -> priority_type { return 1; } auto PingThread::on_event(Event const& event) -> std::pair { if (auto const irc_event = dynamic_cast(&event)) { auto& irc = irc_event->irc; if ("PING" == irc.command && 1 == irc.args.size()) { write_irc(*connection_, "PONG", irc.args[0]); return {ThreadOutcome::Continue, EventOutcome::Consume}; } } return {}; }