54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "connection.hpp"
|
|
#include "event.hpp"
|
|
#include "irc_parse_thread.hpp"
|
|
#include "write_irc.hpp"
|
|
|
|
#include <eventpp/eventdispatcher.h>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
|
|
class RegistrationThread : public std::enable_shared_from_this<RegistrationThread>
|
|
{
|
|
Connection& connection_;
|
|
std::string password_;
|
|
std::string username_;
|
|
std::string realname_;
|
|
std::string nickname_;
|
|
|
|
std::unordered_map<std::string, std::string> caps;
|
|
std::unordered_set<std::string> outstanding;
|
|
|
|
Connection::Handle<ConnectEvent> connect_handle_;
|
|
Connection::Handle<IrcMsgEvent> message_handle_;
|
|
|
|
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_,
|
|
std::string password,
|
|
std::string username,
|
|
std::string realname,
|
|
std::string nickname
|
|
);
|
|
|
|
static auto start(
|
|
Connection& connection,
|
|
std::string password,
|
|
std::string username,
|
|
std::string realname,
|
|
std::string nickname
|
|
) -> std::shared_ptr<RegistrationThread>;
|
|
};
|