xbot/myirc/include/registration.hpp

47 lines
1021 B
C++

#pragma once
#include "connection.hpp"
#include "client.hpp"
#include <memory>
#include <string>
#include <unordered_map>
class Registration : public std::enable_shared_from_this<Registration>
{
public:
struct Settings {
std::string nickname;
std::string username;
std::string realname;
std::string password;
std::unique_ptr<SaslMechanism> sasl_mechanism;
};
private:
Settings settings_;
std::shared_ptr<Client> client_;
boost::signals2::scoped_connection slot_;
boost::signals2::scoped_connection caps_slot_;
auto on_connect() -> void;
auto on_cap_list(const std::unordered_map<std::string, std::string> &) -> void;
auto on_ircmsg(IrcCommand, const IrcMsg &msg) -> void;
auto send_req() -> void;
auto randomize_nick() -> void;
public:
Registration(
Settings,
std::shared_ptr<Client>
);
static auto start(
Settings,
std::shared_ptr<Client>
) -> std::shared_ptr<Registration>;
};