xbot/registration.hpp

42 lines
944 B
C++
Raw Normal View History

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-25 15:45:31 -08:00
#include "settings.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-25 12:25:38 -08:00
const Settings &settings_;
std::shared_ptr<Client> client_;
2023-11-27 14:12:20 -08:00
std::unordered_map<std::string, std::string> caps;
std::unordered_set<std::string> outstanding;
2025-01-26 19:35:56 -08:00
boost::signals2::scoped_connection slot_;
2023-11-27 14:12:20 -08:00
auto on_connect() -> void;
2025-01-25 15:45:31 -08:00
auto on_msg_cap_ls(const IrcMsg &msg) -> void;
auto on_msg_cap_ack(const IrcMsg &msg) -> void;
2023-11-27 14:12:20 -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-25 12:25:38 -08:00
const 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-25 12:25:38 -08:00
const 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
};