#pragma once #include "event.hpp" #include #include class Connection; enum class SnoteTag { ClientConnecting, ClientExiting, RejectingKlined, NickChange, CreateChannel, TemporaryKlineExpired, DisconnectingKlined, }; struct SnoteEvent : Event { SnoteEvent(SnoteTag tag, std::vector parts) : tag{tag} , parts{std::move(parts)} {} SnoteTag tag; std::vector parts; }; struct SnoteThread { struct DbDeleter { auto operator()(hs_database_t * db) const -> void { if (HS_SUCCESS != hs_free_database(db)) { abort(); } } }; struct ScratchDeleter { auto operator()(hs_scratch_t * scratch) const -> void { if (HS_SUCCESS != hs_free_scratch(scratch)) { abort(); } } }; std::unique_ptr db_; std::unique_ptr scratch_; static auto start(Connection& connection) -> std::shared_ptr; };