#pragma once #include #include #include struct Connection; struct IrcMsg; /** * @brief Thread to track this connection's identity, and IRC state. * */ class SelfThread { Connection& connection_; std::string nickname_; std::string mode_; std::unordered_set channels_; auto on_welcome(IrcMsg const& irc) -> void; auto on_nick(IrcMsg const& irc) -> void; auto on_umodeis(IrcMsg const& irc) -> void; auto on_join(IrcMsg const& irc) -> void; auto on_kick(IrcMsg const& irc) -> void; auto on_part(IrcMsg const& irc) -> void; auto on_mode(IrcMsg const& irc) -> void; public: SelfThread(Connection& connection) : connection_{connection} {} static auto start(Connection&) -> std::shared_ptr; auto get_my_nickname() const -> std::string const&; auto get_my_mode() const -> std::string const&; auto get_my_channels() const -> std::unordered_set const&; auto is_my_nick(std::string_view nick) const -> bool; auto is_my_mask(std::string_view nick) const -> bool; };