#include "irc_parse_thread.hpp" #include "connection.hpp" #include namespace { #include "irc_commands.inc" } // namespace auto irc_parse_thread(Connection& connection) -> void { connection.add_listener([&connection](LineEvent const& event) { auto const msg = parse_irc_message(event.line); auto const recognized = IrcCommandHash::in_word_set(msg.command.data(), msg.command.size()); auto const command = recognized && recognized->min_args <= msg.args.size() && recognized->max_args >= msg.args.size() ? recognized->command : IrcCommand::UNKNOWN; connection.make_event(command, msg); }); }