45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "connection.hpp"
|
|
#include "self_thread.hpp"
|
|
#include "settings.hpp"
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
|
|
class RegistrationThread : public std::enable_shared_from_this<RegistrationThread>
|
|
{
|
|
Connection &connection_;
|
|
const Settings &settings_;
|
|
std::shared_ptr<SelfThread> self_;
|
|
|
|
std::unordered_map<std::string, std::string> caps;
|
|
std::unordered_set<std::string> outstanding;
|
|
|
|
boost::signals2::scoped_connection connect_handle_;
|
|
boost::signals2::scoped_connection message_handle_;
|
|
|
|
auto on_connect() -> void;
|
|
auto send_req() -> void;
|
|
auto on_msg_cap_ls(const IrcMsg &msg) -> void;
|
|
auto on_msg_cap_ack(const IrcMsg &msg) -> void;
|
|
|
|
auto listen_for_cap_ack() -> void;
|
|
auto listen_for_cap_ls() -> void;
|
|
|
|
public:
|
|
RegistrationThread(
|
|
Connection &connection_,
|
|
const Settings &,
|
|
std::shared_ptr<SelfThread> self
|
|
);
|
|
|
|
static auto start(
|
|
Connection &connection,
|
|
const Settings &,
|
|
std::shared_ptr<SelfThread> self
|
|
) -> std::shared_ptr<RegistrationThread>;
|
|
};
|