51 lines
1.1 KiB
C++
51 lines
1.1 KiB
C++
|
#pragma once
|
||
|
|
||
|
#include "thread.hpp"
|
||
|
#include "connection.hpp"
|
||
|
#include "irc_parse_thread.hpp"
|
||
|
#include "write_irc.hpp"
|
||
|
|
||
|
#include <string>
|
||
|
#include <unordered_set>
|
||
|
#include <unordered_map>
|
||
|
|
||
|
struct RegistrationThread : Thread
|
||
|
{
|
||
|
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;
|
||
|
|
||
|
enum class Stage
|
||
|
{
|
||
|
LsReply,
|
||
|
AckReply,
|
||
|
};
|
||
|
|
||
|
Stage stage_;
|
||
|
|
||
|
RegistrationThread(
|
||
|
Connection * connection_,
|
||
|
std::string password,
|
||
|
std::string username,
|
||
|
std::string realname,
|
||
|
std::string nickname
|
||
|
);
|
||
|
|
||
|
auto priority() const -> priority_type override;
|
||
|
auto on_connect() -> Thread::callback_result;
|
||
|
|
||
|
auto send_req() -> Thread::callback_result;
|
||
|
|
||
|
auto capack(IrcMsg const& msg) -> Thread::callback_result;
|
||
|
|
||
|
auto capls(IrcMsg const& msg) -> Thread::callback_result;
|
||
|
|
||
|
auto on_msg(IrcMsg const& msg) -> Thread::callback_result;
|
||
|
|
||
|
auto on_event(Event const& event) -> Thread::callback_result override;
|
||
|
};
|