413 lines
18 KiB
C++
413 lines
18 KiB
C++
#pragma once
|
|
#include "PluginInterface.hpp"
|
|
// #include "Youtube/Client.hpp"
|
|
#include "ts6bot/AudioDecoder.hpp"
|
|
#include <memory>
|
|
#include "ts6bot/Config.hpp"
|
|
#include <ts6bot/MusicManager.hpp>
|
|
#include <ts6bot/Proxy.hpp>
|
|
|
|
#include "PluginDefinitions.hpp"
|
|
#include "ts6bot/MusicManager.hpp"
|
|
|
|
class EchoionCore : public IEchoionPlugin {
|
|
// Dependencies
|
|
std::shared_ptr<TS3Functions> m_ts3;
|
|
std::unique_ptr<MusicManager> m_musicManager;
|
|
|
|
public:
|
|
explicit EchoionCore(std::shared_ptr<TS3Functions> funcs) {
|
|
m_ts3 = std::move(funcs);
|
|
}
|
|
|
|
void Initialize(bool start = true) override;
|
|
|
|
void Shutdown() override;
|
|
|
|
// --- HOT RELOAD ---
|
|
void RequestGracefulStop() override ;
|
|
|
|
bool IsStopped() override;
|
|
|
|
std::string SerializeState() override;
|
|
|
|
void DeserializeState(const std::string &jsonState) override;
|
|
|
|
void onConnectStatusChangeEvent(uint64 serverConnectionHandlerID, int newStatus, unsigned errorNumber) override {
|
|
}
|
|
|
|
void onNewChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID) override {
|
|
}
|
|
|
|
void onNewChannelCreatedEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID,
|
|
anyID invokerID, const char *invokerName,
|
|
const char *invokerUniqueIdentifier) override {
|
|
}
|
|
|
|
void onDelChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, anyID invokerID, const char *invokerName,
|
|
const char *invokerUniqueIdentifier) override {
|
|
}
|
|
|
|
void onChannelMoveEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 newChannelParentID,
|
|
anyID invokerID, const char *invokerName, const char *invokerUniqueIdentifier) override {
|
|
}
|
|
|
|
void onUpdateChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID) override {
|
|
}
|
|
|
|
void onUpdateChannelEditedEvent(uint64 serverConnectionHandlerID, uint64 channelID, anyID invokerID,
|
|
const char *invokerName, const char *invokerUniqueIdentifier) override {
|
|
}
|
|
|
|
void onUpdateClientEvent(uint64 serverConnectionHandlerID, anyID clientID, anyID invokerID, const char *invokerName,
|
|
const char *invokerUniqueIdentifier) override {
|
|
}
|
|
|
|
void onClientMoveEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID,
|
|
int visibility, const char *moveMessage) override;
|
|
|
|
void onClientMoveSubscriptionEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID,
|
|
uint64 newChannelID, int visibility) override {
|
|
}
|
|
|
|
void onClientMoveTimeoutEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID,
|
|
uint64 newChannelID, int visibility, const char *timeoutMessage) override {
|
|
}
|
|
|
|
void onClientMoveMovedEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID,
|
|
uint64 newChannelID, int visibility, anyID moverID, const char *moverName,
|
|
const char *moverUniqueIdentifier,
|
|
const char *moveMessage) override {
|
|
}
|
|
|
|
void onClientKickFromChannelEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID,
|
|
uint64 newChannelID, int visibility, anyID kickerID, const char *kickerName,
|
|
const char *kickerUniqueIdentifier,
|
|
const char *kickMessage) override {
|
|
}
|
|
|
|
void onClientKickFromServerEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID,
|
|
uint64 newChannelID, int visibility, anyID kickerID, const char *kickerName,
|
|
const char *kickerUniqueIdentifier,
|
|
const char *kickMessage) override {
|
|
}
|
|
|
|
void onClientIDsEvent(uint64 serverConnectionHandlerID, const char *uniqueClientIdentifier, anyID clientID,
|
|
const char *clientName) override {
|
|
}
|
|
|
|
void onClientIDsFinishedEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onServerEditedEvent(uint64 serverConnectionHandlerID, anyID editerID, const char *editerName,
|
|
const char *editerUniqueIdentifier) override {
|
|
}
|
|
|
|
void onServerUpdatedEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
int onServerErrorEvent(uint64 serverConnectionHandlerID, const char *errorMessage, unsigned error,
|
|
const char *returnCode, const char *extraMessage) override {
|
|
return 0;
|
|
}
|
|
|
|
void onServerStopEvent(uint64 serverConnectionHandlerID, const char *shutdownMessage) override {
|
|
}
|
|
|
|
int onTextMessageEvent(uint64 serverConnectionHandlerID, anyID targetMode, anyID toID, anyID fromID,
|
|
const char *fromName, const char *fromUniqueIdentifier, const char *message,
|
|
int ffIgnored) override;
|
|
|
|
void onTalkStatusChangeEvent(uint64 serverConnectionHandlerID, int status, int isReceivedWhisper,
|
|
anyID clientID) override {
|
|
}
|
|
|
|
void onConnectionInfoEvent(uint64 serverConnectionHandlerID, anyID clientID) override {
|
|
}
|
|
|
|
void onServerConnectionInfoEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onChannelSubscribeEvent(uint64 serverConnectionHandlerID, uint64 channelID) override {
|
|
}
|
|
|
|
void onChannelSubscribeFinishedEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onChannelUnsubscribeEvent(uint64 serverConnectionHandlerID, uint64 channelID) override {
|
|
}
|
|
|
|
void onChannelUnsubscribeFinishedEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onChannelDescriptionUpdateEvent(uint64 serverConnectionHandlerID, uint64 channelID) override {
|
|
}
|
|
|
|
void onChannelPasswordChangedEvent(uint64 serverConnectionHandlerID, uint64 channelID) override {
|
|
}
|
|
|
|
void onPlaybackShutdownCompleteEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onSoundDeviceListChangedEvent(const char *modeID, int playOrCap) override {
|
|
}
|
|
|
|
void onEditPlaybackVoiceDataEvent(uint64 serverConnectionHandlerID, anyID clientID, short *samples, int sampleCount,
|
|
int channels) override {
|
|
}
|
|
|
|
void onEditPostProcessVoiceDataEvent(uint64 serverConnectionHandlerID, anyID clientID, short *samples,
|
|
int sampleCount, int channels, const unsigned *channelSpeakerArray,
|
|
unsigned *channelFillMask) override {
|
|
}
|
|
|
|
void onEditMixedPlaybackVoiceDataEvent(uint64 serverConnectionHandlerID, short *samples, int sampleCount,
|
|
int channels, const unsigned *channelSpeakerArray,
|
|
unsigned *channelFillMask) override {
|
|
}
|
|
|
|
void onEditCapturedVoiceDataEvent(uint64 serverConnectionHandlerID, short *samples, int sampleCount, int channels,
|
|
int *edited) override {
|
|
}
|
|
|
|
void onCustom3dRolloffCalculationClientEvent(uint64 serverConnectionHandlerID, anyID clientID, float distance,
|
|
float *volume) override {
|
|
}
|
|
|
|
void onCustom3dRolloffCalculationWaveEvent(uint64 serverConnectionHandlerID, uint64 waveHandle, float distance,
|
|
float *volume) override {
|
|
}
|
|
|
|
void onUserLoggingMessageEvent(const char *logMessage, int logLevel, const char *logChannel, uint64 logID,
|
|
const char *logTime, const char *completeLogString) override {
|
|
}
|
|
|
|
void onClientBanFromServerEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID,
|
|
uint64 newChannelID, int visibility, anyID kickerID, const char *kickerName,
|
|
const char *kickerUniqueIdentifier,
|
|
uint64 time, const char *kickMessage) override {
|
|
}
|
|
|
|
int onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClientID, const char *pokerName,
|
|
const char *pokerUniqueIdentity, const char *message, int ffIgnored) override {
|
|
return 0;
|
|
}
|
|
|
|
void onClientSelfVariableUpdateEvent(uint64 serverConnectionHandlerID, int flag, const char *oldValue,
|
|
const char *newValue) override {
|
|
}
|
|
|
|
void onFileListEvent(uint64 serverConnectionHandlerID, uint64 channelID, const char *path, const char *name,
|
|
uint64 size, uint64 datetime, int type, uint64 incompletesize, const char *returnCode) override {
|
|
}
|
|
|
|
void onFileListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelID, const char *path) override {
|
|
}
|
|
|
|
void onFileInfoEvent(uint64 serverConnectionHandlerID, uint64 channelID, const char *name, uint64 size,
|
|
uint64 datetime) override {
|
|
}
|
|
|
|
void onServerGroupListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, const char *name, int type,
|
|
int iconID, int saveDB) override {
|
|
}
|
|
|
|
void onServerGroupListFinishedEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onServerGroupByClientIDEvent(uint64 serverConnectionHandlerID, const char *name, uint64 serverGroupList,
|
|
uint64 clientDatabaseID) override {
|
|
}
|
|
|
|
void onServerGroupPermListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, unsigned permissionID,
|
|
int permissionValue, int permissionNegated, int permissionSkip) override {
|
|
}
|
|
|
|
void onServerGroupPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID) override {
|
|
}
|
|
|
|
void onServerGroupClientListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, uint64 clientDatabaseID,
|
|
const char *clientNameIdentifier, const char *clientUniqueID) override {
|
|
}
|
|
|
|
void onChannelGroupListEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, const char *name, int type,
|
|
int iconID, int saveDB) override {
|
|
}
|
|
|
|
void onChannelGroupListFinishedEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onChannelGroupPermListEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, unsigned permissionID,
|
|
int permissionValue, int permissionNegated, int permissionSkip) override {
|
|
}
|
|
|
|
void onChannelGroupPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID) override {
|
|
}
|
|
|
|
void onChannelPermListEvent(uint64 serverConnectionHandlerID, uint64 channelID, unsigned permissionID,
|
|
int permissionValue, int permissionNegated, int permissionSkip) override {
|
|
}
|
|
|
|
void onChannelPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelID) override {
|
|
}
|
|
|
|
void onClientPermListEvent(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, unsigned permissionID,
|
|
int permissionValue, int permissionNegated, int permissionSkip) override {
|
|
}
|
|
|
|
void onClientPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 clientDatabaseID) override {
|
|
}
|
|
|
|
void onChannelClientPermListEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID,
|
|
unsigned permissionID, int permissionValue, int permissionNegated,
|
|
int permissionSkip) override {
|
|
}
|
|
|
|
void onChannelClientPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelID,
|
|
uint64 clientDatabaseID) override {
|
|
}
|
|
|
|
void onClientChannelGroupChangedEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, uint64 channelID,
|
|
anyID clientID, anyID invokerClientID, const char *invokerName,
|
|
const char *invokerUniqueIdentity) override {
|
|
}
|
|
|
|
int onServerPermissionErrorEvent(uint64 serverConnectionHandlerID, const char *errorMessage, unsigned error,
|
|
const char *returnCode, unsigned failedPermissionID) override {
|
|
}
|
|
|
|
void onPermissionListGroupEndIDEvent(uint64 serverConnectionHandlerID, unsigned groupEndID) override {
|
|
}
|
|
|
|
void onPermissionListEvent(uint64 serverConnectionHandlerID, unsigned permissionID, const char *permissionName,
|
|
const char *permissionDescription) override {
|
|
}
|
|
|
|
void onPermissionListFinishedEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onPermissionOverviewEvent(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, uint64 channelID,
|
|
int overviewType, uint64 overviewID1, uint64 overviewID2, unsigned permissionID,
|
|
int permissionValue,
|
|
int permissionNegated, int permissionSkip) override {
|
|
}
|
|
|
|
void onPermissionOverviewFinishedEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onServerGroupClientAddedEvent(uint64 serverConnectionHandlerID, anyID clientID, const char *clientName,
|
|
const char *clientUniqueIdentity, uint64 serverGroupID, anyID invokerClientID,
|
|
const char *invokerName,
|
|
const char *invokerUniqueIdentity) override {
|
|
}
|
|
|
|
void onServerGroupClientDeletedEvent(uint64 serverConnectionHandlerID, anyID clientID, const char *clientName,
|
|
const char *clientUniqueIdentity, uint64 serverGroupID, anyID invokerClientID,
|
|
const char *invokerName,
|
|
const char *invokerUniqueIdentity) override {
|
|
}
|
|
|
|
void onClientNeededPermissionsEvent(uint64 serverConnectionHandlerID, unsigned permissionID,
|
|
int permissionValue) override {
|
|
}
|
|
|
|
void onClientNeededPermissionsFinishedEvent(uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onFileTransferStatusEvent(anyID transferID, unsigned status, const char *statusMessage, uint64 remotefileSize,
|
|
uint64 serverConnectionHandlerID) override {
|
|
}
|
|
|
|
void onClientChatClosedEvent(uint64 serverConnectionHandlerID, anyID clientID,
|
|
const char *clientUniqueIdentity) override {
|
|
}
|
|
|
|
void onClientChatComposingEvent(uint64 serverConnectionHandlerID, anyID clientID,
|
|
const char *clientUniqueIdentity) override {
|
|
}
|
|
|
|
void onServerLogEvent(uint64 serverConnectionHandlerID, const char *logMsg) override {
|
|
}
|
|
|
|
void onServerLogFinishedEvent(uint64 serverConnectionHandlerID, uint64 lastPos, uint64 fileSize) override {
|
|
}
|
|
|
|
void onMessageListEvent(uint64 serverConnectionHandlerID, uint64 messageID, const char *fromClientUniqueIdentity,
|
|
const char *subject, uint64 timestamp, int flagRead) override {
|
|
}
|
|
|
|
void onMessageGetEvent(uint64 serverConnectionHandlerID, uint64 messageID, const char *fromClientUniqueIdentity,
|
|
const char *subject, const char *message, uint64 timestamp) override {
|
|
}
|
|
|
|
void onClientDBIDfromUIDEvent(uint64 serverConnectionHandlerID, const char *uniqueClientIdentifier,
|
|
uint64 clientDatabaseID) override {
|
|
}
|
|
|
|
void onClientNamefromUIDEvent(uint64 serverConnectionHandlerID, const char *uniqueClientIdentifier,
|
|
uint64 clientDatabaseID, const char *clientNickName) override {
|
|
}
|
|
|
|
void onClientNamefromDBIDEvent(uint64 serverConnectionHandlerID, const char *uniqueClientIdentifier,
|
|
uint64 clientDatabaseID, const char *clientNickName) override {
|
|
}
|
|
|
|
void onComplainListEvent(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID,
|
|
const char *targetClientNickName, uint64 fromClientDatabaseID,
|
|
const char *fromClientNickName,
|
|
const char *complainReason, uint64 timestamp) override {
|
|
}
|
|
|
|
void onBanListEvent(uint64 serverConnectionHandlerID, uint64 banid, const char *ip, const char *name, const char *uid,
|
|
const char *mytsid, uint64 creationTime, uint64 durationTime, const char *invokerName,
|
|
uint64 invokercldbid,
|
|
const char *invokeruid, const char *reason, int numberOfEnforcements,
|
|
const char *lastNickName) override {
|
|
}
|
|
|
|
void onClientServerQueryLoginPasswordEvent(uint64 serverConnectionHandlerID, const char *loginPassword) override {
|
|
}
|
|
|
|
void onPluginCommandEvent(uint64 serverConnectionHandlerID, const char *pluginName, const char *pluginCommand,
|
|
anyID invokerClientID, const char *invokerName,
|
|
const char *invokerUniqueIdentity) override {
|
|
}
|
|
|
|
void onIncomingClientQueryEvent(uint64 serverConnectionHandlerID, const char *commandText) override {
|
|
}
|
|
|
|
void onServerTemporaryPasswordListEvent(uint64 serverConnectionHandlerID, const char *clientNickname,
|
|
const char *uniqueClientIdentifier, const char *description,
|
|
const char *password, uint64 timestampStart,
|
|
uint64 timestampEnd, uint64 targetChannelID,
|
|
const char *targetChannelPW) override {
|
|
}
|
|
|
|
void onAvatarUpdated(uint64 serverConnectionHandlerID, anyID clientID, const char *avatarPath) override {
|
|
}
|
|
|
|
void onMenuItemEvent(uint64 serverConnectionHandlerID, PluginMenuType type, int menuItemID,
|
|
uint64 selectedItemID) override {
|
|
}
|
|
|
|
void onHotkeyEvent(const char *keyword) override {
|
|
}
|
|
|
|
void onHotkeyRecordedEvent(const char *keyword, const char *key) override {
|
|
}
|
|
|
|
void onClientDisplayNameChanged(uint64 serverConnectionHandlerID, anyID clientID, const char *displayName,
|
|
const char *uniqueClientIdentifier) override {
|
|
}
|
|
};
|
|
|
|
extern "C" {
|
|
IEchoionPlugin *CreatePlugin(const TS3Functions* funcs) {
|
|
return new EchoionCore(std::make_shared<TS3Functions>(*funcs));
|
|
}
|
|
|
|
void DestroyPlugin(const IEchoionPlugin *plugin) {
|
|
delete plugin;
|
|
}
|
|
}
|