2023-11-25 09:22:55 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "connection.hpp"
|
2025-01-26 19:35:56 -08:00
|
|
|
#include "client.hpp"
|
2025-01-30 09:28:28 -08:00
|
|
|
#include "ref.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
|
|
|
|
2025-01-26 19:35:56 -08:00
|
|
|
class Registration : public std::enable_shared_from_this<Registration>
|
2023-11-27 14:12:20 -08:00
|
|
|
{
|
2025-01-30 09:28:28 -08:00
|
|
|
public:
|
|
|
|
struct Settings {
|
|
|
|
std::string nickname;
|
|
|
|
std::string username;
|
|
|
|
std::string realname;
|
|
|
|
std::string password;
|
|
|
|
std::string sasl_mechanism;
|
|
|
|
std::string sasl_authcid;
|
|
|
|
std::string sasl_authzid;
|
|
|
|
std::string sasl_password;
|
2025-01-30 11:47:26 -08:00
|
|
|
Ref<EVP_PKEY> sasl_key;
|
2025-01-30 09:28:28 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
Settings settings_;
|
2025-01-27 09:30:09 -08:00
|
|
|
std::shared_ptr<Client> client_;
|
2023-11-27 14:12:20 -08:00
|
|
|
|
2025-01-26 19:35:56 -08:00
|
|
|
boost::signals2::scoped_connection slot_;
|
2025-01-27 11:08:16 -08:00
|
|
|
boost::signals2::scoped_connection caps_slot_;
|
2023-11-27 14:12:20 -08:00
|
|
|
|
|
|
|
auto on_connect() -> void;
|
2025-01-27 11:08:16 -08:00
|
|
|
auto on_cap_list(const std::unordered_map<std::string, std::string> &) -> void;
|
2023-11-27 14:12:20 -08:00
|
|
|
|
2025-01-27 09:30:09 -08:00
|
|
|
auto on_ircmsg(IrcCommand, const IrcMsg &msg) -> void;
|
|
|
|
|
|
|
|
auto send_req() -> void;
|
|
|
|
auto randomize_nick() -> void;
|
2023-11-27 14:12:20 -08:00
|
|
|
|
|
|
|
public:
|
2025-01-26 19:35:56 -08:00
|
|
|
Registration(
|
2025-01-30 09:28:28 -08:00
|
|
|
Settings,
|
2025-01-26 19:43:17 -08:00
|
|
|
std::shared_ptr<Client>
|
2023-11-27 14:12:20 -08:00
|
|
|
);
|
|
|
|
|
|
|
|
static auto start(
|
2025-01-30 09:28:28 -08:00
|
|
|
Settings,
|
2025-01-26 19:43:17 -08:00
|
|
|
std::shared_ptr<Client>
|
2025-01-26 19:35:56 -08:00
|
|
|
) -> std::shared_ptr<Registration>;
|
2023-11-27 14:12:20 -08:00
|
|
|
};
|