1 parent
01362d2e51
commit
39aff68d8d
29 files changed
+2061
-1818
No files matched your search
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include <PluginInterface.hpp>
|
||||
#include <PluginTypes.hpp>
|
||||
#include <Types.hpp>
|
||||
|
||||
#include <Void/Data/Json.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
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<Api::ChannelInfo> channels;
|
||||
std::vector<Api::ClientInfo> clients;
|
||||
bool connected = false;
|
||||
std::uint64_t revision = 0;
|
||||
};
|
||||
|
||||
void setPluginInterface(Api::PluginInterfacePtr plugin);
|
||||
[[nodiscard]] Api::Result<void> 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<Api::ChannelInfo>
|
||||
orderChannels(std::vector<Api::ChannelInfo> channels);
|
||||
|
||||
private:
|
||||
|
||||
mutable std::mutex mutex_;
|
||||
Api::PluginInterfacePtr plugin_;
|
||||
Snapshot snapshot_;
|
||||
};
|
||||
|
||||
} // namespace Echoion::Core
|
||||
Reference in new issue
Block a user