Migrate to VoidLibrary (toolchain + API groundwork)
This commit is contained in:
1 parent
5e1e3d66c4
commit
e17cfed56f
38 files changed
+3077
-2505
No files matched your search
@@ -0,0 +1,129 @@
|
||||
#pragma once
|
||||
#ifndef PLUGIN
|
||||
#include <ConfigTypes.hpp>
|
||||
#endif
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Echoion::Api
|
||||
{
|
||||
|
||||
// ===== Plugin Event Types =====
|
||||
|
||||
enum class PluginEventType : uint8_t {
|
||||
ClientConnected = 0,
|
||||
ClientDisconnected,
|
||||
ClientMoved,
|
||||
TextMessageReceived,
|
||||
VoiceDataReceived,
|
||||
PlayRequested,
|
||||
PauseRequested,
|
||||
SkipRequested,
|
||||
StopRequested,
|
||||
TrackQueued,
|
||||
TrackRemoved,
|
||||
QueueCleared,
|
||||
QueueUpdated,
|
||||
PlaybackStarted,
|
||||
PlaybackPaused,
|
||||
PlaybackResumed,
|
||||
PlaybackStopped,
|
||||
TrackFinished,
|
||||
TrackSkipped,
|
||||
VolumeChanged,
|
||||
SeekPosition,
|
||||
HotReloadRequested,
|
||||
HotReloadCompleted,
|
||||
ConfigurationChanged
|
||||
};
|
||||
|
||||
// Minimal track info for Plugin (no internal types)
|
||||
struct TrackSummary {
|
||||
std::string id;
|
||||
std::string title;
|
||||
std::string artist;
|
||||
std::optional<std::chrono::milliseconds> duration;
|
||||
};
|
||||
|
||||
struct PluginEvent {
|
||||
PluginEventType type;
|
||||
std::optional<std::string> clientName;
|
||||
std::optional<TrackSummary>
|
||||
trackSummary; // Opaque summary instead of full TrackInfo
|
||||
uint64_t clientId = 0;
|
||||
std::optional<uint64_t> targetChannelId;
|
||||
std::optional<std::string> message;
|
||||
std::optional<float> volume;
|
||||
std::optional<int> queuePosition;
|
||||
std::chrono::system_clock::time_point timestamp;
|
||||
};
|
||||
|
||||
// ===== Connection Types =====
|
||||
|
||||
struct ClientInfo {
|
||||
uint64_t id = 0;
|
||||
std::string nickname;
|
||||
std::optional<std::string> uniqueIdentifier;
|
||||
uint64_t channelId = 0;
|
||||
bool isTalking = false;
|
||||
bool isMuted = false;
|
||||
bool isDeafened = false;
|
||||
std::vector<uint64_t> serverGroups;
|
||||
};
|
||||
|
||||
struct ChannelInfo {
|
||||
uint64_t id = 0;
|
||||
std::string name;
|
||||
std::optional<uint64_t> parentId;
|
||||
uint64_t order = 0;
|
||||
bool isDefault = false;
|
||||
bool hasPassword = false;
|
||||
uint32_t maxClients = 0;
|
||||
uint32_t currentClients = 0;
|
||||
};
|
||||
|
||||
struct ServerInfo {
|
||||
uint64_t id = 0;
|
||||
std::string name;
|
||||
std::string welcomeMessage;
|
||||
uint32_t maxClients = 0;
|
||||
uint32_t currentClients = 0;
|
||||
uint64_t defaultChannelId = 0;
|
||||
};
|
||||
|
||||
// ServerConfig is needed for Plugin's connectToServer()
|
||||
// This is a minimal version without dependencies on AudioTypes, etc.
|
||||
// Available to both Core and Plugin
|
||||
#ifdef PLUGIN
|
||||
struct ServerConfig {
|
||||
std::string address;
|
||||
uint16_t port = 0;
|
||||
std::string serverPassword;
|
||||
std::string nickname;
|
||||
std::optional<std::string> defaultChannelId;
|
||||
std::optional<std::string> channelPassword;
|
||||
std::vector<uint64_t> adminGroups;
|
||||
std::vector<uint64_t> djGroups;
|
||||
std::vector<uint64_t> bannedGroups;
|
||||
};
|
||||
#endif
|
||||
// ===== Callback Types =====
|
||||
|
||||
using EventCallback = std::function<void(const PluginEvent&)>;
|
||||
using CommandHandler = std::function<void(
|
||||
uint64_t clientId, const std::vector<std::string>& args)>;
|
||||
|
||||
struct CommandInfo {
|
||||
std::string name;
|
||||
std::string description;
|
||||
std::vector<std::string> aliases;
|
||||
std::optional<std::string> usage;
|
||||
bool requiresAdmin = false;
|
||||
CommandHandler handler;
|
||||
};
|
||||
|
||||
} // namespace Echoion::Api
|
||||
Reference in new issue
Block a user