xbot/registration.hpp

44 lines
1.0 KiB
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 15:45:31 -08:00
Connection &connection_;
2025-01-25 12:25:38 -08:00
const Settings &settings_;
2025-01-26 19:35:56 -08:00
std::shared_ptr<Client> self_;
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;
auto send_req() -> 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 listen_for_cap_ack() -> void;
auto listen_for_cap_ls() -> void;
public:
2025-01-26 19:35:56 -08:00
Registration(
2025-01-25 15:45:31 -08:00
Connection &connection_,
2025-01-25 12:25:38 -08:00
const Settings &,
2025-01-26 19:35:56 -08:00
std::shared_ptr<Client> self
2023-11-27 14:12:20 -08:00
);
static auto start(
2025-01-25 15:45:31 -08:00
Connection &connection,
2025-01-25 12:25:38 -08:00
const Settings &,
2025-01-26 19:35:56 -08:00
std::shared_ptr<Client> self
) -> std::shared_ptr<Registration>;
2023-11-27 14:12:20 -08:00
};