#pragma once #include "connection.hpp" #include "ref.hpp" #include #include #include /// @brief Implements the CHALLENGE command protocol to identify as an operator. class Challenge : std::enable_shared_from_this { Ref key_; Connection &connection_; boost::signals2::scoped_connection slot_; std::string buffer_; auto on_ircmsg(IrcCommand cmd, const IrcMsg &msg) -> void; auto finish_challenge() -> void; public: Challenge(Ref, Connection &); /// @brief Starts the CHALLENGE protocol. /// @param connection Registered connection. /// @param user Operator username /// @param key Operator private RSA key /// @return Handle to the challenge object. static auto start(Connection &, std::string_view user, Ref key) -> std::shared_ptr; };