xbot/registration_thread.hpp

45 lines
1.1 KiB
C++
Raw Normal View History

2023-11-25 09:22:55 -08:00
#pragma once
#include "connection.hpp"
2025-01-25 12:25:38 -08:00
#include "settings.hpp"
#include "self_thread.hpp"
2023-11-25 09:22:55 -08:00
2023-11-27 14:12:20 -08:00
#include <memory>
2023-11-25 20:09:20 -08:00
#include <string>
2023-11-27 14:12:20 -08:00
#include <unordered_map>
#include <unordered_set>
2023-11-25 09:22:55 -08:00
2023-11-27 14:12:20 -08:00
class RegistrationThread : public std::enable_shared_from_this<RegistrationThread>
{
Connection& connection_;
2025-01-25 12:25:38 -08:00
const Settings &settings_;
std::shared_ptr<SelfThread> self_;
2023-11-27 14:12:20 -08:00
std::unordered_map<std::string, std::string> caps;
std::unordered_set<std::string> outstanding;
2025-01-23 12:46:52 -08:00
boost::signals2::scoped_connection connect_handle_;
boost::signals2::scoped_connection message_handle_;
2023-11-27 14:12:20 -08:00
auto on_connect() -> void;
auto send_req() -> void;
auto on_msg_cap_ls(IrcMsg const& msg) -> void;
auto on_msg_cap_ack(IrcMsg const& msg) -> void;
auto listen_for_cap_ack() -> void;
auto listen_for_cap_ls() -> void;
public:
RegistrationThread(
Connection& connection_,
2025-01-25 12:25:38 -08:00
const Settings &,
std::shared_ptr<SelfThread> self
2023-11-27 14:12:20 -08:00
);
static auto start(
Connection& connection,
2025-01-25 12:25:38 -08:00
const Settings &,
std::shared_ptr<SelfThread> self
2023-11-27 14:12:20 -08:00
) -> std::shared_ptr<RegistrationThread>;
};