#pragma once #include #include #include #include #include #include #include #include #include namespace Echoion::Core { // One authoritative, event-refreshed TeamSpeak topology cache. The public // serializer is deliberately structural: it has no fields for UIDs, groups, // database IDs, addresses, or query clients, so private data cannot leak by // accidentally toggling a flag at the HTTP boundary. class TeamSpeakDirectoryService { public: struct Snapshot { Api::ServerInfo server; std::vector channels; std::vector clients; bool connected = false; std::uint64_t revision = 0; }; void setPluginInterface(Api::PluginInterfacePtr plugin); [[nodiscard]] Api::Result refresh(); void handleEvent(Api::PluginEventType type); [[nodiscard]] Snapshot snapshot() const; [[nodiscard]] Void::Json::Value publicJson() const; [[nodiscard]] Void::Json::Value adminJson() const; // TeamSpeak stores a sibling's predecessor id in channel_order. // This helper turns that linked-list representation into display // order and deterministically appends malformed/orphaned entries. [[nodiscard]] static std::vector orderChannels(std::vector channels); private: mutable std::mutex mutex_; Api::PluginInterfacePtr plugin_; Snapshot snapshot_; }; } // namespace Echoion::Core