diff --git a/.gitignore b/.gitignore index e257658..e276a4b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +<<<<<<< HEAD # ---> C++ # Prerequisites *.d @@ -31,4 +32,146 @@ *.exe *.out *.app +======= +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json diff --git a/docs/client.html b/docs/client.html new file mode 100644 index 0000000..929a6a1 --- /dev/null +++ b/docs/client.html @@ -0,0 +1,8 @@ + + + + +

You will be automatically forwarded to the Client SDK manual.
Click on the link below if your browser does not support forwarding.

+

Client SDK manual

+ + diff --git a/docs/client.pdf b/docs/client.pdf new file mode 100644 index 0000000..949ce38 Binary files /dev/null and b/docs/client.pdf differ diff --git a/docs/client_html/ar01s01.html b/docs/client_html/ar01s01.html new file mode 100644 index 0000000..6f44a24 --- /dev/null +++ b/docs/client_html/ar01s01.html @@ -0,0 +1 @@ +Introduction

Introduction

TeamSpeak 3 is a scalable Voice-Over-IP application consisting of client and server software. TeamSpeak is generally regarded as the leading VoIP system offering a superior voice quality, scalability and usability.

The cross-platform Software Development Kit allows the easy integration of the TeamSpeak client and server technology into own applications.

Tis document provides an introduction to client-side programming with the TeamSpeak 3 SDK, the so-called Client Lib. This library encapsulates client-side functionality while keeping the user interface separated and modular.

diff --git a/docs/client_html/ar01s02.html b/docs/client_html/ar01s02.html new file mode 100644 index 0000000..fc01461 --- /dev/null +++ b/docs/client_html/ar01s02.html @@ -0,0 +1 @@ +System requirements

System requirements

For developing third-party clients with the TeamSpeak 3 Client Lib the following system requirements apply:

[Important]Important

The calling convention used in the functions exported by the shared TeamSpeak 3 SDK libaries is cdecl. You must not use another calling convention, like stdcall on Windows, when declaring function pointers to the TeamSpeak 3 SDK libraries. Otherwise stack corruption at runtime may occur.

diff --git a/docs/client_html/ar01s03.html b/docs/client_html/ar01s03.html new file mode 100644 index 0000000..71ff35c --- /dev/null +++ b/docs/client_html/ar01s03.html @@ -0,0 +1 @@ +Overview of header files

Overview of header files

The following header files are deployed to SDK developers:

diff --git a/docs/client_html/ar01s04.html b/docs/client_html/ar01s04.html new file mode 100644 index 0000000..c2184bb --- /dev/null +++ b/docs/client_html/ar01s04.html @@ -0,0 +1,21 @@ +Calling Client Lib functions

Calling Client Lib functions

Client Lib functions follow a common pattern. They always return an error code or ERROR_ok on success. If there is a result variable, it is always the last variable in the functions parameters list.

ERROR ts3client_FUNCNAME(arg1, arg2, ..., &result);

Result variables should only be accessed if the function returned ERROR_ok. Otherwise the state of the result variable is undefined.

In those cases where the result variable is a basic type (int, float etc.), the memory for the result variable has to be declared by the caller. Simply pass the address of the variable to the Client Lib function.

int result;
+
+if(ts3client_XXX(arg1, arg2, ..., &result) == ERROR_ok) {
+    /* Use result variable */
+} else {
+    /* Handle error, result variable is undefined */
+}

If the result variable is a pointer type (C strings, arrays etc.), the memory is allocated by the Client Lib function. In that case, the caller has to release the allocated memory later by using ts3client_freeMemory. It is important to only access and release the memory if the function returned ERROR_ok. Should the function return an error, the result variable is uninitialized, so freeing or accessing it could crash the application.

char* result;
+
+if(ts3client_XXX(arg1, arg2, ..., &result) == ERROR_ok) {
+    /* Use result variable */
+    ts3client_freeMemory(result);  /* Release result variable */
+} else {
+    /* Handle error, result variable is undefined. Do not access or release it. */
+}
[Note]Note

Client Lib functions are thread-safe. It is possible to access the Client Lib from several threads at the same time.

Return code

Client Lib functions that interact with the server take an additional parameter returnCode, which can be used to find out which action results in a later server error. If you pass a custom string as return code, the onServerErrorEvent callback will receive the same custom string in its returnCode parameter. If no error occured, onServerErrorEvent will indicate success py passing the error code ERROR_ok.

Pass NULL as returnCode if you do not need the feature. In this case, if no error occurs onServerErrorEvent will not be called.

An example, request moving a client:

ts3client_requestClientMove(scHandlerID, clientID, newChannelID, password, "MyClientMoveReturnCode");

If an error occurs, the onServerErrorEvent callback is called:

void my_onServerErrorEvent(uint64 serverConnectionHandlerID, const char* errorMessage,
+                           unsigned int error, const char* returnCode, const char* extraMessage) {
+    if(strcmp(returnCode, "MyClientMoveReturnCode")) == 0) {
+        /* We know this error is the reaction to above called function as we got the same returnCode */
+	if(error == ERROR_ok) {
+	    /* Success */
+	}
+}
diff --git a/docs/client_html/ar01s05.html b/docs/client_html/ar01s05.html new file mode 100644 index 0000000..350acdb --- /dev/null +++ b/docs/client_html/ar01s05.html @@ -0,0 +1,33 @@ +Initializing

Initializing

When starting the client, initialize the Client Lib with a call to +

unsigned int ts3client_initClientLib(functionPointers,  
 functionRarePointers,  
 usedLogTypes,  
 logFileFolder,  
 resourcesFolder); 
const struct ClientUIFunctions* functionPointers;
const struct ClientUIFunctionsRare* functionRarePointers;
int usedLogTypes;
const char* logFileFolder;
const char* resourcesFolder;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

[Note]Note

This function must not be called more than once.

The callback mechanism

The communication from Client Lib to Client UI takes place using callbacks. The Client UI has to define a series of function pointers using the struct ClientUIFunctions (see clientlib.h). These callbacks are used to forward any incoming server actions to the Client UI for further processing.

[Note]Note

All the clientlib callbacks are asynchronous, except for the sound callbacks which allow to directly manipulate the sound buffer.

A callback example in C:

static void my_onConnectStatusChangeEvent_Callback(uint64 serverConnectionHandlerID,
+                                                   int newStatus,
+                                                   int errorNumber) {
+    /* Implementation */
+}

C++ developers can also use static member functions for the callbacks.

Before calling ts3client_initClientLib, create an instance of struct ClientUIFunctions, initialize all function pointers with NULL and assign the structs function pointers to your callback functions: +

unsigned int error;
+
+/* Create struct */
+ClientUIFunctions clUIFuncs;
+
+/* Initialize all function pointers with NULL */
+memset(&clUIFuncs, 0, sizeof(struct ClientUIFunctions));
+
+/* Assign those function pointers you implemented */
+clUIFuncs.onConnectStatusChangeEvent = my_onConnectStatusChangeEvent_Callback;
+clUIFuncs.onNewChannelEvent          = my_onNewChannelEvent_Callback;
+(...)
+
+/* Initialize client lib with callback function pointers */
+error = ts3client_initClientLib(&clUIFuncs, NULL, LogType_FILE | LogType_CONSOLE);
+if(error != ERROR_ok) {
+    printf("Error initializing clientlib: %d\n", error);
+    (...)
+}
[Important]Important

As long as you initialize unimplemented callbacks with NULL, the Client Lib won't attempt to call those function pointers. However, if you leave unimplemented callbacks undefined, the Client Lib will crash when trying to calling them.

[Note]Note

All callbacks used in the SDK are found in the struct ClientUIFunctions (see public_definitions.h). Callbacks bundled in the struct ClientUIFunctionsRare are not used by the SDK. These callbacks were split in a separate structs to avoid polluting the SDK headers with code used only internally.

diff --git a/docs/client_html/ar01s06.html b/docs/client_html/ar01s06.html new file mode 100644 index 0000000..07329ee --- /dev/null +++ b/docs/client_html/ar01s06.html @@ -0,0 +1,22 @@ +Querying the library version

Querying the library version

The complete Client Lib version string can be queried with

unsigned int ts3client_getClientLibVersion(result); 
char** result;
 
[Caution]Caution

The result string must be released using ts3client_freeMemory. If an error has occured, the result string is uninitialized and must not be released.


+

To get only the version number, which is a part of the complete version string, as numeric value: +

unsigned int ts3client_getClientLibVersionNumber(result); 
uint64* result;
 

+

Both functions return ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

An example using ts3client_getClientLibVersion: +

unsigned int error;
+char* version;
+error = ts3client_getClientLibVersion(&version);
+if(error != ERROR_ok) {
+    printf("Error querying clientlib version: %d\n", error);
+    return;
+}
+printf("Client library version: %s\n", version);  /* Print version */
+ts3client_freeMemory(version);  /* Release string */

Example using ts3client_getClientLibVersionNumber: +

unsigned int error;
+uint64 version;
+error = ts3client_getClientLibVersionNumber(&version);
+if(error != ERROR_ok) {
+    printf("Error querying clientlib version number: %d\n", error);
+    return;
+}
+printf("Client library version number: %ld\n", version);  /* Print version */
diff --git a/docs/client_html/ar01s07.html b/docs/client_html/ar01s07.html new file mode 100644 index 0000000..5b8139d --- /dev/null +++ b/docs/client_html/ar01s07.html @@ -0,0 +1,3 @@ +Shutting down

Shutting down

Before exiting the client application, the Client Lib should be shut down with +

unsigned int ts3client_destroyClientLib(); 
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

Make sure to call this function after disconnecting from any TeamSpeak 3 servers. Any call to Client Lib functions after shutting down has undefined results.

diff --git a/docs/client_html/ar01s08.html b/docs/client_html/ar01s08.html new file mode 100644 index 0000000..f669d70 --- /dev/null +++ b/docs/client_html/ar01s08.html @@ -0,0 +1,5 @@ +Managing server connection handlers

Managing server connection handlers

Before connecting to a TeamSpeak 3 server, a new server connection handler needs to be spawned. Each handler is identified by a unique ID (usually called serverConnectionHandlerID). With one server connection handler a connection can be established and dropped multiple times, so for simply reconnecting to the same or another server no new handler needs to be spawned but existing ones can be reused. However, for using multiple connections simultaneously a new handler has to be spawned for each connection.

To create a new server connection handler and receive its ID, call +

unsigned int ts3client_spawnNewServerConnectionHandler(port,  
 result); 
int port;
uint64* result;
 

+

To destroy a server connection handler, call +

unsigned int ts3client_destroyServerConnectionHandler(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

+

Both functions return ERROR_ok on success, otherwise an error code as defined in public_errors.h.

[Important]Important

Destroying invalidates the handler ID, so it must not be used anymore afterwards. Also do not destroy a server connection handler ID from within a callback.

diff --git a/docs/client_html/ar01s09.html b/docs/client_html/ar01s09.html new file mode 100644 index 0000000..d673087 --- /dev/null +++ b/docs/client_html/ar01s09.html @@ -0,0 +1,62 @@ +Connecting to a server

Connecting to a server

To connect to a server, a client application is required to request an identity from the Client Lib. This string should be requested only once and then locally stored in the applications configuration. The next time the application connects to a server, the identity should be read from the configuration and reused again. +

unsigned int ts3client_createIdentity(result); 
char** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. If an error occured, the result string is uninitialized and must not be accessed.

[Caution]Caution

The result string must be released using ts3client_freeMemory. If an error has occured, the result string is uninitialized and must not be released.


+

Once a server connection handler has been spawned and an identity is available, connect to a TeamSpeak 3 server with +

unsigned int ts3client_startConnection(serverConnectionHandlerID,  
 identity,  
 ip,  
 port,  
 nickname,  
 defaultChannelArray,  
 defaultChannelPassword,  
 serverPassword); 
uint64 serverConnectionHandlerID;
const char* identity;
const char* ip;
unsigned int port;
const char* nickname;
const char** defaultChannelArray;
const char* defaultChannelPassword;
const char* serverPassword;
 

+

All strings need to be encoded in UTF-8 format.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. When trying to connect with an invalid identity, the Client Lib will set the error ERROR_client_could_not_validate_identity.


+

There is an alternative convinience function to start the connection which takes a channelID as parameter for the default channel instead of a channel name string array. +

unsigned int ts3client_startConnectionWithChannelID(serverConnectionHandlerID,  
 identity,  
 ip,  
 port,  
 nickname,  
 defaultChannelId,  
 defaultChannelPassword,  
 serverPassword); 
uint64 serverConnectionHandlerID;
const char* identity;
const char* ip;
unsigned int port;
const char* nickname;
uint64 defaultChannelId;
const char* defaultChannelPassword;
const char* serverPassword;
 

+


+  

Example code to request a connection to a TeamSpeak 3 server:

unsigned int error;
+uint64 scHandlerID;
+char* identity;
+
+error = ts3client_spawnNewServerConnectionHandler(&scHandlerID);
+if(error != ERROR_ok) {
+    printf("Error spawning server conection handler: %d\n", error);
+    return;
+}
+
+error = ts3client_createIdentity(&identity);  /* Application should store and reuse the identity */
+if(error != ERROR_ok) {
+    printf("Error creating identity: %d\n", error);
+    return;
+}
+
+error = ts3client_startConnection(scHandlerID,
+                                  identity
+                                  "my-teamspeak-server.com",
+				  9987,
+				  "Gandalf",
+				  NULL,      // Join servers default channel
+				  "",        // Empty default channel password
+				  "secret"); // Server password
+if(error != ERROR_ok) {
+    (...)
+}			  
+ts3client_freeMemory(identity);  /* Don't need this anymore */


+

After calling ts3client_startConnection, the client will be informed of the connection status changes by the callback

void onConnectStatusChangeEvent(serverConnectionHandlerID,  
 newStatus,  
 errorNumber); 
uint64 serverConnectionHandlerID;
int newStatus;
int errorNumber;
 

+ While connecting, the states will switch through the values STATUS_CONNECTING, STATUS_CONNECTED and STATUS_CONNECTION_ESTABLISHED. Once the state STATUS_CONNECTED has been reached, there the server welcome message is available, which can be queried by the client:


+

To check if a connection to a given server connection handler is established, call: +

unsigned int ts3client_getConnectionStatus(serverConnectionHandlerID,  
 result); 
uint64 serverConnectionHandlerID;
int* result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

After the state STATUS_CONNECTED has been reached, the client is assigned an ID which identifies the client on this server. This ID can be queried with +

unsigned int ts3client_getClientID(serverConnectionHandlerID,  
 result); 
uint64 serverConnectionHandlerID;
anyID* result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

After connection has been established, all current channels on the server are announced to the client. This happens with delays to avoid a flood of information after connecting. The client is informed about the existance of each channel with the following event:

void onNewChannelEvent(serverConnectionHandlerID,  
 channelID,  
 channelParentID); 
uint64 serverConnectionHandlerID;
uint64 channelID;
uint64 channelParentID;
 

Channel IDs start with the value 1.

The order in which channels are announced by onNewChannelEvent is defined by the channel order as explained in the chapter Channel sorting.

All clients currently logged to the server are announced after connecting with the callback onClientMoveEvent.

diff --git a/docs/client_html/ar01s10.html b/docs/client_html/ar01s10.html new file mode 100644 index 0000000..4872f2d --- /dev/null +++ b/docs/client_html/ar01s10.html @@ -0,0 +1,5 @@ +Disconnecting from a server

Disconnecting from a server

To disconnect from a TeamSpeak 3 server call +

unsigned int ts3client_stopConnection(serverConnectionHandlerID,  
 quitMessage); 
uint64 serverConnectionHandlerID;
const char* quitMessage;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

Like with connecting, on successful disconnecting the client will receive an event:


+

void onConnectStatusChangeEvent(serverConnectionHandlerID,  
 newStatus,  
 errorNumber); 
uint64 serverConnectionHandlerID;
int newStatus;
int errorNumber;
 


+

Should the server be shutdown, the follow event will be called:

void onServerStopEvent(serverConnectionHandlerID,  
 shutdownMessage); 
uint64 serverConnectionHandlerID;
const char* shutdownMessage;
 
diff --git a/docs/client_html/ar01s11.html b/docs/client_html/ar01s11.html new file mode 100644 index 0000000..be5e4a8 --- /dev/null +++ b/docs/client_html/ar01s11.html @@ -0,0 +1,27 @@ +Error handling

Error handling

Each Client Lib function returns either ERROR_ok on success or an error value as defined in public_errors.h if the function fails.

The returned error codes are organized in groups, where the first byte defines the error group and the second the count within the group: The naming convention is ERROR_<group>_<error>, for example ERROR_client_invalid_id.

Example:

unsigned int error;
+char* welcomeMsg;
+
+error = ts3client_getServerVariableAsString(serverConnectionHandlerID,
+                                            VIRTUALSERVER_WELCOMEMESSAGE,
+                                            &welcomeMsg);
+if(error == ERROR_ok) {
+    /* Use welcomeMsg... */
+    ts3client_freeMemory(welcomeMsg);  /* Release memory *only* if function did not return an error */
+} else {
+    /* Handle error */
+    /* Do not access or release welcomeMessage, the variable is undefined */
+}
[Important]Important

Client Lib functions returning C-strings or arrays dynamically allocate memory which has to be freed by the caller using ts3client_freeMemory. It is important to only access and release the memory if the function returned ERROR_ok. Should the function return an error, the result variable is uninitialized, so freeing or accessing it could crash the application.

See the section Calling Client Lib functions for additional notes and examples.


+

A printable error string for a specific error code can be queried with +

unsigned int ts3client_getErrorMessage(errorCode,  
 error); 
unsigned int errorCode;
char** error;
 

+

Example:

unsigned int error;
+anyID myID;
+
+error = ts3client_getClientID(scHandlerID, &myID);  /* Calling some Client Lib function */
+if(error != ERROR_ok) {
+    char* errorMsg;
+    if(ts3client_getErrorMessage(error, &errorMsg) == ERROR_ok) {  /* Query printable error */
+        printf("Error querying client ID: %s\n", errorMsg);
+        ts3client_freeMemory(errorMsg);  /* Release memory */
+    }
+}


+

In addition to actively querying errors like above, error codes can be sent by the server to the client. In that case the following event is called:

void onServerErrorEvent(serverConnectionHandlerID,  
 errorMessage,  
 error,  
 returnCode,  
 extraMessage); 
uint64 serverConnectionHandlerID;
const char* errorMessage;
unsigned int error;
const char* returnCode;
const char* extraMessage;
 
diff --git a/docs/client_html/ar01s12.html b/docs/client_html/ar01s12.html new file mode 100644 index 0000000..b9229c9 --- /dev/null +++ b/docs/client_html/ar01s12.html @@ -0,0 +1,14 @@ +Logging

Logging

The TeamSpeak 3 Client Lib offers basic logging functions: + +

unsigned int ts3client_logMessage(logMessage,  
 severity,  
 channel,  
 logID); 
const char* logMessage;
LogLevel severity;
const char* channel;
uint64 logID;
 

+

All strings need to be encoded in UTF-8 format.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

Log messages can be printed to stdout, logged to a file logs/ts3client_[date]__[time].log and sent to user-defined callbacks. The log output behaviour is defined when initialzing the client library with ts3client_initClientLib.

Unless user-defined logging is used, program execution will halt on a log message with severity LogLevel_CRITICAL.

User-defined logging

If user-defined logging was enabled when initialzing the Client Lib by passing LogType_USERLOGGING to the usedLogTypes parameter of ts3client_initClientLib, log messages will be sent to the following callback, which allows user customizable logging and handling or critical errors:

void onUserLoggingMessageEvent(logMessage,  
 logLevel,  
 logChannel,  
 logID,  
 logTime,  
 completeLogString); 
const char* logMessage;
int logLevel;
const char* logChannel;
uint64 logID;
const char* logTime;
const char* completeLogString;
 

Most callback parameters reflect the arguments passed to the logMessage function.

  • logMessage

    Actual log message text.

  • logLevel

    Severity of log message, defined by the enum LogLevel. Note that only log messages of a level higher than the one configured with ts3client_setLogVerbosity will appear.

  • logChannel

    Optional custom text to categorize the message channel.

  • logID

    Server connection handler ID identifying the current server connection when using multiple connections.

  • logTime

    String with date and time when the log message occured.

  • completeLogString

    Provides a verbose log message including all previous parameters for convinience.


+

The severity of log messages that are passed to above callback can be configured with: +

unsigned int ts3client_setLogVerbosity(logVerbosity); 
enum LogLevel logVerbosity;
 

+

  • logVerbosity

    Only messages with a log level equal or higher than logVerbosity will be sent to the callback. The default value is LogLevel_DEVEL.

    For example, after calling

    ts3client_setLogVerbosity(LogLevel_ERROR);

    only log messages of level LogLevel_ERROR and LogLevel_CRITICAL will be passed to onUserLoggingMessageEvent.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

diff --git a/docs/client_html/ar01s13.html b/docs/client_html/ar01s13.html new file mode 100644 index 0000000..153a644 --- /dev/null +++ b/docs/client_html/ar01s13.html @@ -0,0 +1,9 @@ +Using playback and capture modes and devices

Using playback and capture modes and devices

The Client Lib takes care of initializing, using and releasing sound playback and capture devices. Accessing devices is handled by the sound backend shared libraries, found in the soundbackends directory in the SDK. There are different backends available on the supported operating systems: DirectSound and Windows Audio Session API on Windows, Alsa and PulseAudio on Linux, CoreAudio on Mac OS X.

All strings passed to and from the Client Lib have to be encoded in UTF-8 format.

Initializing modes and devices

To initialize a playback and capture device for a TeamSpeak 3 server connection handler, call +

unsigned int ts3client_openPlaybackDevice(serverConnectionHandlerID,  
 modeID,  
 playbackDevice); 
uint64 serverConnectionHandlerID;
const char* modeID;
const char* playbackDevice;
 

+

  • serverConnectionHandlerID

    Connection handler of the server on which you want to initialize the playback device.

  • modeID

    The playback mode to use. Valid modes are returned by ts3client_getDefaultPlayBackMode and ts3client_getPlaybackModeList.

    Passing an empty string will use the default playback mode.

  • playbackDevice

    Valid parameters are: +

    + The string needs to be encoded in UTF-8 format. +

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. A likely error is ERROR_sound_could_not_open_playback_device if the sound backend fails to find a usable playback device.


+

unsigned int ts3client_openCaptureDevice(serverConnectionHandlerID,  
 modeID,  
 captureDevice); 
uint64 serverConnectionHandlerID;
const char* modeID;
const char* captureDevice;
 
  • serverConnectionHandlerID

    Connection handler of the server on which you want to initialize the capture device.

  • modeID

    The capture mode to use. Valid modes are returned by ts3client_getDefaultCaptureMode and ts3client_getCaptureModeList.

    Passing an empty string will use the default capture mode.

  • captureDevice

    Valid parameters are: +

    +

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. Likely errors are ERROR_sound_could_not_open_capture_device if the device fails to open or ERROR_sound_handler_has_device if the device is already opened. To avoid this problem, it is recommended to close the capture device before opening it again.

diff --git a/docs/client_html/ar01s13s02.html b/docs/client_html/ar01s13s02.html new file mode 100644 index 0000000..7d4f4fb --- /dev/null +++ b/docs/client_html/ar01s13s02.html @@ -0,0 +1,69 @@ +Querying available modes and devices

Querying available modes and devices

Various playback and capture modes are available: DirectSound on all Windows platforms, Windows Audio Session API for Windows Vista and Windows 7; Alsa and PulseAudio on Linux; CoreAudio on Mac OS X.

Available device names may differ depending on the current mode.

The default playback and capture modes can be queried with: +

unsigned int ts3client_getDefaultPlayBackMode(result); 
char** result;
 

+ +

unsigned int ts3client_getDefaultCaptureMode(result); 
char** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

All available playback and capture modes can be queried with: +

unsigned int ts3client_getPlaybackModeList(result); 
char*** result;
 

+ +

unsigned int ts3client_getCaptureModeList(result); 
char*** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. In case of an error, the result array is uninitialized and must not be accessed or released.

Example to query all available playback modes:

char** array;
+
+if(ts3client_getPlaybackModeList(&array) == ERROR_ok) {
+    for(int i=0; array[i] != NULL; ++i) {
+        printf("Mode: %s\n", array[i]);
+        ts3client_freeMemory(array[i]);  // Free C-string
+    }
+    ts3client_freeMemory(array);  // Free the array
+}


+

Playback and capture devices available for the given mode can be listed, as well as the current operating systems default. The returned device values can be used to initialize the devices.

To query the default playback and capture device, call +

unsigned int ts3client_getDefaultPlaybackDevice(modeID,  
 result); 
const char* modeID;
char*** result;
 

+ +

unsigned int ts3client_getDefaultCaptureDevice(modeID,  
 result); 
const char* modeID;
char*** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. In case of an error, the result array is uninitialized and must not be released.

Example to query the default playback device:

char* defaultMode;
+
+/* Get default playback mode */
+if(ts3client_getDefaultPlayBackMode(&defaultMode) == ERROR_ok) {
+    char** defaultPlaybackDevice;
+
+    /* Get default playback device */
+    if(ts3client_getDefaultPlaybackDevice(defaultMode, &defaultPlaybackDevice) == ERROR_ok) {
+        printf("Default playback device name: %s\n", defaultPlaybackDevice[0]);  /* First element: Device name */
+        printf("Default playback device ID: %s\n",   defaultPlaybackDevice[1]);  /* Second element: Device ID */
+
+        /* Release the two array elements and the array */
+        ts3client_freeMemory(defaultPlaybackDevice[0]);
+        ts3client_freeMemory(defaultPlaybackDevice[1]);
+        ts3client_freeMemory(defaultPlaybackDevice);
+    } else {
+        printf("Failed to get default playback device\n");
+    }
+} else {
+    printf("Failed to get default playback mode\n");
+}


+

To get a list of all available playback and capture devices for the specified mode, call +

unsigned int ts3client_getPlaybackDeviceList(modeID,  
 result); 
const char* modeID;
char**** result;
 

+ +

unsigned int ts3client_getCaptureDeviceList(modeID,  
 result); 
const char* modeID;
char**** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. In case of an error, the result array is uninitialized and must not be released.

Example to query all available playback devices:

char* defaultMode;
+
+if(ts3client_getDefaultPlayBackMode(&defaultMode) == ERROR_ok) {
+    char*** array;
+
+    if(ts3client_getPlaybackDeviceList(defaultMode, &array) == ERROR_ok) {
+        for(int i=0; array[i] != NULL; ++i) {
+            printf("Playback device name: %s\n", array[i][0]);  /* First element: Device name */
+            printf("Playback device ID: %s\n",   array[i][1]);  /* Second element: Device ID */
+
+            /* Free element */
+            ts3client_freeMemory(array[i][0]);
+            ts3client_freeMemory(array[i][1]);
+            ts3client_freeMemory(array[i]);
+        }
+        ts3client_freeMemory(array);  /* Free complete array */
+    } else {
+        printf("Error getting playback device list\n");
+    }
+} else {
+    printf("Error getting default playback mode\n");
+}
diff --git a/docs/client_html/ar01s13s03.html b/docs/client_html/ar01s13s03.html new file mode 100644 index 0000000..f1333ac --- /dev/null +++ b/docs/client_html/ar01s13s03.html @@ -0,0 +1,10 @@ +Checking current modes and devices

Checking current modes and devices

The currently used playback and capture modes for a given server connection handler can be checked with: +

unsigned int ts3client_getCurrentPlayBackMode(serverConnectionHandlerID,  
 result); 
uint64 serverConnectionHandlerID;
char** result;
 

+ +

unsigned int ts3client_getCurrentCaptureMode(serverConnectionHandlerID,  
 result); 
uint64 serverConnectionHandlerID;
char** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

Check the currently used playback and capture devices for a given server connection handler with: +

unsigned int ts3client_getCurrentPlaybackDeviceName(serverConnectionHandlerID,  
 result,  
 isDefault); 
uint64 serverConnectionHandlerID;
char** result;
int* isDefault;
 

+ +

unsigned int ts3client_getCurrentCaptureDeviceName(serverConnectionHandlerID,  
 result,  
 isDefault); 
uint64 serverConnectionHandlerID;
char** result;
int* isDefault;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. If an error has occured, the result string is uninitialized and must not be released.

diff --git a/docs/client_html/ar01s13s04.html b/docs/client_html/ar01s13s04.html new file mode 100644 index 0000000..9f895c9 --- /dev/null +++ b/docs/client_html/ar01s13s04.html @@ -0,0 +1,23 @@ +Closing devices

Closing devices

To close the capture and playback devices for a given server connection handler: +

unsigned int ts3client_closeCaptureDevice(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

+ +

unsigned int ts3client_closePlaybackDevice(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

ts3client_closePlaybackDevice will not block until all current sounds have finished playing but will shutdown the device immediately, possibly interrupting the still playing sounds. To shutdown the playback device more gracefully, use the following function: +

unsigned int ts3client_initiateGracefulPlaybackShutdown(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

While ts3client_initiateGracefulPlaybackShutdown will not block until all sounds have finished playing, too, it will notify the client when the playback device can be safely closed by sending the callback: +

void onPlaybackShutdownCompleteEvent(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

+

Example code to gracefully shutdown the playback devicef:

/* Instead of calling ts3client_closePlaybackDevice() directly */
+if(ts3client_initiateGracefulPlaybackShutdown(currentScHandlerID) != ERROR_ok) {
+    printf("Failed to initiate graceful playback shutdown\n");
+    return;
+}
+
+/* Event notifying the playback device has been shutdown */
+void my_onPlaybackShutdownCompleteEvent(uint64 scHandlerID) {
+    /* Now we can safely close the device */
+    if(ts3client_closePlaybackDevice(scHandlerID) != ERROR_ok) {
+        printf("Error closing playback device\n");
+    }
+}
[Note]Note

Devices are closed automatically when calling ts3client_destroyServerConnectionHandler.

[Note]Note

To change a device, close it first and then reopen it.

diff --git a/docs/client_html/ar01s13s05.html b/docs/client_html/ar01s13s05.html new file mode 100644 index 0000000..b3755a4 --- /dev/null +++ b/docs/client_html/ar01s13s05.html @@ -0,0 +1,44 @@ +Using custom devices

Using custom devices

Instead of opening existing sound devices that TeamSpeak has detected, you can also use our custom capture and playback mechanism to allow you to override the way in which TeamSpeak does capture and playback. When you have opened a custom capture and playback device you must regularly supply new "captured" sound data via the ts3client_processCustomCaptureData function and retrieve data that should be "played back" via ts3client_acquireCustomPlaybackData. Where exactly this captured sound data comes from and where the playback data goes to is up to you, which allows a lot of cool things to be done with this mechanism.

Implementing own custom devices is for special use cases and entirely optional.

Registering a custom device announces the device ID and name to the Client Lib. Once a custom device has been registered under a device ID, the device can be opened like any standard device with ts3client_openCaptureDevice and ts3client_openPlaybackDevice.

void ts3client_registerCustomDevice(deviceID,  
 deviceDisplayName,  
 capFrequency,  
 capChannels,  
 playFrequency,  
 playChannels); 
const char* deviceID;
const char* deviceDisplayName;
int capFrequency;
int capChannels;
int playFrequency;
int playChannels;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

Unregistering a custom device will automatically close the device:

void ts3client_unregisterCustomDevice(deviceID); 
const char* deviceID;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

To send the captured data from your device to the Client Lib:

void ts3client_processCustomCaptureData(deviceID,  
 buffer,  
 samples); 
const char* deviceID;
const short* buffer;
int samples;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

Retrieve playback data from the Client Lib:

void ts3client_acquireCustomPlaybackData(deviceID,  
 buffer,  
 samples); 
const char* deviceID;
const short* buffer;
int samples;
 

Returns ERROR_ok if playback data is available or ERROR_sound_no_data if the Client Lib currently has no playback data.

The return value ERROR_sound_no_data can be used for performance optimisation, it means there is currently only silence (nobody is talking, no wave files being played etc.) and instead of returning a buffer full of zeroes it just notifies the user there is currently no data, which allows you to not playback any sound data for that moment, if your API supports that (potentially saving some CPU), or to just fill the sound buffer with zeroes and playback this if your sound API demands you to fill it with something for every given time.


+

Overview on registering and opening a custom device:

/* Register a new custom sound device with specified frequency and number of channels */
+if(ts3client_registerCustomDevice("customWaveDeviceId", "Nice displayable wave device name", captureFrequency, captureChannels, playbackFrequncy, playbackChannels) != ERROR_ok) {
+    printf("Failed to register custom device\n");
+}
+
+/* Open capture device we created earlier */
+if(ts3client_openCaptureDevice(scHandlerID, "custom", "customWaveDeviceId") != ERROR_ok) {
+    printf("Error opening capture device\n");
+}
+
+/* Open playback device we created earlier */
+if(ts3client_openPlaybackDevice(scHandlerID, "custom", "customWaveDeviceId") != ERROR_ok) {
+    printf("Error opening playback device\n");
+}
+
+/* Main loop */
+while(!abort) {
+    /* Fill captureBuffer from your custom device */
+
+    /* Stream your capture data to the client lib */
+	if(ts3client_processCustomCaptureData("customWaveDeviceId", captureBuffer, captureBufferSize) != ERROR_ok) {
+        printf("Failed to process capture data\n");
+    }
+
+    /* Get playback data from the client lib */
+    error = ts3client_acquireCustomPlaybackData("customWaveDeviceId", playbackBuffer, playbackBufferSize);
+    if(error == ERROR_ok) {
+        /* Playback data available, send playbackBuffer to your custom device */
+    } else if(error == ERROR_sound_no_data) {
+        /* Not an error. The client lib has no playback data available. Depending on your custom sound API, either
+           pause playback for performance optimisation or send a buffer of zeros. */
+    } else {
+        printf("Failed to get playback data\n");  /* Error occured */
+    }
+}
+
+/* Unregister the custom device. This automatically close the device. */
+if(ts3client_unregisterCustomDevice("customaveDeviceId") != ERROR_ok) {
+    printf("Failed to unregister custom device\n");
+}
[Note]Note

Further sample code on how to use a custom device can be found in the “client_customdevice” example included in the SDK.

diff --git a/docs/client_html/ar01s13s06.html b/docs/client_html/ar01s13s06.html new file mode 100644 index 0000000..2f79def --- /dev/null +++ b/docs/client_html/ar01s13s06.html @@ -0,0 +1 @@ +Activating the capture device

Activating the capture device

[Note]Note

Using this function is only required when connecting to multiple servers.

When connecting to multiple servers with the same client, the capture device can only be active for one server at the same time. As soon as the client connects to a new server, the Client Lib will deactivate the capture device of the previously active server. When a user wants to talk to that previous server again, the client needs to reactivate the capture device.

unsigned int ts3client_activateCaptureDevice(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

If the capture device is already active, this function has no effect.

Opening a new capture device will automatically activate it, so calling this function is only necessary with multiple server connections and when reactivating a previously deactivated device.

If the capture device for a given server connection handler has been deactivated by the Client Lib, the flag CLIENT_INPUT_HARDWARE will be set. This can be queried with the function ts3client_getClientSelfVariableAsInt.

diff --git a/docs/client_html/ar01s14.html b/docs/client_html/ar01s14.html new file mode 100644 index 0000000..54c0f07 --- /dev/null +++ b/docs/client_html/ar01s14.html @@ -0,0 +1,3 @@ +Sound codecs

Sound codecs

TeamSpeak 3 supports the following sound sampling rates:

[Note]Note

Opus Voice is recommended for voice transmission. Speex and Celt codecs may be removed in future versions of this SDK.


+

Bandwidth usage generally depends on the used codec and the encoders quality setting.

Estimated bitrates (bps) for codecs per quality:

QualityNarrowbandWidebandUltra-WidebandCeltOpus VoiceOpus Music
02,1503,9504,15032,0004,0967,200
13,9505,7507,55032,0008,19214,400
25,9507,7509,55040,00012,28821,600
38,0009,80011,60040,00016,38428,800
48,00012,80014,60040,00020,48036,000
511,00016,80018,60048,00024,57643,200
611,00020,60022,40048,00028,67250,400
715,00023,80025,60048,00032,76857,600
815,00027,80029,60048,00036,86464,800
918,20034,40036,20064,00040,96072,000
1024,60042,40044,20096,00045,05679,200

Change the quality to find a good middle between voice quality and bandwidth usage. Overall the Opus codec delivers the best quality per used bandwidth.

Users need to use the same codec when talking to each others. The smallest unit of participants using the same codec is a channel. Different channels on the same TeamSpeak 3 server can use different codecs. The channel codec should be customizable by the users to allow for flexibility concerning bandwidth vs. quality concerns.

The codec can be set or changed for a given channel using the function ts3client_setChannelVariableAsInt by passing CHANNEL_CODEC for the properties flag:

ts3client_setChannelVariableAsInt(scHandlerID, channelID, CHANNEL_CODEC, codec);

Available values for CHANNEL_CODEC are: +

For details on using the function ts3client_setChannelVariableAsInt see the appropriate section on changing channel data.

diff --git a/docs/client_html/ar01s15.html b/docs/client_html/ar01s15.html new file mode 100644 index 0000000..d301d47 --- /dev/null +++ b/docs/client_html/ar01s15.html @@ -0,0 +1,13 @@ +Encoder options

Encoder options

Speech quality and bandwidth usage depend on the used Speex encoder. As Speex is a lossy code, the quality value controls the balance between voice quality and network traffic. Valid quality values range from 0 to 10, default is 7. The encoding quality can be configured for each channel using the CHANNEL_CODEC_QUALITY property. The currently used channel codec, codec quality and estimated average used bitrate (without overhead) can be queried with ts3client_getEncodeConfigValue.

[Note]Note

Encoder options are tied to a capture device, so querying the values only makes sense after a device has been opened.

All strings passed from the Client Lib are encoded in UTF-8 format.

unsigned int ts3client_getEncodeConfigValue(serverConnectionHandlerID,  
 ident,  
 result); 
uint64 serverConnectionHandlerID;
const char* ident;
char** result;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. If an error has occured, the result string is uninitialized and must not be released.

To adjust the channel codec quality to a value of 5, you would call: +

ts3client_setChannelVariableAsInt(scHandlerID, channelID, CHANNEL_CODEC_QUALITY, 5);

See the chapter about channel information for details about how to set channel variables.

To query information about the current channel quality, do: +

char *name, *quality, *bitrate;
+ts3client_getEncodeConfigValue(scHandlerID, "name", &name);
+ts3client_getEncodeConfigValue(scHandlerID, "quality", &quality);
+ts3client_getEncodeConfigValue(scHandlerID, "bitrate", &bitrate);
+
+printf("Name = %s, quality = %s, bitrate = %s\n", name, quality, bitrate);
+
+ts3client_freeMemory(name);
+ts3client_freeMemory(quality);
+ts3client_freeMemory(bitrate);

+

diff --git a/docs/client_html/ar01s16.html b/docs/client_html/ar01s16.html new file mode 100644 index 0000000..299b2a9 --- /dev/null +++ b/docs/client_html/ar01s16.html @@ -0,0 +1,9 @@ +Preprocessor options

Preprocessor options

Sound input is preprocessed by the Client Lib before the data is encoded and sent to the TeamSpeak 3 server. The preprocessor is responsible for noise suppression, automatic gain control (AGC) and voice activity detection (VAD).

The preprocessor can be controlled by setting various preprocessor flags. These flags are unique to each server connection.

[Note]Note

Preprocessor flags are tied to a capture device, so changing the values only makes sense after a device has been opened.

Preprocessor flags can be queried using +

unsigned int ts3client_getPreProcessorConfigValue(serverConnectionHandlerID,  
 ident,  
 result); 
uint64 serverConnectionHandlerID;
const char* ident;
char** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. If an error has occured, the result string is uninitialized and must not be released.


+

To configure the proprocessor use +

unsigned int ts3client_setPreProcessorConfigValue(serverConnectionHandlerID,  
 ident,  
 value); 
uint64 serverConnectionHandlerID;
const char* ident;
const char* value;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

[Note]Note

It is not necessary to change all those values. The default values are reasonable. “voiceactivation_level” is often the only value that needs to be adjusted.


+

The following function retrieves preprocessor information as a floating-point variable instead of a string: +

unsigned int ts3client_getPreProcessorInfoValueFloat(serverConnectionHandlerID,  
 ident,  
 result); 
uint64 serverConnectionHandlerID;
const char* ident;
float* result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

diff --git a/docs/client_html/ar01s17.html b/docs/client_html/ar01s17.html new file mode 100644 index 0000000..d1b39a3 --- /dev/null +++ b/docs/client_html/ar01s17.html @@ -0,0 +1,32 @@ +Playback options

Playback options

Sound output can be configured using playback options. Currently the output value can be adjusted.

Playback options can be queried: +

unsigned int ts3client_getPlaybackConfigValueAsFloat(serverConnectionHandlerID,  
 ident,  
 result); 
uint64 serverConnectionHandlerID;
const char* ident;
float* result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

To change playback options, call: +

unsigned int ts3client_setPlaybackConfigValue(serverConnectionHandlerID,  
 ident,  
 value); 
uint64 serverConnectionHandlerID;
const char* ident;
const char* value;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

[Note]Note

Playback options are tied to a playback device, so changing the values only makes sense after a device has been opened.

Example code:

unsigned int error;
+float value;
+
+if((error = ts3client_setPlaybackConfigValue(scHandlerID, "volume_modifier", "5.5")) != ERROR_ok) {
+    printf("Error setting playback config value: %d\n", error);
+    return;
+}
+
+if((error = ts3client_getPlaybackConfigValueAsFloat(scHandlerID, "volume_modifier", &value)) != ERROR_ok) {
+    printf("Error getting playback config value: %d\n", error);
+    return;
+}
+
+printf("Volume modifier playback option: %f\n", value);


+

In addition to changing the global voice volume modifier of all speakers by changing the “volume_modifier” parameter, voice volume of individual clients can be adjusted with: +

unsigned int ts3client_setClientVolumeModifier(serverConnectionHandlerID,  
 clientID,  
 value); 
uint64 serverConnectionHandlerID;
anyID clientID;
float value;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

When calculating the volume for individual clients, both the global and client volume modifiers will be taken into account.

Client volume modifiers are valid as long as the specified client is visible. Once the client leaves visibility by joining an unsubscribed channel or disconnecting from the server, the client volume modifier will be lost. When the client enters visibility again, the modifier has to be set again by calling this function.

Example:

+unsigned int error;
+anyID clientID = 123;
+float value = 10.0f;
+
+if((error = ts3client_setClientVolumeModifier(scHandlerID, clientID, value)) != ERROR_ok) {
+    printf("Error setting client volume modifier: %d\n", error);
+	return;
+}
+
diff --git a/docs/client_html/ar01s18.html b/docs/client_html/ar01s18.html new file mode 100644 index 0000000..d08c01d --- /dev/null +++ b/docs/client_html/ar01s18.html @@ -0,0 +1,19 @@ +Accessing the voice buffer

Accessing the voice buffer

The TeamSpeak Client Lib allows users to access the raw playback and capture voice data and even modify it, for example to add effects to the voice. These callbacks are also used by the TeamSpeak client for the voice recording feature.

Using these low-level callbacks is not required and should be reserved for specific needs. Most SDK applications won't need to implement these callbacks.


+

The following event is called when a voice packet from a client (not own client) is decoded and about to be played over your sound device, but before it is 3D positioned and mixed with other sounds. You can use this function to alter the voice data (for example when you want to do effects on it) or to simply get voice data. The TeamSpeak client uses this function to record sessions.

void onEditPlaybackVoiceDataEvent(serverConnectionHandlerID,  
 clientID,  
 samples,  
 sampleCount,  
 channels); 
uint64 serverConnectionHandlerID;
anyID clientID;
short* samples;
int sampleCount;
int channels;
 


+

The following event is called when a voice packet from a client (not own client) is decoded and 3D positioned and about to be played over your sound device, but before it is mixed with other sounds. You can use this function to alter/get the voice data after 3D positioning.

void onEditPostProcessVoiceDataEvent(serverConnectionHandlerID,  
 clientID,  
 samples,  
 sampleCount,  
 channels,  
 channelSpeakerArray,  
 channelFillMask); 
uint64 serverConnectionHandlerID;
anyID clientID;
short* samples;
int sampleCount;
int channels;
const unsigned int* channelSpeakerArray;
unsigned int* channelFillMask;
 

For example, this callback reports:

channels = 6
+channelSpeakerArray[0] = SPEAKER_FRONT_CENTER
+channelSpeakerArray[1] = SPEAKER_LOW_FREQUENCY
+channelSpeakerArray[2] = SPEAKER_BACK_LEFT
+channelSpeakerArray[3] = SPEAKER_BACK_RIGHT
+channelSpeakerArray[4] = SPEAKER_SIDE_LEFT
+channelSpeakerArray[5] = SPEAKER_SIDE_RIGHT  // Quite unusual setup
+*channelFillMask = 1

This means "samples" points to 6 channel data, but only the SPEAKER_FRONT_CENTER channel has data, the other channels are undefined (not necessarily 0, but undefined).

So for the first sample, samples[0] has data and samples[1], samples[2], samples[3], samples[4] and samples[5] are undefined.

If you want to add SPEAKER_BACK_RIGHT channel data you would do something like:

*channelFillMask |= 1<<3;  // SPEAKER_BACK_RIGHT is the 4th channel (is index 3) according to *channelSpeakerArray.
+for(int i=0; i<sampleCount; ++i){
+    samples[3 + (i*channels) ] = getChannelSoundData(SPEAKER_BACK_RIGHT, i); 
+}


+

The following event is called when all sounds that are about to be played back for this server connection are mixed. This is the last chance to alter/get sound.

You can use this function to alter/get the sound data before playback.

void onEditMixedPlaybackVoiceDataEvent(serverConnectionHandlerID,  
 samples,  
 sampleCount,  
 channels,  
 channelSpeakerArray,  
 channelFillMask); 
uint64 serverConnectionHandlerID;
short* samples;
int sampleCount;
int channels;
const unsigned int* channelSpeakerArray;
unsigned int* channelFillMask;
 


+

The following event is called after sound is recorded from the sound device and is preprocessed. This event can be used to get/alter recorded sound. Also it can be determined if this sound will be send, or muted. This is used by the TeamSpeak client to record sessions.

If the sound data will be send, (*edited | 2) is true. If the sound data is changed, set bit 1 (*edited |=1). If the sound should not be send, clear bit 2. (*edited &= ~2)

void onEditCapturedVoiceDataEvent(serverConnectionHandlerID,  
 samples,  
 sampleCount,  
 channels,  
 edited); 
uint64 serverConnectionHandlerID;
short* samples;
int sampleCount;
int channels;
int* edited;
 

Voice recording

When using the above callbacks to record voice, you should notify the server when recording starts or stops with the following functions:

unsigned int ts3client_startVoiceRecording(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 
unsigned int ts3client_stopVoiceRecording(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 
  • serverConnectionHandlerID

    ID of the server connection handler on which voice recording should be started or stopped.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

diff --git a/docs/client_html/ar01s19.html b/docs/client_html/ar01s19.html new file mode 100644 index 0000000..494d725 --- /dev/null +++ b/docs/client_html/ar01s19.html @@ -0,0 +1,13 @@ +Playing wave files

Playing wave files

The TeamSpeak Client Lib offers support to play wave files from the local harddisk.

To play a local wave file, call +

unsigned int ts3client_playWaveFile(serverConnectionHandlerID,  
 path); 
anyID serverConnectionHandlerID;
const char* path;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

This is the simple version of playing a sound file. It's a fire-and-forget mechanism, this function will not block.


+

The more complex version is to play an optionally looping sound and obtain a handle, which can be used to pause, unpause and stop the loop. +

unsigned int ts3client_playWaveFileHandle(serverConnectionHandlerID,  
 path,  
 loop,  
 waveHandle); 
anyID serverConnectionHandlerID;
const char* path;
int loop;
uint64* waveHandle;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. If an error occured, waveHandle is uninitialized and must not be used.


+

Using the handle obtained by ts3client_playWaveFileHandle, sounds can be paused and unpaused with +

unsigned int ts3client_pauseWaveFileHandle(serverConnectionHandlerID,  
 waveHandle,  
 pause); 
anyID serverConnectionHandlerID;
uint64 waveHandle;
int pause;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

Using the handle obtained by ts3client_playWaveFileHandle, sounds can be closed with +

unsigned int ts3client_closeWaveFileHandle(serverConnectionHandlerID,  
 waveHandle); 
anyID serverConnectionHandlerID;
uint64 waveHandle;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

diff --git a/docs/client_html/ar01s20.html b/docs/client_html/ar01s20.html new file mode 100644 index 0000000..195c31e --- /dev/null +++ b/docs/client_html/ar01s20.html @@ -0,0 +1,16 @@ +3D Sound

3D Sound

TeamSpeak 3 supports 3D sound to assign each speaker a unique position in 3D space. Provided are functions to modify the 3D position, velocity and orientation of own and foreign clients.

Generally the struct TS3_VECTOR describes a vector in 3D space:

typedef struct {
+    float x;        /* X coordinate in 3D space. */
+    float y;        /* Y coordinate in 3D space. */
+    float z;        /* Z coordinate in 3D space. */
+} TS3_VECTOR;

To set the position, velocity and orientation of the own client in 3D space, call: +

unsigned int ts3client_systemset3DListenerAttributes(serverConnectionHandlerID,  
 position,  
 forward,  
 up); 
uint64 serverConnectionHandlerID;
const TS3_VECTOR* position;
const TS3_VECTOR* forward;
const TS3_VECTOR* up;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

To adjust 3D sound system settings use: +

unsigned int ts3client_systemset3DSettings(serverConnectionHandlerID,  
 distanceFactor,  
 rolloffScale); 
uint64 serverConnectionHandlerID;
float distanceFactor;
float rolloffScale;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

To adjust a clients position and velocity in 3D space, call: +

unsigned int ts3client_channelset3DAttributes(serverConnectionHandlerID,  
 clientID,  
 position); 
uint64 serverConnectionHandlerID;
anyID clientID;
const TS3_VECTOR* position;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

The following event is called to calculate volume attenuation for distance in 3D positioning of clients.

void onCustom3dRolloffCalculationClientEvent(serverConnectionHandlerID,  
 clientID,  
 distance,  
 volume); 
uint64 serverConnectionHandlerID;
anyID clientID;
float distance;
float* volume;
 


+

The following event is called to calculate volume attenuation for distance in 3D positioning of a wave file that was opened previously with ts3client_playWaveFileHandle.

void onCustom3dRolloffCalculationWaveEvent(serverConnectionHandlerID,  
 waveHandle,  
 distance,  
 volume); 
uint64 serverConnectionHandlerID;
uint64 waveHandle;
float distance;
float* volume;
 


+

This method is used to 3D position a wave file that was opened previously with ts3client_playWaveFileHandle.

unsigned int ts3client_set3DWaveAttributes(serverConnectionHandlerID,  
 waveHandle,  
 position); 
uint64 serverConnectionHandlerID;
uint64 waveHandle;
const TS3_VECTOR* position;
 

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

diff --git a/docs/client_html/ar01s21.html b/docs/client_html/ar01s21.html new file mode 100644 index 0000000..4d89ab6 --- /dev/null +++ b/docs/client_html/ar01s21.html @@ -0,0 +1,41 @@ +Query available servers, channels and clients

Query available servers, channels and clients

A client can connect to multiple servers. To list all currently existing server connection handlers, call: +

unsigned int ts3client_getServerConnectionHandlerList(result); 
uint64** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. If an error has occured, the result array is uninitialized and must not be released.


+

A list of all channels on the specified virtual server can be queried with: +

unsigned int ts3client_getChannelList(serverConnectionHandlerID,  
 result); 
uint64 serverConnectionHandlerID;
uint64** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. If an error has occured, the result array is uninitialized and must not be released.


+

To get a list of all currently visible clients on the specified virtual server: +

unsigned intts3client_getClientList(serverConnectionHandlerID,  
 result); 
uint64 serverConnectionHandlerID;
anyID** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. If an error has occured, the result array is uninitialized and must not be released.


+

To get a list of all clients in the specified channel if the channel is currently subscribed: +

unsigned int ts3client_getChannelClientList(serverConnectionHandlerID,  
 channelID,  
 result); 
uint64 serverConnectionHandlerID;
uint64 channelID;
anyID** result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. If an error has occured, the result array is uninitialized and must not be released.


+

To query the channel ID the specified client has currently joined: +

unsigned int ts3client_getChannelOfClient(serverConnectionHandlerID,  
 clientID,  
 result); 
uint64 serverConnectionHandlerID;
anyID clientID;
uint64* result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

To get the parent channel of a given channel: +

unsigned int ts3client_getParentChannelOfChannel(serverConnectionHandlerID,  
 channelID,  
 result); 
uint64 serverConnectionHandlerID;
uint64 channelID;
uint64* result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

Example code to print a list of all channels on a virtual server:

uint64* channels;
+
+if(ts3client_getChannelList(serverID, &channels) == ERROR_ok) {
+    for(int i=0; channels[i] != NULL; i++) {
+        printf("Channel ID: %u\n", channels[i]);
+    }
+    ts3client_freeMemory(channels);
+}

To print all visible clients:

anyID* clients;
+
+if(ts3client_getClientList(scHandlerID, &clients) == ERROR_ok) {
+    for(int i=0; clients[i] != NULL; i++) {
+        printf("Client ID: %u\n", clients[i]);
+    }
+    ts3client_freeMemory(clients);
+}

Example to print all clients who are member of channel with ID 123:

uint64 channelID = 123;  /* Channel ID in this example */
+anyID *clients;
+
+if(ts3client_getChannelClientList(scHandlerID, channelID) == ERROR_ok) {
+    for(int i=0; clients[i] != NULL; i++) {
+        printf("Client ID: %u\n", clients[i]);
+    }
+    ts3client_freeMemory(clients);
+}
diff --git a/docs/client_html/ar01s22.html b/docs/client_html/ar01s22.html new file mode 100644 index 0000000..ac7dcef --- /dev/null +++ b/docs/client_html/ar01s22.html @@ -0,0 +1,143 @@ +Retrieve and store information

Retrieve and store information

The Client Lib remembers a lot of information which have been passed through previously. The data is available to be queried by a client for convinience, so the interface code doesn't need to store the same information as well. The client can in many cases also modify the stored information for further processing by the server.

All strings passed to and from the Client Lib need to be encoded in UTF-8 format.

Client information

Information related to own client

Once connection to a TeamSpeak 3 server has been established, a unique client ID is assigned by the server. This ID can be queried with +

unsigned int ts3client_getClientID(serverConnectionHandlerID,  
 result); 
uint64 serverConnectionHandlerID;
anyID* result;
 

+

  • serverConnectionHandlerID

    ID of the server connection handler on which we are querying the own client ID.

  • result

    Address of a variable that receives the client ID. Client IDs start with the value 1.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

Various information related about the own client can be checked with:

+ +

unsigned int ts3client_getClientSelfVariableAsInt(serverConnectionHandlerID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
ClientProperties flag;
int* result;
 

+ +

+

unsigned int ts3client_getClientSelfVariableAsString(serverConnectionHandlerID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
ClientProperties flag;
char** result;
 

+ +

  • serverConnectionHandlerID

    ID of the server connection handler on which the information for the own client is requested.

  • flag

    Client propery to query, see below.

  • result

    Address of a variable which receives the result value as int or string, depending on which function is used. In case of a string, memory must be released using ts3client_freeMemory, unless an error occured.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. For the string version: If an error has occured, the result string is uninitialized and must not be released.

The parameter flag specifies the type of queried information. It is defined by the enum ClientProperties:

enum ClientProperties {
+  CLIENT_UNIQUE_IDENTIFIER = 0,   //automatically up-to-date for any client "in view", can be used
+                                  //to identify this particular client installation
+  CLIENT_NICKNAME,                //automatically up-to-date for any client "in view"
+  CLIENT_VERSION,                 //for other clients than ourself, this needs to be requested
+                                  //(=> requestClientVariables)
+  CLIENT_PLATFORM,                //for other clients than ourself, this needs to be requested
+                                  //(=> requestClientVariables)
+  CLIENT_FLAG_TALKING,            //automatically up-to-date for any client that can be heard
+                                  //(in room / whisper)
+  CLIENT_INPUT_MUTED,             //automatically up-to-date for any client "in view", this clients
+                                  //microphone mute status
+  CLIENT_OUTPUT_MUTED,            //automatically up-to-date for any client "in view", this clients
+                                  //headphones/speakers mute status
+  CLIENT_OUTPUTONLY_MUTED         //automatically up-to-date for any client "in view", this clients
+                                  //headphones/speakers only mute status
+  CLIENT_INPUT_HARDWARE,          //automatically up-to-date for any client "in view", this clients
+                                  //microphone hardware status (is the capture device opened?)
+  CLIENT_OUTPUT_HARDWARE,         //automatically up-to-date for any client "in view", this clients
+                                  //headphone/speakers hardware status (is the playback device opened?)
+  CLIENT_INPUT_DEACTIVATED,       //only usable for ourself, not propagated to the network
+  CLIENT_IDLE_TIME,               //internal use
+  CLIENT_DEFAULT_CHANNEL,         //only usable for ourself, the default channel we used to connect
+                                  //on our last connection attempt
+  CLIENT_DEFAULT_CHANNEL_PASSWORD,//internal use
+  CLIENT_SERVER_PASSWORD,         //internal use
+  CLIENT_META_DATA,               //automatically up-to-date for any client "in view", not used by
+                                  //TeamSpeak, free storage for sdk users
+  CLIENT_IS_MUTED,                //only make sense on the client side locally, "1" if this client is
+                                  //currently muted by us, "0" if he is not
+  CLIENT_IS_RECORDING,            //automatically up-to-date for any client "in view"
+  CLIENT_VOLUME_MODIFICATOR,      //internal use
+  CLIENT_VERSION_SIGN,			  //internal use
+  CLIENT_SECURITY_HASH,           //SDK only: Hash is provided by an outside source. A channel will
+                                  //use the security salt + other client data to calculate a hash,
+								  //which must be the same as the one provided here.
+  CLIENT_ENCRYPTION_CIPHERS,      //SDK only: list of available ciphers send to the server 
+  CLIENT_ENDMARKER,
+};
  • CLIENT_UNIQUE_IDENTIFIER

    String: Unique ID for this client. Stays the same after restarting the application, so you can use this to identify individual users.

  • CLIENT_NICKNAME

    Nickname used by the client. This value is always automatically updated for visible clients.

  • CLIENT_VERSION

    Application version used by this client. Needs to be requested with ts3client_requestClientVariables unless called on own client.

  • CLIENT_PLATFORM

    Operating system used by this client. Needs to be requested with ts3client_requestClientVariables unless called on own client.

  • CLIENT_FLAG_TALKING

    Set when the client is currently sending voice data to the server. Always available for visible clients.

    Note: You should query this flag for the own client using ts3client_getClientSelfVariableAsInt.

  • CLIENT_INPUT_MUTED

    Indicates the mute status of the clients capture device. Possible values are defined by the enum MuteInputStatus. Always available for visible clients.

  • CLIENT_OUTPUT_MUTED

    Indicates the combined mute status of the clients playback and capture devices. Possible values are defined by the enum MuteOutputStatus. Always available for visible clients.

  • CLIENT_OUTPUTONLY_MUTED

    Indicates the mute status of the clients playback device. Possible values are defined by the enum MuteOutputStatus. Always available for visible clients.

  • CLIENT_INPUT_HARDWARE

    Set if the clients capture device is not available. Possible values are defined by the enum HardwareInputStatus. Always available for visible clients.

  • CLIENT_OUTPUT_HARDWARE

    Set if the clients playback device is not available. Possible values are defined by the enum HardwareOutputStatus. Always available for visible clients.

  • CLIENT_INPUT_DEACTIVATED

    Set when the capture device has been deactivated as used in Push-To-Talk. Possible values are defined by the enum InputDeactivationStatus. Only used for the own clients and not available for other clients as it doesn't get propagated to the server.

  • CLIENT_IDLE_TIME

    Time the client has been idle. Needs to be requested with ts3client_requestClientVariables.

  • CLIENT_DEFAULT_CHANNEL

    CLIENT_DEFAULT_CHANNEL_PASSWORD

    Default channel name and password used in the last ts3client_startConnection call. Only available for own client.

  • CLIENT_META_DATA

    Not used by TeamSpeak 3, offers free storage for SDK users. Always available for visible clients.

  • CLIENT_IS_MUTED

    Indicates a client has been locally muted with ts3client_requestMuteClients. Client-side only.

  • CLIENT_IS_RECORDING

    Indicates a client is currently recording all voice data in his channel.

  • CLIENT_VOLUME_MODIFICATOR

    The client volume modifier set by ts3client_setClientVolumeModifier.

  • CLIENT_SECURITY_HASH

    Contains client security hash (optional feature). This hash is used to check if this client is allowed to enter specified channels with a matching CHANNEL_SECURITY_SALT. Motivation is to enforce clients joining a server with the specific identity, nickname and metadata.

    Please see the chapter “Security salts and hashes” in the Server SDK documentation for details.

  • CLIENT_ENCRYPTION_CIPHERS

    Comma-separated list of ciphers offered to the server to pick one from.

    Possible values are: +

    +           "AES-128"
    +           "AES-256"
    +       

    +

    Defaults to "AES-256,AES-128".


+

Generally all types of information can be retrieved as both string or integer. However, in most cases the expected data type is obvious, like querying CLIENT_NICKNAME will clearly require to store the result as string.

Example 1: Query client nickname

char* nickname;
+
+if(ts3client_getClientSelfVariableAsString(scHandlerID, CLIENT_NICKNAME, &nickname) == ERROR_ok) {
+    printf("My nickname is: %s\n", s);
+    ts3client_freeMemory(s);
+}

Example 2: Check if own client is currently talking (to be exact: sending voice data)

int talking;
+
+if(ts3client_getClientSelfVariableAsInt(scHandlerID, CLIENT_FLAG_TALKING, &talking) == ERROR_ok) {
+    switch(talking) {
+        case STATUS_TALKING:
+            // I am currently talking
+        break;
+        case STATUS_NOT_TALKING:
+            // I am currently not talking
+            break;
+        case STATUS_TALKING_WHILE_DISABLED:
+            // I am talking while microphone is disabled
+            break;
+        default:
+            printf("Invalid value for CLIENT_FLAG_TALKING\n");
+    }
+}


+

Information related to the own client can be modified with + +

unsigned int ts3client_setClientSelfVariableAsInt(serverConnectionHandlerID,  
 flag,  
 value); 
uint64 serverConnectionHandlerID;
ClientProperties flag;
int value;
 

+ +

unsigned int ts3client_setClientSelfVariableAsString(serverConnectionHandlerID,  
 flag,  
 value); 
uint64 serverConnectionHandlerID;
ClientProperties flag;
const char* value;
 

+

  • serverConnectionHandlerID

    ID of the server connection handler on which the information for the own client is changed.

  • flag

    Client propery to query, see above.

  • value

    Value the client property should be changed to.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

[Important]Important

After modifying one or more client variables, you must flush the changes. Flushing ensures the changes are sent to the TeamSpeak 3 server.

unsigned int ts3client_flushClientSelfUpdates(serverConnectionHandlerID,  
 returnCode); 
uint64 serverConnectionHandlerID;
const char* returnCode;
 

The idea behind flushing is, one can modify multiple values by calling ts3client_setClientVariableAsString and ts3client_setClientVariableAsInt and then apply all changes in one step.

For example, to change the own nickname:

/* Modify data */
+if(ts3client_setClientSelfVariableAsString(scHandlerID, CLIENT_NICKNAME, "Joe") != ERROR_ok) {
+    printf("Error setting client variable\n");
+    return;
+}
+
+/* Flush changes */
+if(ts3client_flushClientSelfUpdates(scHandlerID, NULL) != ERROR_ok) {
+    printf("Error flushing client updates");
+}

Example for doing two changes:

/* Modify data 1 */
+if(ts3client_setClientSelfVariableAsInt(scHandlerID, CLIENT_AWAY, AWAY_ZZZ) != ERROR_ok) {
+    printf("Error setting away mode\n");
+    return;
+}
+
+/* Modify data 2 */
+if(ts3client_setClientSelfVariableAsString(scHandlerID, CLIENT_AWAY_MESSAGE, "Lunch") != ERROR_ok) {
+    printf("Error setting away message\n");
+    return;
+}
+
+/* Flush changes */
+if(ts3client_flushClientSelfUpdates(scHandlerID, NULL) != ERROR_ok) {
+    printf("Error flushing client updates");
+}

Example to mute and unmute the microphone:

unsigned int error;
+bool shouldTalk;
+
+shouldTalk = isPushToTalkButtonPressed();  // Your key detection implementation
+if((error = ts3client_setClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_DEACTIVATED,
+                                                 shouldTalk ? INPUT_ACTIVE : INPUT_DEACTIVATED)) != ERROR_ok) {
+    char* errorMsg;
+    if(ts3client_getErrorMessage(error, &errorMsg) != ERROR_ok) {
+        printf("Error toggling push-to-talk: %s\n", errorMsg);
+	ts3client_freeMemory(errorMsg);
+    }
+    return;
+}
+
+if(ts3client_flushClientSelfUpdates(scHandlerID, NULL) != ERROR_ok) {
+    char* errorMsg;
+    if(ts3client_getErrorMessage(error, &errorMsg) != ERROR_ok) {
+        printf("Error flushing after toggling push-to-talk: %s\n", errorMsg);
+	ts3client_freeMemory(errorMsg);
+    }
+}

See the FAQ section for further details on implementing Push-To-Talk with ts3client_setClientSelfVariableAsInt.

Information related to other clients

Information related to other clients can be retrieved in a similar way. Unlike own clients however, information cannot be modified.

To query client related information, use one of the following functions. The parameter flag is defined by the enum ClientProperties as shown above.

+

unsigned int ts3client_getClientVariableAsInt(serverConnectionHandlerID,  
 clientID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
anyID clientID;
ClientProperties flag;
int* result;
 

+ +

+

unsigned int ts3client_getClientVariableAsUInt64(serverConnectionHandlerID,  
 clientID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
anyID clientID;
ClientProperties flag;
uint64* result;
 

+ +

+

unsigned int ts3client_getClientVariableAsString(serverConnectionHandlerID,  
 clientID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
anyID clientID;
ClientProperties flag;
char** result;
 

+ +

  • serverConnectionHandlerID

    ID of the server connection handler on which the information for the specified client is requested.

  • clientID

    ID of the client whose property is queried.

  • flag

    Client propery to query, see above.

  • result

    Address of a variable which receives the result value as int, uint64 or string, depending on which function is used. In case of a string, memory must be released using ts3client_freeMemory, unless an error occured.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. For the string version: If an error has occured, the result string is uninitialized and must not be released.


+

As the Client Lib cannot have all information for all users available all the time, the latest data for a given client can be requested from the server with: +

unsigned int ts3client_requestClientVariables(serverConnectionHandlerID,  
 clientID,  
 returnCode); 
uint64 serverConnectionHandlerID;
anyID clientID;
const char* returnCode;
 

+

The function requires one second delay before calling it again on the same client ID to avoid flooding the server.

  • serverConnectionHandlerID

    ID of the server connection handler on which the client variables are requested.

  • clientID

    ID of the client whose variables are requested.

  • returnCode

    See return code documentation. Pass NULL if you do not need this feature.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

After requesting the information, the following event is called. This event is also called everytime a client variable has been changed: +

void onUpdateClientEvent(serverConnectionHandlerID,  
 clientID,  
 invokerID,  
 invokerName,  
 invokerUniqueIdentifier); 
uint64 serverConnectionHandlerID;
anyID clientID;
anyID invokerID;
const char* invokerName;
const char* invokerUniqueIdentifier;
 

+

  • serverConnectionHandlerID

    ID of the server connection handler on which the client variables are now available or have changed.

  • clientID

    ID of the client whose variables are now available or have changed.

  • invokerID

    ID of the client who edited this clients variables.

  • invokerName

    Nickname of the client who edited this clients variables.

  • invokerUniqueIdentifier

    Unique ID of the client who edited this clients variables.

The event does not carry the information per se, but now the Client Lib guarantees to have the clients information available, which can be subsequently queried with ts3client_getClientVariableAsInt and ts3client_getClientVariableAsString.

Whisper lists

A client with a whisper list set can talk to the specified clients and channels bypassing the standard rule that voice is only transmitted to the current channel. Whisper lists can be defined for individual clients. A whisper list consists of an array of client IDs and/or an array of channel IDs. +

unsigned int ts3client_requestClientSetWhisperList(serverConnectionHandlerID,  
 clientID,  
 targetChannelIDArray,  
 targetClientIDArray,  
 returnCode); 
uint64 serverConnectionHandlerID;
anyID clientID;
const uint64* targetChannelIDArray;
const anyID* targetClientIDArray;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the server connection handler on which the clients whisper list is modified.

  • clientID

    ID of the client whose whisper list is modified. If set to 0, the own client is modified (same as setting to own client ID).

  • targetChannelIDArray

    Array of channel IDs, terminated with 0. These channels will be added to the whisper list.

    To clear the list, pass NULL or an empty array.

  • targetClientIDArray

    Array of client IDs, terminated with 0. These clients will be added to the whisper list.

    To clear the list, pass NULL or an empty array.

  • returnCode

    See return code documentation. Pass NULL if you do not need this feature.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

To disable the whisperlist for the given client, pass NULL to both targetChannelIDArray and targetClientIDArray. Careful: If you pass two empty arrays, whispering is not disabled but instead one would still be whispering to nobody (empty lists).

To control which client is allowed to whisper to own client, the Client Lib implements an internal whisper whitelist mechanism. When a client recieves a whisper while the whispering client has not yet been added to the whisper allow list, the receiving client gets the following event. Note that whisper voice data is not received until the sending client is added to the receivers whisper allow list.

void onIgnoredWhisperEvent(serverConnectionHandlerID,  
 clientID); 
uint64 serverConnectionHandlerID;
anyID clientID;
 
  • serverConnectionHandlerID

    ID of the server connection handler on which the event occured.

  • clientID

    ID of the whispering client.

The receiving client can decide to allow whispering from the sender and add the sending client to the whisper allow list by calling ts3client_allowWhispersFrom. If the sender is not added by the receiving client, this event persists being called but no voice data is transmitted to the receiving client.

To add a client to the whisper allow list:

unsigned int ts3client_allowWhispersFrom(serverConnectionHandlerID,  
 clID); 
uint64 serverConnectionHandlerID;
anyID clID;
 
  • serverConnectionHandlerID

    ID of the server connection handler on which the client should be added to the whisper allow list.

  • clID

    ID of the client to be added to the whisper allow list.

To remove a client from the whisper allow list:

unsigned int ts3client_removeFromAllowedWhispersFrom(serverConnectionHandlerID,  
 clID); 
uint64 serverConnectionHandlerID;
anyID clID;
 
  • serverConnectionHandlerID

    ID of the server connection handler on which the client should be removed from the whisper allow list.

  • clID

    ID of the client to be removed from the whisper allow list.

It won't have bad sideeffects if the same client ID is added to the whisper allow list multiple times.

diff --git a/docs/client_html/ar01s22s02.html b/docs/client_html/ar01s22s02.html new file mode 100644 index 0000000..e005173 --- /dev/null +++ b/docs/client_html/ar01s22s02.html @@ -0,0 +1,75 @@ +Channel information

Channel information

Querying and modifying information related to channels is similar to dealing with clients. The functions to query channel information are:

+

unsigned int ts3client_getChannelVariableAsInt(serverConnectionHandlerID,  
 channelID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
uint64 channelID;
ChannelProperties flag;
int* result;
 

+ +

+

unsigned int ts3client_getChannelVariableAsUInt64(serverConnectionHandlerID,  
 channelID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
uint64 channelID;
ChannelProperties flag;
uint64* result;
 

+ +

+

unsigned int ts3client_getChannelVariableAsString(serverConnectionHandlerID,  
 channelID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
uint64 channelID;
ChannelProperties flag;
char* result;
 

+ +

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. For the string version: If an error has occured, the result string is uninitialized and must not be released.

The parameter flag specifies the type of queried information. It is defined by the enum ChannelProperties:

enum ChannelProperties {
+  CHANNEL_NAME = 0,             //Available for all channels that are "in view", always up-to-date
+  CHANNEL_TOPIC,                //Available for all channels that are "in view", always up-to-date
+  CHANNEL_DESCRIPTION,          //Must be requested (=> requestChannelDescription)
+  CHANNEL_PASSWORD,             //not available client side
+  CHANNEL_CODEC,                //Available for all channels that are "in view", always up-to-date
+  CHANNEL_CODEC_QUALITY,        //Available for all channels that are "in view", always up-to-date
+  CHANNEL_MAXCLIENTS,           //Available for all channels that are "in view", always up-to-date
+  CHANNEL_MAXFAMILYCLIENTS,     //Available for all channels that are "in view", always up-to-date
+  CHANNEL_ORDER,                //Available for all channels that are "in view", always up-to-date
+  CHANNEL_FLAG_PERMANENT,       //Available for all channels that are "in view", always up-to-date
+  CHANNEL_FLAG_SEMI_PERMANENT,  //Available for all channels that are "in view", always up-to-date
+  CHANNEL_FLAG_DEFAULT,         //Available for all channels that are "in view", always up-to-date
+  CHANNEL_FLAG_PASSWORD,        //Available for all channels that are "in view", always up-to-date
+  CHANNEL_CODEC_LATENCY_FACTOR, //Available for all channels that are "in view", always up-to-date
+  CHANNEL_CODEC_IS_UNENCRYPTED, //Available for all channels that are "in view", always up-to-date
+  CHANNEL_SECURITY_SALT,        //Sets the options+salt for security hash (SDK only)
+  CHANNEL_DELETE_DELAY,         //How many seconds to wait before deleting this channel
+  CHANNEL_ENDMARKER,
+};


+

To modify channel data use

+ +

unsigned int ts3client_setChannelVariableAsInt(serverConnectionHandlerID,  
 channelID,  
 flag,  
 value); 
uint64 serverConnectionHandlerID;
uint64 channelID;
ChannelProperties flag;
int value;
 

+ +

+ +

unsigned int ts3client_setChannelVariableAsUInt64(serverConnectionHandlerID,  
 channelID,  
 flag,  
 value); 
uint64 serverConnectionHandlerID;
uint64 channelID;
ChannelProperties flag;
uint64 value;
 

+ +

+ +

unsigned int ts3client_setChannelVariableAsString(serverConnectionHandlerID,  
 channelID,  
 flag,  
 value); 
uint64 serverConnectionHandlerID;
uint64 channelID;
ChannelProperties flag;
const char* value;
 

+ +

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

[Important]Important

After modifying one or more channel variables, you have to flush the changes to the server. +

unsigned int ts3client_flushChannelUpdates(serverConnectionHandlerID,  
 channelID); 
uint64 serverConnectionHandlerID;
uint64 channelID;
 

+

As example, to change the channel name and topic:

/* Modify data 1 */
+if(ts3client_setChannelVariableAsString(scHandlerID, channelID, CHANNEL_NAME,
+                                        "Other channel name") != ERROR_ok) {
+    printf("Error setting channel name\n");
+    return;
+}
+
+/* Modify data 2 */
+if(ts3client_setChannelVariableAsString(scHandlerID, channelID, CHANNEL_TOPIC,
+                                        "Other channel topic") != ERROR_ok) {
+    printf("Error setting channel topic\n");
+    return;
+}
+
+/* Flush changes */
+if(ts3client_flushChannelUpdates(scHandlerID, channelID) != ERROR_ok) {
+    printf("Error flushing channel updates\n");
+    return;
+}


+

After a channel was edited using ts3client_setChannelVariableAsInt or ts3client_setChannelVariableAsString and the changes were flushed to the server, the edit is announced with the event:

void onUpdateChannelEditedEvent(serverConnectionHandlerID,  
 channelID,  
 invokerID,  
 invokerName,  
 invokerUniqueIdentifier); 
uint64 serverConnectionHandlerID;
uint64 channelID;
anyID invokerID;
const char* invokerName;
const char* invokerUniqueIdentifier;
 


+

To find the channel ID from a channels path: +

unsigned int ts3client_getChannelIDFromChannelNames(serverConnectionHandlerID,  
 channelNameArray,  
 result); 
uint64 serverConnectionHandlerID;
char** channelNameArray;
uint64* result;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

Channel voice data encryption

Voice data can be encrypted or unencrypted. Encryption will increase CPU load, so should be used only when required. Encryption can be configured per channel (the default) or globally enabled or disabled for the whole virtual server. By default channels are sending voice data unencrypted, newly created channels would need to be set to encrypted if required.

To configure the global virtual server encryption settings, modify the virtual server property VIRTUALSERVER_CODEC_ENCRYPTION_MODE to one of the following values: +

enum CodecEncryptionMode {
+   CODEC_ENCRYPTION_PER_CHANNEL = 0,  // Default
+   CODEC_ENCRYPTION_FORCED_OFF,
+   CODEC_ENCRYPTION_FORCED_ON,
+};

+

Voice data encryption per channel can be configured by setting the channel property CHANNEL_CODEC_IS_UNENCRYPTED to 0 (encrypted) or 1 (unencrypted) if global encryption mode is CODEC_ENCRYPTION_PER_CHANNEL. If encryption is forced on or off globally, the channel property will be automatically set by the server.

diff --git a/docs/client_html/ar01s22s02s02.html b/docs/client_html/ar01s22s02s02.html new file mode 100644 index 0000000..182f268 --- /dev/null +++ b/docs/client_html/ar01s22s02s02.html @@ -0,0 +1,7 @@ +Channel sorting

Channel sorting

The order how channels should be display in the GUI is defined by the channel variable CHANNEL_ORDER, which can be queried with ts3client_getChannelVariableAsUInt64 or changed with ts3client_setChannelVariableAsUInt64.

The channel order is the ID of the predecessor channel after which the given channel should be sorted. An order of 0 means the channel is sorted on the top of its hirarchy.

Channel_1  (ID = 1, order = 0)
+Channel_2  (ID = 2, order = 1)
+      Subchannel_1  (ID = 4, order = 0)
+            Subsubchannel_1  (ID = 6, order = 0)
+            Subsubchannel_2  (ID = 7, order = 6)
+      Subchannel_2  (ID = 5, order = 4)
+Channel_3  (ID = 3, order = 2)

When a new channel is created, the client is responsible to set a proper channel order. With the default value of 0 the channel will be sorted on the top of its hirarchy right after its parent channel.

When moving a channel to a new parent, the desired channel order can be passed to ts3client_requestChannelMove.

To move the channel to another position within the current hirarchy - the parent channel stays the same -, adjust the CHANNEL_ORDER variable with ts3client_setChannelVariableAsUInt64.

After connecting to a TeamSpeak 3 server, the client will be informed of all channels by the onNewChannelEvent callback. The order how channels are propagated to the client by this event is:

diff --git a/docs/client_html/ar01s22s03.html b/docs/client_html/ar01s22s03.html new file mode 100644 index 0000000..9a27987 --- /dev/null +++ b/docs/client_html/ar01s22s03.html @@ -0,0 +1,49 @@ +Server information

Server information

Similar to reading client and channel data, server information can be queried with

+ +

unsigned int ts3client_getServerVariableAsInt(serverConnectionHandlerID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
VirtualServerProperties flag;
int* result;
 

+ +

+

unsigned int ts3client_getServerVariableAsUInt64(serverConnectionHandlerID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
VirtualServerProperties flag;
uint64* result;
 

+ +

+ +

unsigned int ts3client_getServerVariableAsString(serverConnectionHandlerID,  
 flag,  
 result); 
uint64 serverConnectionHandlerID;
VirtualServerProperties flag;
char** result;
 

+ +

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h. For the string version: If an error has occured, the result string is uninitialized and must not be released.

The parameter flag specifies the type of queried information. It is defined by the enum VirtualServerProperties:

enum VirtualServerProperties {
+  VIRTUALSERVER_UNIQUE_IDENTIFIER = 0, //available when connected, can be used to identify this particular
+                                       //server installation
+  VIRTUALSERVER_NAME,                  //available and always up-to-date when connected
+  VIRTUALSERVER_WELCOMEMESSAGE,        //available when connected, not updated while connected
+  VIRTUALSERVER_PLATFORM,              //available when connected
+  VIRTUALSERVER_VERSION,               //available when connected
+  VIRTUALSERVER_MAXCLIENTS,            //only available on request (=> requestServerVariables), stores the
+                                       //maximum number of clients that may currently join the server
+  VIRTUALSERVER_PASSWORD,              //not available to clients, the server password
+  VIRTUALSERVER_CLIENTS_ONLINE,        //only available on request (=> requestServerVariables),
+  VIRTUALSERVER_CHANNELS_ONLINE,       //only available on request (=> requestServerVariables),
+  VIRTUALSERVER_CREATED,               //available when connected, stores the time when the server was created
+  VIRTUALSERVER_UPTIME,                //only available on request (=> requestServerVariables), the time
+                                       //since the server was started
+  VIRTUALSERVER_CODEC_ENCRYPTION_MODE, //available and always up-to-date when connected
+  VIRTUALSERVER_ENCRYPTION_CIPHERS,    //SDK only: list of ciphers that can be used for encryption
+  VIRTUALSERVER_ENDMARKER,
+};


+

Example code checking the number of clients online, obviously an integer value: +

int clientsOnline;
+
+if(ts3client_getServerVariableAsInt(scHandlerID, VIRTUALSERVER_CLIENTS_ONLINE, &clientsOnline) == ERROR_ok)
+    printf("There are %d clients online\n", clientsOnline);


+

A client can request refreshing the server information with: +

unsigned int ts3client_requestServerVariables(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

+

The following event informs the client when the requested information is available: +

unsigned int onServerUpdatedEvent(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

+


+

The following event notifies the client when virtual server information has been edited: +

void onServerEditedEvent(serverConnectionHandlerID,  
 editerID,  
 editerName,  
 editerUniqueIdentifier); 
uint64 serverConnectionHandlerID;
anyID editerID;
const char* editerName;
const char* editerUniqueIdentifier;
 

+

diff --git a/docs/client_html/ar01s23.html b/docs/client_html/ar01s23.html new file mode 100644 index 0000000..0350c3b --- /dev/null +++ b/docs/client_html/ar01s23.html @@ -0,0 +1,27 @@ +Interacting with the server

Interacting with the server

Interacting with the server means various actions, related to both channels and clients. Channels can be joined, created, edited, deleted and subscribed. Clients can use text chat with other clients, be kicked or poked and move between channels.

All strings passed to and from the Client Lib need to be encoded in UTF-8 format.

Joining a channel

When a client logs on to a TeamSpeak 3 server, he will automatically join the channel with the “Default” flag, unless he specified another channel in ts3client_startConnection. To have your own or another client switch to a certain channel, call +

unsigned int ts3client_requestClientMove(serverConnectionHandlerID,  
 clientID,  
 newChannelID,  
 password,  
 returnCode); 
uint64 serverConnectionHandlerID;
anyID clientID;
uint64 newChannelID;
const char* password;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the server connection handler ID on which this action is requested.

  • clientID

    ID of the client to move.

  • newChannelID

    ID of the channel the client wants to join.

  • password

    An optional password, required for password-protected channels. Pass an empty string if no password is given.

  • returnCode

    See return code documentation. Pass NULL if you do not need this feature.

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

If the move was successful, one the following events will be called: + +

void onClientMoveEvent(serverConnectionHandlerID,  
 clientID,  
 oldChannelID,  
 newChannelID,  
 visibility,  
 moveMessage); 
uint64 serverConnectionHandlerID;
anyID clientID;
uint64 oldChannelID;
uint64 newChannelID;
int visibility;
const char* moveMessage;
 

+

  • serverConnectionHandlerID

    ID of the server connection handler on which the action occured.

  • clientID

    ID of the moved client.

  • oldChannelID

    ID of the old channel left by the client.

  • newChannelID

    ID of the new channel joined by the client.

  • visibility

    Defined in the enum Visibility + +

    enum Visibility {
    +    ENTER_VISIBILITY = 0,
    +    RETAIN_VISIBILITY,
    +    LEAVE_VISIBILITY
    +};

    +

    • ENTER_VISIBILITY

      Client moved and entered visibility. Cannot happen on own client.

    • RETAIN_VISIBILITY

      Client moved between two known places. Can happen on own or other client.

    • LEAVE_VISIBILITY

      Client moved out of our sight. Cannot happen on own client.

  • moveMessage

    When a client disconnects from the server, this includes the optional message set by the disconnecting client in ts3client_stopConnection.

Example: Requesting to move the own client into channel ID 12 (not password-protected):

ts3client_requestClientMove(scHandlerID, ts3client_getClientID(scHandlerID), 12, "", NULL);

Now wait for the callback:

+void my_onClientMoveEvent(uint64 scHandlerID, anyID clientID,
+                          uint64 oldChannelID, uint64 newChannelID,
+                          int visibility, const char* moveMessage) {
+  // scHandlerID   ->  Server connection handler ID, same as above when requesting
+  // clientID      ->  Own client ID, same as above when requesting
+  // oldChannelID  ->  ID of the channel the client has left
+  // newChannelID  ->  12, as requested above
+  // visibility    ->  One of ENTER_VISIBILITY, RETAIN_VISIBILITY, LEAVE_VISIBILITY
+  // moveMessage   ->  Optional message set by disconnecting clients
+}


+

If the move was initiated by another client, instead of onClientMove the following event is called: +

void onClientMoveMovedEvent(serverConnectionHandlerID,  
 clientID,  
 oldChannelID,  
 newChannelID,  
 visibility,  
 moverID,  
 moverName,  
 moverUniqueIdentifier,  
 moveMessage); 
uint64 serverConnectionHandlerID;
anyID clientID;
uint64 oldChannelID;
uint64 newChannelID;
int visibility;
anyID moverID;
const char* moverName;
const char* moverUniqueIdentifier;
const char* moveMessage;
 

+

Like onClientMoveEvent but with additional information about the client, which has initiated the move: moverID defines the ID, moverName the nickname and moverUniqueIdentifier the unique ID of the client who initiated the move. moveMessage contains a string giving the reason for the move.

If oldChannelID is 0, the client has just connected to the server. If newChannelID is 0, the client disconnected. Both values cannot be 0 at the same time.

diff --git a/docs/client_html/ar01s23s02.html b/docs/client_html/ar01s23s02.html new file mode 100644 index 0000000..c156590 --- /dev/null +++ b/docs/client_html/ar01s23s02.html @@ -0,0 +1,36 @@ +Creating a new channel

Creating a new channel

To create a channel, set the various channel variables using ts3client_setChannelVariableAsInt and ts3client_setChannelVariableAsString. Pass zero as the channel ID parameter.

Then flush the changes to the server by calling: +

unsigned int ts3client_flushChannelCreation(serverConnectionHandlerID,  
 channelParentID); 
uint64 serverConnectionHandlerID;
uint64 channelParentID;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

After flushing the changes to the server, the following event will be called on successful channel creation: +

void onNewChannelCreatedEvent(serverConnectionHandlerID,  
 channelID,  
 channelParentID,  
 invokerID,  
 invokerName,  
 invokerUniqueIdentifier); 
uint64 serverConnectionHandlerID;
uint64 channelID;
uint64 channelParentID;
anyID invokerID;
const char* invokerName;
const char* invokerUniqueIdentifier;
 

+


+

Example code to create a channel:

#define CHECK_ERROR(x) if((error = x) != ERROR_ok) { goto on_error; }
+
+int createChannel(uint64 scHandlerID, uint64 parentChannelID, const char* name, const char* topic,
+                  const char* description, const char* password, int codec, int codecQuality,
+                  int maxClients, int familyMaxClients, int order, int perm,
+                  int semiperm, int default) {
+  unsigned int error;
+
+  /* Set channel data, pass 0 as channel ID */
+  CHECK_ERROR(ts3client_setChannelVariableAsString(scHandlerID, 0, CHANNEL_NAME, name));
+  CHECK_ERROR(ts3client_setChannelVariableAsString(scHandlerID, 0, CHANNEL_TOPIC, topic));
+  CHECK_ERROR(ts3client_setChannelVariableAsString(scHandlerID, 0, CHANNEL_DESCRIPTION, desc));
+  CHECK_ERROR(ts3client_setChannelVariableAsString(scHandlerID, 0, CHANNEL_PASSWORD, password));
+  CHECK_ERROR(ts3client_setChannelVariableAsInt   (scHandlerID, 0, CHANNEL_CODEC, codec));
+  CHECK_ERROR(ts3client_setChannelVariableAsInt   (scHandlerID, 0, CHANNEL_CODEC_QUALITY, codecQuality));
+  CHECK_ERROR(ts3client_setChannelVariableAsInt   (scHandlerID, 0, CHANNEL_MAXCLIENTS, maxClients));
+  CHECK_ERROR(ts3client_setChannelVariableAsInt   (scHandlerID, 0, CHANNEL_MAXFAMILYCLIENTS, familyMaxClients));
+  CHECK_ERROR(ts3client_setChannelVariableAsUInt64(scHandlerID, 0, CHANNEL_ORDER, order));
+  CHECK_ERROR(ts3client_setChannelVariableAsInt   (scHandlerID, 0, CHANNEL_FLAG_PERMANENT, perm));
+  CHECK_ERROR(ts3client_setChannelVariableAsInt   (scHandlerID, 0, CHANNEL_FLAG_SEMI_PERMANENT, semiperm));
+  CHECK_ERROR(ts3client_setChannelVariableAsInt   (scHandlerID, 0, CHANNEL_FLAG_DEFAULT, default));
+
+  /* Flush changes to server */
+  CHECK_ERROR(ts3client_flushChannelCreation(scHandlerID, parentChannelID));
+  return 0;  /* Success */
+
+on_error:
+  printf("Error creating channel: %d\n", error);
+  return 1;  /* Failure */
+}
diff --git a/docs/client_html/ar01s23s03.html b/docs/client_html/ar01s23s03.html new file mode 100644 index 0000000..7ca7087 --- /dev/null +++ b/docs/client_html/ar01s23s03.html @@ -0,0 +1,6 @@ +Deleting a channel

Deleting a channel

A channel can be removed with +

unsigned int ts3client_requestChannelDelete(serverConnectionHandlerID,  
 channelID,  
 force,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 channelID;
int force;
const char* returnCode;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

After the request has been sent to the server, the following event will be called: +

void onDelChannelEvent(serverConnectionHandlerID,  
 channelID,  
 invokerID,  
 invokerName,  
 invokerUniqueIdentifier); 
uint64 serverConnectionHandlerID;
uint64 channelID;
anyID invokerID;
const char* invokerName;
const char* invokerUniqueIdentifier;
 

+

diff --git a/docs/client_html/ar01s23s04.html b/docs/client_html/ar01s23s04.html new file mode 100644 index 0000000..19c1a5c --- /dev/null +++ b/docs/client_html/ar01s23s04.html @@ -0,0 +1,6 @@ +Moving a channel

Moving a channel

To move a channel to a new parent channel, call +

unsigned int ts3client_requestChannelMove(serverConnectionHandlerID,  
 channelID,  
 newChannelParentID,  
 newChannelOrder,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 channelID;
uint64 newChannelParentID;
uint64 newChannelOrder;
const char* returnCode;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

After sending the request, the following event will be called if the move was successful: +

void onChannelMoveEvent(serverConnectionHandlerID,  
 channelID,  
 newChannelParentID,  
 invokerID,  
 invokerName,  
 invokerUniqueIdentifier); 
uint64 serverConnectionHandlerID;
uint64 channelID;
uint64 newChannelParentID;
anyID invokerID;
const char* invokerName;
const char* invokerUniqueIdentifier;
 

+

diff --git a/docs/client_html/ar01s23s05.html b/docs/client_html/ar01s23s05.html new file mode 100644 index 0000000..150ee9d --- /dev/null +++ b/docs/client_html/ar01s23s05.html @@ -0,0 +1 @@ +Text chat

Text chat

In addition to voice chat, TeamSpeak 3 allows clients to communicate with text-chat. Valid targets can be a client, channel or virtual server. Depending on the target, there are three functions to send text messages and one callback to receive them.

diff --git a/docs/client_html/ar01s23s05s01.html b/docs/client_html/ar01s23s05s01.html new file mode 100644 index 0000000..f9f8b24 --- /dev/null +++ b/docs/client_html/ar01s23s05s01.html @@ -0,0 +1,15 @@ +Sending

Sending

To send a private text message to a client: +

unsigned int ts3client_requestSendPrivateTextMsg(serverConnectionHandlerID,  
 message,  
 targetClientID,  
 returnCode); 
uint64 serverConnectionHandlerID;
const char* message;
anyID targetClientID;
const char* returnCode;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

To send a text message to a channel: +

unsigned int ts3client_requestSendChannelTextMsg(serverConnectionHandlerID,  
 message,  
 targetChannelID,  
 returnCode); 
uint64 serverConnectionHandlerID;
const char* message;
anyID targetChannelID;
const char* returnCode;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

To send a text message to the virtual server: +

unsigned int ts3client_requestSendServerTextMsg(serverConnectionHandlerID,  
 message,  
 returnCode); 
uint64 serverConnectionHandlerID;
const char* message;
const char* returnCode;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

Example to send a text chat to a client with ID 123:

const char *msg = "Hello TeamSpeak!";
+anyID targetClientID = 123;
+
+if(ts3client_requestSendPrivateTextMsg(scHandlerID, msg, targetClient, NULL) != ERROR_ok) {
+  /* Handle error */
+}
diff --git a/docs/client_html/ar01s23s05s02.html b/docs/client_html/ar01s23s05s02.html new file mode 100644 index 0000000..22adf15 --- /dev/null +++ b/docs/client_html/ar01s23s05s02.html @@ -0,0 +1,8 @@ +Receiving

Receiving

The following event will be called when a text message is received: +

void onTextMessageEvent(serverConnectionHandlerID,  
 targetMode,  
 toID,  
 fromID,  
 fromName,  
 fromUniqueIdentifier,  
 message); 
uint64 serverConnectionHandlerID;
anyID targetMode;
anyID toID;
anyID fromID;
const char* fromName;
const char* fromUniqueIdentifier;
const char* message;
 

+

diff --git a/docs/client_html/ar01s23s06.html b/docs/client_html/ar01s23s06.html new file mode 100644 index 0000000..ed2da69 --- /dev/null +++ b/docs/client_html/ar01s23s06.html @@ -0,0 +1,14 @@ +Kicking clients

Kicking clients

Clients can be forcefully removed from a channel or the whole server. To kick a client from a channel or server call:

+

unsigned int ts3client_requestClientKickFromChannel(serverConnectionHandlerID,  
 clientID,  
 kickReason,  
 returnCode); 
uint64 serverConnectionHandlerID;
anyID clientID;
const char* kickReason;
const char* returnCode;
 

+ +

+

unsigned int ts3client_requestClientKickFromServer(serverConnectionHandlerID,  
 clientID,  
 kickReason,  
 returnCode); 
uint64 serverConnectionHandlerID;
anyID clientID;
const char* kickReason;
const char* returnCode;
 

+ +

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

After successfully requesting a kick, one of the following events will be called:

+

void onClientKickFromChannelEvent(serverConnectionHandlerID,  
 clientID,  
 oldChannelID,  
 newChannelID,  
 visibility,  
 kickerID,  
 kickerName,  
 kickerUniqueIdentifier,  
 kickMessage); 
uint64 serverConnectionHandlerID;
anyID clientID;
uint64 oldChannelID;
uint64 newChannelID;
int visibility;
anyID kickerID;
const char* kickerName;
const char* kickerUniqueIdentifier;
const char* kickMessage;
 

+ +

+

void onClientKickFromServerEvent(serverConnectionHandlerID,  
 clientID,  
 oldChannelID,  
 newChannelID,  
 visibility,  
 kickerID,  
 kickerName,  
 kickerUniqueIdentifier,  
 kickMessage); 
uint64 serverConnectionHandlerID;
anyID clientID;
uint64 oldChannelID;
uint64 newChannelID;
int visibility;
anyID kickerID;
const char* kickerName;
const char* kickerUniqueIdentifier;
const char* kickMessage;
 

+ +

diff --git a/docs/client_html/ar01s23s07.html b/docs/client_html/ar01s23s07.html new file mode 100644 index 0000000..da74b7c --- /dev/null +++ b/docs/client_html/ar01s23s07.html @@ -0,0 +1,28 @@ +Channel subscriptions

Channel subscriptions

Normally a user only sees other clients who are in the same channel. Clients joining or leaving other channels or changing status are not displayed. To offer a way to get notifications about clients in other channels, a user can subscribe to other channels. It would also be possible to always subscribe to all channels to get notifications about all clients on the server.

Subscriptions are meant to have a flexible way to balance bandwidth usage. On a crowded server limiting the number of subscribed channels is a way to reduce network traffic. Also subscriptions allow to usage “private” channels, whose members cannot be seen by other users.

[Note]Note

A client is automatically subscribed to the current channel.

To subscribe to a list of channels (zero-terminated array of channel IDs) call: +

unsigned int ts3client_requestChannelSubscribe(serverConnectionHandlerID,  
 channelIDArray,  
 returnCode); 
uint64 serverConnectionHandlerID;
const uint64* channelIDArray;
const char* returnCode;
 

+

To unsubscribe from a list of channels (zero-terminated array of channel IDs) call: +

unsigned int ts3client_requestChannelUnsubscribe(serverConnectionHandlerID,  
 channelIDArray,  
 returnCode); 
uint64 serverConnectionHandlerID;
const uint64* channelIDArray;
const char* returnCode;
 

+

To subscribe to all channels on the server call: +

unsigned int ts3client_requestChannelSubscribeAll(serverConnectionHandlerID,  
 returnCode); 
uint64 serverConnectionHandlerID;
const char* returnCode;
 

+

To unsubscribe from all channels on the server call: +

unsigned int ts3client_requestChannelUnsubscribeAll(serverConnectionHandlerID,  
 returnCode); 
uint64 serverConnectionHandlerID;
const char* returnCode;
 

+

To check if a channel is currently subscribed, check the channel property CHANNEL_FLAG_ARE_SUBSCRIBED with ts3client_getChannelVariableAsInt:

int isSubscribed;
+
+if(ts3client_getChannelVariableAsInt(scHandlerID, channelID, CHANNEL_FLAG_ARE_SUBSCRIBED, &isSubscribed)
+   != ERROR_ok) {
+    /* Handle error */
+}

The following event will be sent for each successfully subscribed channel: +

void onChannelSubscribeEvent(serverConnectionHandlerID,  
 channelID); 
uint64 serverConnectionHandlerID;
uint64 channelID;
 

+

Provided for convinience, to mark the end of mulitple calls to onChannelSubscribeEvent when subscribing to several channels, this event is called: +

void onChannelSubscribeFinishedEvent(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

+

The following event will be sent for each successfully unsubscribed channel: +

void onChannelUnsubscribeEvent(serverConnectionHandlerID,  
 channelID); 
uint64 serverConnectionHandlerID;
uint64 channelID;
 

+

Similar like subscribing, this event is a convinience callback to mark the end of multiple calls to onChannelUnsubscribeEvent: +

void onChannelUnsubscribeFinishedEvent(serverConnectionHandlerID); 
uint64 serverConnectionHandlerID;
 

+

Once a channel has been subscribed or unsubscribed, the event onClientMoveSubscriptionEvent is sent for each client in the subscribed channel. The event is not to be confused with onClientMoveEvent, which is called for clients actively switching channels.

void onClientMoveSubscriptionEvent(serverConnectionHandlerID,  
 clientID,  
 oldChannelID,  
 newChannelID,  
 visibility); 
uint64 serverConnectionHandlerID;
anyID clientID;
uint64 oldChannelID;
uint64 newChannelID;
int visibility;
 
diff --git a/docs/client_html/ar01s24.html b/docs/client_html/ar01s24.html new file mode 100644 index 0000000..45601f9 --- /dev/null +++ b/docs/client_html/ar01s24.html @@ -0,0 +1,13 @@ +Muting clients locally

Muting clients locally

Individual clients can be locally muted. This information is handled client-side only and not visibile to other clients. It mainly serves as a sort of individual "ban" or "ignore" feature, where users can decide not to listen to certain clients anymore.

When a client becomes muted, he will no longer be heard by the muter. Also the TeamSpeak 3 server will stop sending voice packets.

The mute state is not visible to the muted client nor to other clients. It is only available to the muting client by checking the CLIENT_IS_MUTED client property.

To mute one or more clients: +

unsigned int ts3client_requestMuteClients(serverConnectionHandlerID,  
 clientIDArray,  
 returnCode); 
uint64 serverConnectionHandlerID;
const anyID* clientIDArray;
const char* returnCode;
 

+

To unmute one or more clients: +

unsigned int ts3client_requestUnmuteClients(serverConnectionHandlerID,  
 clientIDArray,  
 returnCode); 
uint64 serverConnectionHandlerID;
const anyID* clientIDArray;
const char* returnCode;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.

Example to mute two clients:

anyID clientIDArray[3];  // List of two clients plus terminating zero
+clientIDArray[0] = 123;  // First client ID to mute
+clientIDArray[1] = 456;  // Second client ID to mute
+clientIDArray[2] = 0;    // Terminating zero
+
+if(ts3client_requestMuteClients(scHandlerID, clientIDArray) != ERROR_ok)  /* Mute clients */
+    printf("Error muting clients: %d\n", error);

To check if a client is currently muted, query the CLIENT_IS_MUTED client property:

int clientIsMuted;
+if(ts3client_getClientVariableAsInt(scHandlerID, clientID, CLIENT_IS_MUTED, &clientIsMuted) != ERROR_ok)
+    printf("Error querying client muted state\n);
diff --git a/docs/client_html/ar01s25.html b/docs/client_html/ar01s25.html new file mode 100644 index 0000000..5a960f6 --- /dev/null +++ b/docs/client_html/ar01s25.html @@ -0,0 +1,24 @@ +Custom encryption

Custom encryption

As an optional feature, the TeamSpeak 3 SDK allows users to implement custom encryption and decryption for all network traffic. Custom encryption replaces the default AES encryption implemented by the TeamSpeak 3 SDK. A possible reason to apply own encryption might be to make ones TeamSpeak 3 client/server incompatible to other SDK implementations.

Custom encryption must be implemented the same way in both the client and server.

[Note]Note

If you do not want to use this feature, just don't implement the two encryption callbacks.

+ To encrypt outgoing data, implement the callback: +

void onCustomPacketEncryptEvent(dataToSend,  
 sizeOfData); 
char** dataToSend;
unsigned int* sizeOfData;
 

+ +

+


+

+ To decrypt incoming data, implement the callback: +

void onCustomPacketDecryptEvent(dataReceived,  
 dataReceivedSize); 
char** dataReceived;
unsigned int* dataReceivedSize;
 

+ +

+

Example code implementing a very simple XOR custom encryption and decryption (also see the SDK examples):

void onCustomPacketEncryptEvent(char** dataToSend, unsigned int* sizeOfData) {
+    unsigned int i;
+    for(i = 0; i < *sizeOfData; i++) {
+        (*dataToSend)[i] ^= CUSTOM_CRYPT_KEY;
+    }
+}
+
+void onCustomPacketDecryptEvent(char** dataReceived, unsigned int* dataReceivedSize) {
+    unsigned int i;
+    for(i = 0; i < *dataReceivedSize; i++) {
+        (*dataReceived)[i] ^= CUSTOM_CRYPT_KEY;
+    }
+}
diff --git a/docs/client_html/ar01s26.html b/docs/client_html/ar01s26.html new file mode 100644 index 0000000..8db2ed5 --- /dev/null +++ b/docs/client_html/ar01s26.html @@ -0,0 +1,3 @@ +Custom passwords

Custom passwords

The TeamSpeak SDK has the optional ability to do custom password handling. This makes it possible to allow people on the server (or channels) with passwords that are checked against outside datasources, like LDAP or other databases.

+To implement custom password, both server and client need to add custom callbacks, which will be spontaneously called whenever a password check is done in TeamSpeak. The SDK developer can implement own checks to validate the password instead of using the TeamSpeak built-in mechanism.


+

Both Server and Client Lib can implement the following callback to encrypt a user password. This function is called in the Client Lib when a channel password is set.

This can be used to hash the password in the same way it is hashed in the outside data store. Or just copy the password to send the clear text to the server.

void onClientPasswordEncrypt(serverID,  
 plaintext,  
 encryptedText,  
 encryptedTextByteSize); 
uint64 serverID;
const char* plaintext;
char* encryptedText;
int encryptedTextByteSize;
 
diff --git a/docs/client_html/ar01s27.html b/docs/client_html/ar01s27.html new file mode 100644 index 0000000..7b10c9a --- /dev/null +++ b/docs/client_html/ar01s27.html @@ -0,0 +1,19 @@ +Other events

Other events

When a client starts or stops talking, a talk status change event is sent by the server: +

void onTalkStatusChangeEvent(serverConnectionHandlerID,  
 status,  
 isReceivedWhisper,  
 clientID); 
uint64 serverConnectionHandlerID;
int status;
int isReceivedWhisper;
anyID clientID;
 

+


+

If a client drops his connection, a timeout event is announced by the server: +

void onClientMoveTimeoutEvent(serverConnectionHandlerID,  
 clientID,  
 oldChannelID,  
 newChannelID,  
 visibility,  
 timeoutMessage); 
uint64 serverConnectionHandlerID;
anyID clientID;
uint64 oldChannelID;
uint64 newChannelID;
int visibility;
const char* timeoutMessage;
 

+


+

When the description of a channel was edited, the following event is called: +

void onChannelDescriptionUpdateEvent(serverConnectionHandlerID,  
 channelID); 
uint64 serverConnectionHandlerID;
uint64 channelID;
 

+

The new description can be queried with ts3client_getChannelVariableAsString(channelID, CHANNEL_DESCRIPTION).


+

The following event tells the client that the specified channel has been modified. The GUI should fetch the channel data with ts3client_getChannelVariableAsInt and ts3client_getChannelVariableAsString and update the channel display. +

void onUpdateChannelEvent(serverConnectionHandlerID,  
 channelID); 
uint64 serverConnectionHandlerID;
uint64 channelID;
 

+


+

The following event is called when a channel password was modified. The GUI might remember previously entered channel passwords, so this callback announces the stored password might be invalid. +

void onChannelPasswordChangedEvent(serverConnectionHandlerID,  
 channelID); 
uint64 serverConnectionHandlerID;
uint64 channelID;
 

+

diff --git a/docs/client_html/ar01s28.html b/docs/client_html/ar01s28.html new file mode 100644 index 0000000..6c48071 --- /dev/null +++ b/docs/client_html/ar01s28.html @@ -0,0 +1,14 @@ +Miscellaneous functions

Miscellaneous functions

Memory dynamically allocated in the Client Lib needs to be released with: +

unsigned int ts3client_freeMemory(pointer); 
void* pointer;
 

+

Example:

char* version;
+
+if(ts3client_getClientLibVersion(&version) == ERROR_ok) {
+    printf("Version: %s\n", version);
+    ts3client_freeMemory(version);
+}
[Important]Important

Memory must not be released if the function, which dynamically allocated the memory, returned an error. In that case, the result is undefined and not initialized, so freeing the memory might crash the application.


+

Instead of sending the sound through the network, it can be routed directly through the playback device, so the user will get immediate audible feedback when for example configuring some sound settings. +

unsigned int ts3client_setLocalTestMode(serverConnectionHandlerID,  
 status); 
uint64 serverConnectionHandlerID;
intstatus;
 

+

Returns ERROR_ok on success, otherwise an error code as defined in public_errors.h.


+

With the delayed temporary channel deletion feature, users can define after how many seconds a temporary channel will be deleted after the last client has left the channel. The delay is defined by setting the channel variable CHANNEL_DELETE_DELAY. This variable can be set and queried as described in channel information.

To query the time in seconds since the last client has left a temporary channel, call: +

unsigned int ts3client_getChannelEmptySecs(serverConnectionHandlerID,  
 channelID,  
 result); 
uint64 serverConnectionHandlerID;
uint64 channelID;
int* result;
 

+

diff --git a/docs/client_html/ar01s29.html b/docs/client_html/ar01s29.html new file mode 100644 index 0000000..7f05441 --- /dev/null +++ b/docs/client_html/ar01s29.html @@ -0,0 +1,95 @@ +Filetransfer

Filetransfer

The TeamSpeak SDK includes the ability to support filetransfer, like the regular TeamSpeak server and client offer. The Server can function as a file storage, which can be accessed by Clients who can up- and download files. Files are stored on the filesystem where the server is running.

In general, clients can initiate filetransfer actions like uploading or downloading a file, requesting file information (size, name, path etc.), list files in a directory and so on. The functions to call these actions are explained in detail below. In addition to the functions actively called, there are filetransfer related callbacks which are triggered when the server returned the requested information (e.g. list of files in a directory).

Each transfer is identified by a transferID, which is passed to most filetransfer functions. Transfer IDs are unique during the time of the transfer, but may be reused again some time after the previous transfer with the same ID has finished.

Files are organized on the server inside channels (identified by their channelID. The top-level directory in each channel is “/”. Subdirectories in each channel may exist and are defined with a path of the form “/dir1/dir2”. Subdirectories are optional and need to be created with ts3client_requestCreateDirectory, the channel root directory always exists by default.

Query information

The following functions allow to query information about a file transfer identified by its transferID.

Query the file name of the specified transfer: +

unsigned int ts3client_getTransferFileName(transferID,  
 result); 
anyID transferID;
char** result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    Points to a C string containing the file name. Remember to call ts3client_freeMemory to release the string, which is dynamically allocated in the clientlib.


+

Query the file path of the specified transfer: +

unsigned int ts3client_getTransferFilePath(transferID,  
 result); 
anyID transferID;
char** result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    Points to a C string containing the file path. Remember to call ts3client_freeMemory to release the string, which is dynamically allocated in the clientlib.


+

Query the remote path on the server of the specified transfer: +

unsigned int ts3client_getTransferFileRemotePath(transferID,  
 result); 
anyID transferID;
char** result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    Points to a C string containing the remote path on the server. Remember to call ts3client_freeMemory to release the string, which is dynamically allocated in the clientlib.


+

Query the file size of the specified transfer: +

unsigned int ts3client_getTransferFileSize(transferID,  
 result); 
anyID transferID;
uint64* result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    File size of the transfer.


+

Query the currently transferred file size of the queried transfer: +

unsigned int ts3client_getTransferFileSizeDone(transferID,  
 result); 
anyID transferID;
uint64* result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    Already transferred size of the transfer.


+

Query if the specified transfer is an upload or download: +

unsigned int ts3client_isTransferSender(transferID,  
 result); 
anyID transferID;
int* result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    1 == upload, 0 == download


+

Query the status of the specified transfer: +

unsigned int ts3client_getTransferStatus(transferID,  
 result); 
anyID transferID;
int* result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    Current status of the file transfer, specified by the struct FileTransferState: +

    enum FileTransferState {
    +    FILETRANSFER_INITIALISING = 0,
    +    FILETRANSFER_ACTIVE,
    +    FILETRANSFER_FINISHED,
    +};

    +


+

Query the current speed of the specified transfer: +

unsigned int ts3client_getCurrentTransferSpeed(transferID,  
 result); 
anyID transferID;
float* result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    Currently measured speed of the file transfer.


+

Query the average speed of the specified transfer: +

unsigned int ts3client_getAverageTransferSpeed(transferID,  
 result); 
anyID transferID;
float* result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    Average speed of the file transfer.


+

Query the time the specified transfer has used: +

unsigned int ts3client_getTransferRunTime(transferID,  
 result); 
anyID transferID;
uint64* result;
 

+

  • transferID

    ID of the filetransfer we want to query.

  • result

    Time the transfer has used.


+

Initiate transfers

The following functions implement the core functionality of filetransfers. They initiate new up- and downloads, request file info, delete and rename files, create directories, list directories etc.

Request uploading a local file to the server: +

unsigned int ts3client_sendFile(serverConnectionHandlerID,  
 channelID,  
 channelPW,  
 file,  
 overwrite,  
 resume,  
 sourceDirectory,  
 result,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 channelID;
const char* channelPW;
const char* file;
int overwrite;
int resume;
const char* sourceDirectory;
anyID* result;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the virtual server the file transfer operation will be requested.

  • channelID

    Target channel ID in which the file should be uploaded.

  • channelPW

    Optional channel password. Pass empty string if unused.

  • file

    Filename of the local file, which is to be uploaded.

  • overwrite

    1 == overwrite remote file if it exists, 0 = do not overwrite (operation will abort if remote file exists)

  • resume

    If we have a previously halted transfer: 1 = resume, 0 = restart transfer

  • sourceDirectory

    Local directory where the file to upload is located.

  • result

    Pointer to memory where the transferID will be stored, if the transfer has been started successfully (when this function returns ERROR_ok).

  • returnCode

    String containing the return code if it has been set by the Client Lib function call which caused this error event.

    See return code documentation.


+

Request downloading a file from the server: +

unsigned int ts3client_requestFile(serverConnectionHandlerID,  
 channelID,  
 channelPW,  
 file,  
 overwrite,  
 resume,  
 destinationDirectory,  
 result,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 channelID;
const char* channelPW;
const char* file;
int overwrite;
int resume;
const char* destinationDirectory;
anyID* result;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the virtual server the file transfer operation will be requested.

  • channelID

    Remote channel ID from which the file should be downloaded.

  • channelPW

    Optional channel password. Pass empty string if unused.

  • file

    Filename of the remote file, which is to be downloaded.

  • overwrite

    1 == overwrite local file if it exists, 0 = do not overwrite (operation will abort if local file exists)

  • resume

    If we have a previously halted transfer: 1 = resume, 0 = restart transfer

  • destinationDirectory

    Local target directory name where the download file should be saved.

  • result

    Pointer to memory where the transferID will be stored, if the transfer has been started successfully (when this function returns ERROR_ok).

  • returnCode

    String containing the return code if it has been set by the Client Lib function call which caused this error event.

    See return code documentation.


+

Pause a transfer, specified by its transferID: +

unsigned int ts3client_haltTransfer(serverConnectionHandlerID,  
 transferID,  
 deleteUnfinishedFile,  
 returnCode); 
uint64 serverConnectionHandlerID;
anyID transferID;
int deleteUnfinishedFile;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the virtual server the file transfer operation will be requested.

  • transferID

    ID of the transfer that should be halted.

  • deleteUnfinishedFile

    1 = delete the halted file, 0 = do not deleted halted file

  • returnCode

    String containing the return code if it has been set by the Client Lib function call which caused this error event.

    See return code documentation.


+

Query list of files in a directory. The answer from the server will trigger the onFileListEvent and onFileListFinishedEvent callbacks with the requested information. +

unsigned int ts3client_requestFileList(serverConnectionHandlerID,  
 channelID,  
 channelPW,  
 path,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 channelID;
const char* channelPW;
const char* path;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the virtual server the file transfer operation will be requested.

  • channelID

    Remote channel ID, from which we want to query the file list.

  • channelPW

    Optional channel password. Pass empty string if unused.

  • path

    Path inside the channel, defining the subdirectory. Top level path is “/

  • returnCode

    String containing the return code if it has been set by the Client Lib function call which caused this error event.

    See return code documentation.


+

Query information of a specified file. The answer from the server will trigger the onFileInfoEvent callback with the requested information. +

unsigned int ts3client_requestFileInfo(serverConnectionHandlerID,  
 channelID,  
 channelPW,  
 file,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 channelID;
const char* channelPW;
const char* file;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the virtual server the file transfer operation will be requested.

  • channelID

    Remote channel ID, from which we want to query the file info.

  • channelPW

    Optional channel password. Pass empty string if unused.

  • file

    File name we want to request info from, needs to include the full path within the channel, e.g. “/file” for a top-level file or “/dir1/dir2/file” for a file located in a subdirectory.

  • returnCode

    String containing the return code if it has been set by the Client Lib function call which caused this error event.

    See return code documentation.


+

Request deleting one or more remote files on the server: +

unsigned int ts3client_requestDeleteFile(serverConnectionHandlerID,  
 channelID,  
 channelPW,  
 file,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 channelID;
const char* channelPW;
const char** file;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the virtual server the file transfer operation will be requested.

  • channelID

    Remote channel ID, in which we want to delete the files.

  • channelPW

    Optional channel password. Pass empty string if unused.

  • file

    List of files we request to delete. Array must be NULL-terminated. The file names need to include the full path within the channel, e.g. “/file” for a top-level file or “/dir1/dir2/file” for a file located in a subdirectory.

  • returnCode

    String containing the return code if it has been set by the Client Lib function call which caused this error event.

    See return code documentation.


+

Request creating a directory: +

unsigned int ts3client_requestCreateDirectory(serverConnectionHandlerID,  
 channelID,  
 channelPW,  
 directoryPath,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 channelID;
const char* channelPW;
const char* directoryPath;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the virtual server the file transfer operation will be requested.

  • channelID

    Remote channel ID, in which we want to create the directory.

  • channelPW

    Optional channel password. Pass empty string if unused.

  • file

    Name of the directory to create. The directory name needs to include the full path within the channel, e.g. “/file” for a top-level file or “/dir1/dir2/file” for a file located in a subdirectory.

  • returnCode

    String containing the return code if it has been set by the Client Lib function call which caused this error event.

    See return code documentation.


+

Request renaming or moving a file. If the source and target channels and paths are the same, the file will simply be renamed. +

unsigned int ts3client_requestRenameFile(serverConnectionHandlerID,  
 fromChannelID,  
 fromChannelPW,  
 toChannelID,  
 toChannelPW,  
 oldFile,  
 newFile,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 fromChannelID;
const char* fromChannelPW;
uint64 toChannelID;
const char* toChannelPW;
const char* oldFile;
const char* newFile;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the virtual server the file transfer operation will be requested.

  • fromChannelID

    Source channel ID, in which we want to rename the file.

  • fromChannelPW

    Optional source channel password. Pass empty string if unused.

  • toChannelID

    Target channel ID, to which we want to move the file. If the file should not be moved to another channel, this parameter should be equal to fromChannelID.

  • toChannelPW

    Optional target channel password. Pass empty string if unused.

  • oldFile

    Old name of the file. The file name needs to include the full path within the channel, e.g. “/file” for a top-level file or “/dir1/dir2/file” for a file located in a subdirectory.

  • newFile

    Target name of the directory to create. The directory name need to include the full path within the channel, e.g. “/file” for a top-level file or “/dir1/dir2/file” for a file located in a subdirectory.

    To move files to another subdirectory in the same channel without renaming the file, fromChannelID has to be equal to toChannelID, keep the file name itself but just change the path.

  • returnCode

    String containing the return code if it has been set by the Client Lib function call which caused this error event.

    See return code documentation.

Speed limits

The TeamSpeak SDK offers the possibility to control and finetune transfer speed limits. These limits can be applied to the complete server, specific virtual servers or for each individual transfer. By default the transfer speed is unlimited. Every file transfer should at least have a minimum speed limit of 5kb/s.

Neither the TeamSpeak client nor server will store any of those values. When used, they'll have to be set at each client start to be considered permanent.

To set the upload speed limit for all virtual servers in bytes/s: +

unsigned int ts3client_setInstanceSpeedLimitUp(newLimit); 
uint64 newLimit;
 

+

To set the download speed limit for all virtual servers in bytes/s: +

unsigned int ts3client_setInstanceSpeedLimitDown(newLimit); 
uint64 newLimit;
 

+

To get the upload speed limit for all virtual servers in bytes/s: +

unsigned int ts3client_getInstanceSpeedLimitUp(limit); 
uint64* limit;
 

+

To get the download speed limit for all virtual servers in bytes/s: +

unsigned int ts3client_getInstanceSpeedLimitDown(limit); 
uint64* limit;
 

+

To set the upload speed limit for the specified virtual server in bytes/s: +

unsigned int ts3client_setServerConnectionHandlerSpeedLimitUp(serverConnectionHandlerID,  
 newLimit); 
uint64 serverConnectionHandlerID;
uint64 newLimit;
 

+

To set the download speed limit for the specified virtual server in bytes/s: +

unsigned int ts3client_setServerConnectionHandlerSpeedLimitDown(serverConnectionHandlerID,  
 newLimit); 
uint64 serverConnectionHandlerID;
uint64 newLimit;
 

+

To get the upload speed limit for the specified virtual server in bytes/s: +

unsigned int ts3client_getServerConnectionHandlerSpeedLimitUp(serverConnectionHandlerID,  
 limit); 
uint64 serverConnectionHandlerID;
uint64* limit;
 

+

To get the download speed limit for the specified virtual server in bytes/s: +

unsigned int ts3client_getServerConnectionHandlerSpeedLimitDown(serverConnectionHandlerID,  
 limit); 
uint64 serverConnectionHandlerID;
uint64* limit;
 

+

To set the up- or download speed limit for the specified file transfer in bytes/s. Use ts3client_isTransferSender to query if the transfer is an up- or download. +

unsigned int ts3client_setTransferSpeedLimit(transferID,  
 newLimit); 
anyID transferID;
uint64 newLimit;
 

+

To get the speed limit for the specified file transfer in bytes/s: +

unsigned int ts3client_getTransferSpeedLimit(transferID,  
 limit); 
anyID transferID;
uint64* limit;
 

+


+

Callbacks

This event is called when a file transfer, triggered by ts3client_sendFile or ts3client_requestFile has finished or aborted with an error. +

void onFileTransferStatusEvent(transferID,  
 status,  
 statusMessage,  
 remotefileSize,  
 serverConnectionHandlerID); 
anyID transferID;
unsigned int status;
const char* statusMessage;
uint64 remotefileSize;
uint64 serverConnectionHandlerID;
 

+

  • transferID

    ID of the transfer. This ID was returned by the call to ts3client_sendFile or ts3client_requestFile which triggered this event.

  • status

    Indicates how and why the transfer has finished:

    • ERROR_file_transfer_complete

      Transfer completed successfully.

    • ERROR_file_transfer_canceled

      Transfer was halted by a call to ts3client_haltTransfer.

    • ERROR_file_transfer_interrupted

      An error occured, transfer was stopped for various reasons (network error etc.)

    • ERROR_file_transfer_reset

      Transfer was reset. This can happen if the remote file has changed (another user uploaded another file under the same channel ID, path and file name).

  • statusMessage

    Status text message for a verbose display of the status parameter.

  • remotefileSize

    Remote size of the file on the server.

  • serverConnectionHandlerID

    ID of the virtual server on which the file list was requested.


+

Callback containing the reply by the server on ts3client_requestFileList. There event is called for every file in the specified path. After the last file, onFileListFinished will indicate the end of the list. +

void onFileListEvent(serverConnectionHandlerID,  
 channelID,  
 path,  
 name,  
 size,  
 datetime,  
 type,  
 incompletesize,  
 returnCode); 
uint64 serverConnectionHandlerID;
uint64 channelID;
const char* path;
const char* name;
uint64 size;
uint64 datetime;
int type;
uint64 incompletesize;
const char* returnCode;
 

+

  • serverConnectionHandlerID

    ID of the virtual server on which the file list was requested.

  • channelID

    ID of the channel which file list was requested.

  • path

    Subdirectory inside the channel for which the file list was requested. “/” indicates the root directory is listed.

  • name

    File name.

  • size

    File size

  • datetime

    File date (Unix time in seconds)

  • type

    Indicates if this entry is a directory or a file. Type is specified as:

    enum {
    +    FileListType_Directory = 0,
    +    FileListType_File,
    +};
  • incompletesize

    If the file is currently still being transferred, this indicates the currently transferred file size.

  • returnCode

    String containing the return code if it has been set by ts3client_requestFileList which triggered this event.


+

Callback indicating the end of an incoming file list, see onFileList. +

void onFileListFinishedEvent(serverConnectionHandlerID,  
 channelID,  
 path); 
uint64 serverConnectionHandlerID;
uint64 channelID;
const char* path;
 

+

  • serverConnectionHandlerID

    ID of the virtual server on which the file list was requested.

  • channelID

    If of the channel which files have been listed.

  • path

    Path within the channel which files have been listed.


+

Callback containing the reply by the server for ts3client_requestFileInfo: +

void onFileInfoEvent(serverConnectionHandlerID,  
 channelID,  
 name,  
 size,  
 datetime); 
uint64 serverConnectionHandlerID;
uint64 channelID;
const char* name;
uint64 size;
uint64 datetime;
 

+

  • serverConnectionHandlerID

    ID of the virtual server on which the file info was requested.

  • channelID

    If of the channel in which the file is located.

  • name

    File name including the path within the channel in which the file is located.

  • size

    File size

  • datetime

    File date (Unix time in seconds)

diff --git a/docs/client_html/ar01s30.html b/docs/client_html/ar01s30.html new file mode 100644 index 0000000..fcc3559 --- /dev/null +++ b/docs/client_html/ar01s30.html @@ -0,0 +1,47 @@ +FAQ

FAQ


+

How to implement Push-To-Talk?

Push-To-Talk should be implemented by toggling the client variable CLIENT_INPUT_DEACTIVATED using the function ts3client_setClientSelfVariableAsInt. The variable can be set to the following values (see the enum InputDeactivationStatus in public_definitions.h):

  • INPUT_ACTIVE

  • INPUT_DEACTIVATED

For Push-To-Talk toggle between INPUT_ACTIVE (talking) and INPUT_DEACTIVATED (not talking).

Example code:

unsigned int error;
+bool shouldTalk;
+
+shouldTalk = isPushToTalkButtonPressed();  // Your key detection implementation
+if((error = ts3client_setClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_DEACTIVATED,
+                                                 shouldTalk ? INPUT_ACTIVE : INPUT_DEACTIVATED))
+    != ERROR_ok) {
+    char* errorMsg;
+    if(ts3client_getErrorMessage(error, &errorMsg) != ERROR_ok) {
+        printf("Error toggling push-to-talk: %s\n", errorMsg);
+        ts3client_freeMemory(errorMsg);
+    }
+    return;
+}
+
+if(ts3client_flushClientSelfUpdates(scHandlerID, NULL) != ERROR_ok) {
+    char* errorMsg;
+    if(ts3client_getErrorMessage(error, &errorMsg) != ERROR_ok) {
+        printf("Error flushing after toggling push-to-talk: %s\n", errorMsg);
+        ts3client_freeMemory(errorMsg);
+    }
+}

It is not necessary to close and reopen the capture device to implement Push-To-Talk.

Basically it would be possible to toggle CLIENT_INPUT_MUTED as well, but the advantage of CLIENT_INPUT_DEACTIVATED is that the change is not propagated to the server and other connected clients, thus saving network traffic. CLIENT_INPUT_MUTED should instead be used for manually muting the microphone when using Voice Activity Detection instead of Push-To-Talk.

If you need to query the current muted state, use ts3client_getClientSelfVariableAsInt:

int hardwareStatus, deactivated, muted;
+
+if(ts3client_getClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_HARDWARE,
+                                        &hardwareStatus) != ERROR_ok) {
+    /* Handle error */
+}
+if(ts3client_getClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_DEACTIVATED,
+                                        &deactivated) != ERROR_ok) {
+    /* Handle error */
+}
+if(ts3client_getClientSelfVariableAsInt(scHandlerID, CLIENT_INPUT_MUTED,
+                                        &muted) != ERROR_ok) {
+    /* Handle error */
+}
+
+if(hardwareStatus == HARDWAREINPUT_DISABLED) {
+    /* No capture device available */
+}
+if(deactivated == INPUT_DEACTIVATED) {
+    /* Input was deactivated for Push-To-Talk (not propagated to server) */
+}
+if(muted == MUTEINPUT_MUTED) {
+    /* Input was muted (propagated to server) */
+}

When using Push-To-Talk, you should deactivate Voice Activity Detection in the preprocessor or keep the VAD level very low. To deactivate VAD, use:

ts3client_setPreProcessorConfigValue(serverConnectionHandlerID, "vad", "false");

How to adjust the volume?

Output volume

The global voice output volume can be adjusted by changing the “volume_modifierplayback option using the function ts3client_setPlaybackConfigValue. The value is in decibel, so 0 is no modification, negative values make the signal quieter and positive values louder.

Example to increase the output volume by 10 decibel: +

ts3client_setPlaybackConfigValue(scHandlerID, "volume_modifier", 10);

In addition to modifying the global output volue, the volume of individual clients can be changed with ts3client_setClientVolumeModifier.

Input volume

Automatic Gain Control (AGC) takes care of the input volume during preprocessing automatically. Instead of modifying the input volume directly, you modify the AGC preprocessor settings with setProProcessorConfigValue.

How to talk across channels?

Generally clients can only talk to other clients in the same channel. However, for specific scenarios this can be overruled using whisper lists.. This feature allows specific clients to temporarily talk to other clients or channels outside of their own channel. While whispering, talking to the own channel is disabled.

An example for a scenario where whisper may be useful would be a team consisting of a number of squads. Each squad is assigned to one channel, so squad members can only talk to other members of the same squad. In addition, there is a team leader and squad leaders, who want to communicate accross the squad channels. This can be implemented with whispering, so the team leader could broadcast to all squad leaders, or a squad leader could briefly report to the team leader temporarily sending his voice data to him instead of the squad leaders channel.

This mechanism is powerful and flexible allowing the SDK developer to handle more complex scenarios overruling the standard behaviour where clients can only talk to other clients within the same channel.

diff --git a/docs/client_html/images/caution.png b/docs/client_html/images/caution.png new file mode 100644 index 0000000..f79d839 Binary files /dev/null and b/docs/client_html/images/caution.png differ diff --git a/docs/client_html/images/home.png b/docs/client_html/images/home.png new file mode 100644 index 0000000..427c628 Binary files /dev/null and b/docs/client_html/images/home.png differ diff --git a/docs/client_html/images/important.png b/docs/client_html/images/important.png new file mode 100644 index 0000000..d35f594 Binary files /dev/null and b/docs/client_html/images/important.png differ diff --git a/docs/client_html/images/logo.png b/docs/client_html/images/logo.png new file mode 100644 index 0000000..0750822 Binary files /dev/null and b/docs/client_html/images/logo.png differ diff --git a/docs/client_html/images/next.png b/docs/client_html/images/next.png new file mode 100644 index 0000000..7fa9992 Binary files /dev/null and b/docs/client_html/images/next.png differ diff --git a/docs/client_html/images/note.png b/docs/client_html/images/note.png new file mode 100644 index 0000000..f55871f Binary files /dev/null and b/docs/client_html/images/note.png differ diff --git a/docs/client_html/images/prev.png b/docs/client_html/images/prev.png new file mode 100644 index 0000000..c1c82ea Binary files /dev/null and b/docs/client_html/images/prev.png differ diff --git a/docs/client_html/images/up.png b/docs/client_html/images/up.png new file mode 100644 index 0000000..9fd7903 Binary files /dev/null and b/docs/client_html/images/up.png differ diff --git a/docs/client_html/index.html b/docs/client_html/index.html new file mode 100644 index 0000000..0986cc7 --- /dev/null +++ b/docs/client_html/index.html @@ -0,0 +1,5 @@ +TeamSpeak 3 Client SDK Developer Manual

TeamSpeak 3 Client SDK Developer Manual

+ Revision + 2019-06-11 17:55:55 + +


Table of Contents

Introduction
System requirements
Overview of header files
Calling Client Lib functions
Return code
Initializing
The callback mechanism
Querying the library version
Shutting down
Managing server connection handlers
Connecting to a server
Disconnecting from a server
Error handling
Logging
User-defined logging
Using playback and capture modes and devices
Initializing modes and devices
Querying available modes and devices
Checking current modes and devices
Closing devices
Using custom devices
Activating the capture device
Sound codecs
Encoder options
Preprocessor options
Playback options
Accessing the voice buffer
Voice recording
Playing wave files
3D Sound
Query available servers, channels and clients
Retrieve and store information
Client information
Information related to own client
Information related to other clients
Whisper lists
Channel information
Channel voice data encryption
Channel sorting
Server information
Interacting with the server
Joining a channel
Creating a new channel
Deleting a channel
Moving a channel
Text chat
Sending
Receiving
Kicking clients
Channel subscriptions
Muting clients locally
Custom encryption
Custom passwords
Other events
Miscellaneous functions
Filetransfer
Query information
Initiate transfers
Speed limits
Callbacks
FAQ
How to implement Push-To-Talk?
How to adjust the volume?
How to talk across channels?
Index
diff --git a/docs/client_html/ix01.html b/docs/client_html/ix01.html new file mode 100644 index 0000000..9ca049f --- /dev/null +++ b/docs/client_html/ix01.html @@ -0,0 +1 @@ +Index

Index

Symbols

3D sound, 3D Sound

A

AGC, Preprocessor options
Automatic Gain Control, Preprocessor options

B

bandwidth, Sound codecs

C

callback, The callback mechanism
calling convention, System requirements
capture device, Using playback and capture modes and devices
Channel order, Channel sorting
Channel voice data encryption, Channel voice data encryption
client ID, Connecting to a server
codec, Sound codecs

E

encoder, Encoder options
enums
ChannelProperties, Channel information
ClientProperties, Information related to own client, Information related to other clients
CodecEncryptionMode, Server information
ConnectStatus, Connecting to a server, Disconnecting from a server, Channel sorting
InputDeactivationStatus, How to implement Push-To-Talk?
LogLevel, Logging
LogType, Initializing, User-defined logging
TextMessageTargetMode, Receiving
VirtualServerProperties, Server information
Visibility, Joining a channel, Kicking clients, Channel subscriptions
error codes, Overview of header files
events
onChannelDescriptionUpdateEvent, Other events
onChannelMoveEvent, Moving a channel
onChannelPasswordChangedEvent, Other events
onChannelSubscribeEvent, Channel subscriptions
onChannelSubscribeFinishedEvent, Channel subscriptions
onChannelUnsubscribeEvent, Channel subscriptions
onChannelUnsubscribeFinishedEvent, Channel subscriptions
onClientKickFromChannelEvent, Kicking clients
onClientKickFromServerEvent, Kicking clients
onClientMoveEvent, Joining a channel
onClientMoveMovedEvent, Joining a channel
onClientMoveSubscriptionEvent, Channel subscriptions
onClientMoveTimeoutEvent, Other events
onClientPasswordEncrypt, Custom passwords
onConnectStatusChangeEvent, Connecting to a server, Disconnecting from a server
onCustom3dRolloffCalculationClientEvent, 3D Sound
onCustom3dRolloffCalculationWaveEvent, 3D Sound
onCustomPacketDecryptEvent, Custom encryption
onCustomPacketEncryptEvent, Custom encryption
onDelChannelEvent, Deleting a channel
onEditCapturedVoiceDataEvent, Accessing the voice buffer
onEditMixedPlaybackVoiceDataEvent, Accessing the voice buffer
onEditPlaybackVoiceDataEvent, Accessing the voice buffer
onEditPostProcessVoiceDataEvent, Accessing the voice buffer
onIgnoredWhisperEvent, Whisper lists
onNewChannelCreatedEvent, Creating a new channel
onNewChannelEvent, Connecting to a server
onPlaybackShutdownCompleteEvent, Closing devices
onServerEditedEvent, Server information
onServerErrorEvent, Return code, Error handling
onServerStopEvent, Disconnecting from a server
onServerUpdatedEvent, Server information
onTalkStatusChangeEvent, Other events
onTextMessageEvent, Receiving
onUpdateChannelEditedEvent, Channel information
onUpdateChannelEvent, Other events
onUpdateClientEvent, Information related to other clients
onUserLoggingMessageEvent, User-defined logging

F

FAQ, FAQ
Filetransfer, Filetransfer
functions
onFileInfoEvent, Callbacks
onFileListEvent, Callbacks
onFileListFinishedEvent, Callbacks
onFileTransferStatusEvent, Callbacks
ts3client_acquireCustomPlaybackData, Using custom devices
ts3client_activateCaptureDevice, Activating the capture device
ts3client_allowWhispersFrom, Whisper lists
ts3client_channelset3DAttributes, 3D Sound
ts3client_closeCaptureDevice, Closing devices
ts3client_closePlaybackDevice, Closing devices
ts3client_closeWaveFileHandle, Playing wave files
ts3client_createIdentity, Connecting to a server
ts3client_destroyClientLib, Shutting down
ts3client_destroyServerConnectionHandler, Managing server connection handlers
ts3client_flushChannelCreation, Creating a new channel
ts3client_flushChannelUpdates, Channel information
ts3client_flushClientSelfUpdates, Information related to own client
ts3client_freeMemory, Miscellaneous functions
ts3client_getAverageTransferSpeed, Query information
ts3client_getCaptureDeviceList, Querying available modes and devices
ts3client_getCaptureModeList, Querying available modes and devices
ts3client_getChannelClientList, Query available servers, channels and clients
ts3client_getChannelEmptySecs, Miscellaneous functions
ts3client_getChannelIDFromChannelNames, Channel information
ts3client_getChannelList, Query available servers, channels and clients
ts3client_getChannelOfClient, Query available servers, channels and clients
ts3client_getChannelVariableAsInt, Channel information
ts3client_getChannelVariableAsString, Channel information
ts3client_getChannelVariableAsUInt64, Channel information
ts3client_getClientID, Connecting to a server, Information related to own client
ts3client_getClientLibVersion, Querying the library version
ts3client_getClientLibVersionNumber, Querying the library version
ts3client_getClientList, Query available servers, channels and clients
ts3client_getClientSelfVariableAsInt, Information related to own client
ts3client_getClientSelfVariableAsString, Information related to own client
ts3client_getClientVariableAsInt, Information related to other clients
ts3client_getClientVariableAsString, Information related to other clients
ts3client_getClientVariableAsUInt64, Information related to other clients
ts3client_getConnectionStatus, Connecting to a server
ts3client_getCurrentCaptureDeviceName, Checking current modes and devices
ts3client_getCurrentCaptureMode, Checking current modes and devices
ts3client_getCurrentPlaybackDeviceName, Checking current modes and devices
ts3client_getCurrentPlayBackMode, Checking current modes and devices
ts3client_getCurrentTransferSpeed, Query information
ts3client_getDefaultCaptureDevice, Querying available modes and devices
ts3client_getDefaultCaptureMode, Querying available modes and devices
ts3client_getDefaultPlaybackDevice, Querying available modes and devices
ts3client_getDefaultPlayBackMode, Querying available modes and devices
ts3client_getEncodeConfigValue, Encoder options
ts3client_getErrorMessage, Error handling
ts3client_getInstanceSpeedLimitDown, Speed limits
ts3client_getInstanceSpeedLimitUp, Speed limits
ts3client_getParentChannelOfChannel, Query available servers, channels and clients
ts3client_getPlaybackConfigValueAsFloat, Playback options
ts3client_getPlaybackDeviceList, Querying available modes and devices
ts3client_getPlaybackModeList, Querying available modes and devices
ts3client_getPreProcessorConfigValue, Preprocessor options
ts3client_getPreProcessorInfoValueFloat, Preprocessor options
ts3client_getServerConnectionHandlerList, Query available servers, channels and clients
ts3client_getServerConnectionHandlerSpeedLimitDown, Speed limits
ts3client_getServerConnectionHandlerSpeedLimitUp, Speed limits
ts3client_getServerVariableAsInt, Server information
ts3client_getServerVariableAsString, Server information
ts3client_getServerVariableAsUInt64, Server information
ts3client_getTransferFileName, Query information
ts3client_getTransferFilePath, Query information
ts3client_getTransferFileRemotePath, Query information
ts3client_getTransferFileSize, Query information
ts3client_getTransferFileSizeDone, Query information
ts3client_getTransferRunTime, Query information
ts3client_getTransferSpeedLimit, Speed limits
ts3client_getTransferStatus, Query information
ts3client_haltTransfer, Initiate transfers
ts3client_initClientLib, Initializing
ts3client_initiateGracefulPlaybackShutdown, Closing devices
ts3client_isTransferSender, Query information
ts3client_logMessage, Logging
ts3client_openCaptureDevice, Initializing modes and devices
ts3client_openPlaybackDevice, Initializing modes and devices
ts3client_pauseWaveFileHandle, Playing wave files
ts3client_playWaveFile, Playing wave files
ts3client_playWaveFileHandle, Playing wave files
ts3client_processCustomCaptureData, Using custom devices
ts3client_registerCustomDevice, Using custom devices
ts3client_removeFromAllowedWhispersFrom, Whisper lists
ts3client_requestChannelDelete, Deleting a channel
ts3client_requestChannelDescription, Channel information
ts3client_requestChannelMove, Moving a channel
ts3client_requestChannelSubscribe, Channel subscriptions
ts3client_requestChannelSubscribeAll, Channel subscriptions
ts3client_requestChannelUnsubscribe, Channel subscriptions
ts3client_requestChannelUnsubscribeAll, Channel subscriptions
ts3client_requestClientKickFromChannel, Kicking clients
ts3client_requestClientKickFromServer, Kicking clients
ts3client_requestClientMove, Joining a channel
ts3client_requestClientSetWhisperList, Whisper lists
ts3client_requestClientVariables, Information related to other clients
ts3client_requestCreateDirectory, Initiate transfers
ts3client_requestDeleteFile, Initiate transfers
ts3client_requestFile, Initiate transfers
ts3client_requestFileInfo, Initiate transfers
ts3client_requestFileList, Initiate transfers
ts3client_requestMuteClients, Muting clients locally
ts3client_requestRenameFile, Initiate transfers
ts3client_requestSendChannelTextMsg, Sending
ts3client_requestSendPrivateTextMsg, Sending
ts3client_requestSendServerTextMsg, Sending
ts3client_requestServerVariables, Server information
ts3client_requestUnmuteClients, Muting clients locally
ts3client_sendFile, Initiate transfers
ts3client_set3DWaveAttributes, 3D Sound
ts3client_setChannelVariableAsInt, Channel information
ts3client_setChannelVariableAsString, Channel information
ts3client_setChannelVariableAsUInt64, Channel information
ts3client_setClientSelfVariableAsInt, Information related to own client
ts3client_setClientSelfVariableAsString, Information related to own client
ts3client_setClientVolumeModifier, Playback options
ts3client_setInstanceSpeedLimitDown, Speed limits
ts3client_setInstanceSpeedLimitUp, Speed limits
ts3client_setLocalTestMode, Miscellaneous functions
ts3client_setLogVerbosity, User-defined logging
ts3client_setPlaybackConfigValue, Playback options, How to adjust the volume?
ts3client_setPreProcessorConfigValue, Preprocessor options
ts3client_setServerConnectionHandlerSpeedLimitDown, Speed limits
ts3client_setServerConnectionHandlerSpeedLimitUp, Speed limits
ts3client_setTransferSpeedLimit, Speed limits
ts3client_spawnNewServerConnectionHandler, Managing server connection handlers
ts3client_startConnection, Connecting to a server
ts3client_startConnectionWithChannelID, Connecting to a server
ts3client_startVoiceRecording, Voice recording
ts3client_stopConnection, Disconnecting from a server
ts3client_stopVoiceRecording, Voice recording
ts3client_systemset3DListenerAttributes, 3D Sound
ts3client_systemset3DSettings, 3D Sound
ts3client_unregisterCustomDevice, Using custom devices

N

narrowband, Sound codecs

R

return code, Return code

S

sampling rates, Sound codecs
Semi-permanent channel, Channel information
server connection handler, Managing server connection handlers
structs
TS3_VECTOR, 3D Sound
system requirements, System requirements

U

ultra-wideband, Sound codecs

V

VAD, Preprocessor options
Voice Activity Detection, Preprocessor options
volume_factor_wave, Playback options
volume_modifier, Playback options, How to adjust the volume?

W

welcome message, Connecting to a server
wideband, Sound codecs
Windows, System requirements
diff --git a/docs/client_html/ts3doc.css b/docs/client_html/ts3doc.css new file mode 100644 index 0000000..3ff2b6f --- /dev/null +++ b/docs/client_html/ts3doc.css @@ -0,0 +1,50 @@ +/* + * Stylesheet for TeamSpeak 3 SDK documentation + */ + +img { + border: 0; +} + +div.note { + border-left: solid #d5dee3 20px; + border-right: solid #d5dee3 20px; + margin-left: 5%; + margin-right: 10%; + padding: 5px; +} + +div.caution { + border-left: solid #d5dee3 20px; + border-right: solid #d5dee3 20px; + margin-left: 5%; + margin-right: 10%; + padding: 5px; +} + +div.important { + border-left: solid #d5dee3 20px; + border-right: solid #d5dee3 20px; + margin-left: 5%; + margin-right: 10%; + padding: 5px; +} + +.returnvalue { + font-family: monospace; + font-style: italic; + font-size: larger; +} + +p.legaltext { + font-size: 85%; +} + +p.larger { + font-size: 125%; +} + +#logo { + position: absolute; + left: 80%; +} diff --git a/include/plugin_definitions.h b/include/plugin_definitions.h new file mode 100644 index 0000000..104ac17 --- /dev/null +++ b/include/plugin_definitions.h @@ -0,0 +1,74 @@ +#ifndef PLUGIN_DEFINITIONS +#define PLUGIN_DEFINITIONS + +/* Return values for ts3plugin_offersConfigure */ +enum PluginConfigureOffer { + PLUGIN_OFFERS_NO_CONFIGURE = 0, /* Plugin does not implement ts3plugin_configure */ + PLUGIN_OFFERS_CONFIGURE_NEW_THREAD, /* Plugin does implement ts3plugin_configure and requests to run this function in an own thread */ + PLUGIN_OFFERS_CONFIGURE_QT_THREAD /* Plugin does implement ts3plugin_configure and requests to run this function in the Qt GUI thread */ +}; + +enum PluginMessageTarget { + PLUGIN_MESSAGE_TARGET_SERVER = 0, + PLUGIN_MESSAGE_TARGET_CHANNEL +}; + +enum PluginItemType { + PLUGIN_SERVER = 0, + PLUGIN_CHANNEL, + PLUGIN_CLIENT +}; + +enum PluginMenuType { + PLUGIN_MENU_TYPE_GLOBAL = 0, + PLUGIN_MENU_TYPE_CHANNEL, + PLUGIN_MENU_TYPE_CLIENT +}; + +#define PLUGIN_MENU_BUFSZ 128 + +struct PluginMenuItem { + enum PluginMenuType type; + int id; + char text[PLUGIN_MENU_BUFSZ]; + char icon[PLUGIN_MENU_BUFSZ]; +}; + +#define PLUGIN_HOTKEY_BUFSZ 128 + +struct PluginHotkey { + char keyword[PLUGIN_HOTKEY_BUFSZ]; + char description[PLUGIN_HOTKEY_BUFSZ]; +}; + +struct PluginBookmarkList; +struct PluginBookmarkItem { + char* name; + unsigned char isFolder; + unsigned char reserved[3]; + union{ + char* uuid; + struct PluginBookmarkList* folder; + }; +}; + +struct PluginBookmarkList{ + int itemcount; + struct PluginBookmarkItem items[1]; //should be 0 but compiler complains +}; + +enum PluginGuiProfile{ + PLUGIN_GUI_SOUND_CAPTURE = 0, + PLUGIN_GUI_SOUND_PLAYBACK, + PLUGIN_GUI_HOTKEY, + PLUGIN_GUI_SOUNDPACK, + PLUGIN_GUI_IDENTITY +}; + +enum PluginConnectTab{ + PLUGIN_CONNECT_TAB_NEW = 0, + PLUGIN_CONNECT_TAB_CURRENT, + PLUGIN_CONNECT_TAB_NEW_IF_CURRENT_CONNECTED +}; + +#endif diff --git a/include/teamlog/logtypes.h b/include/teamlog/logtypes.h new file mode 100644 index 0000000..fc53910 --- /dev/null +++ b/include/teamlog/logtypes.h @@ -0,0 +1,23 @@ +#ifndef TEAMLOG_LOGTYPES_H +#define TEAMLOG_LOGTYPES_H + +enum LogTypes { + LogType_NONE = 0x0000, + LogType_FILE = 0x0001, + LogType_CONSOLE = 0x0002, + LogType_USERLOGGING = 0x0004, + LogType_NO_NETLOGGING = 0x0008, + LogType_DATABASE = 0x0010, + LogType_SYSLOG = 0x0020, +}; + +enum LogLevel { + LogLevel_CRITICAL = 0, //these messages stop the program + LogLevel_ERROR, //everything that is really bad, but not so bad we need to shut down + LogLevel_WARNING, //everything that *might* be bad + LogLevel_DEBUG, //output that might help find a problem + LogLevel_INFO, //informational output, like "starting database version x.y.z" + LogLevel_DEVEL //developer only output (will not be displayed in release mode) +}; + +#endif //TEAMLOG_LOGTYPES_H diff --git a/include/teamspeak/clientlib_publicdefinitions.h b/include/teamspeak/clientlib_publicdefinitions.h new file mode 100644 index 0000000..d8b3c1f --- /dev/null +++ b/include/teamspeak/clientlib_publicdefinitions.h @@ -0,0 +1,24 @@ +#ifndef CLIENTLIB_PUBLICDEFINITIONS_H +#define CLIENTLIB_PUBLICDEFINITIONS_H + +enum Visibility { + ENTER_VISIBILITY = 0, + RETAIN_VISIBILITY, + LEAVE_VISIBILITY +}; + +enum ConnectStatus { + STATUS_DISCONNECTED = 0, //There is no activity to the server, this is the default value + STATUS_CONNECTING, //We are trying to connect, we haven't got a clientID yet, we haven't been accepted by the server + STATUS_CONNECTED, //The server has accepted us, we can talk and hear and we got a clientID, but we don't have the channels and clients yet, we can get server infos (welcome msg etc.) + STATUS_CONNECTION_ESTABLISHING,//we are CONNECTED and we are visible + STATUS_CONNECTION_ESTABLISHED, //we are CONNECTED and we have the client and channels available +}; + +enum LocalTestMode { + TEST_MODE_OFF = 0, + TEST_MODE_VOICE_LOCAL_ONLY = 1, + TEST_MODE_VOICE_LOCAL_AND_REMOTE = 2, +}; + +#endif //CLIENTLIB_PUBLICDEFINITIONS_H diff --git a/include/teamspeak/public_definitions.h b/include/teamspeak/public_definitions.h new file mode 100644 index 0000000..471dc71 --- /dev/null +++ b/include/teamspeak/public_definitions.h @@ -0,0 +1,391 @@ +#ifndef PUBLIC_DEFINITIONS_H +#define PUBLIC_DEFINITIONS_H + +#include "teamlog/logtypes.h" + +//limited length, measured in characters +#define TS3_MAX_SIZE_CHANNEL_NAME 40 +#define TS3_MAX_SIZE_VIRTUALSERVER_NAME 64 +#define TS3_MAX_SIZE_CLIENT_NICKNAME 64 +#define TS3_MIN_SIZE_CLIENT_NICKNAME 3 +#define TS3_MAX_SIZE_REASON_MESSAGE 80 + +//limited length, measured in bytes (utf8 encoded) +#define TS3_MAX_SIZE_TEXTMESSAGE 8192 +#define TS3_MAX_SIZE_CHANNEL_TOPIC 255 +#define TS3_MAX_SIZE_CHANNEL_DESCRIPTION 8192 +#define TS3_MAX_SIZE_VIRTUALSERVER_WELCOMEMESSAGE 1024 +#define TS3_SIZE_MYTSID 44 + +//minimum amount of seconds before a clientID that was in use can be assigned to a new client +#define TS3_MIN_SECONDS_CLIENTID_REUSE 300 + +#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) + typedef unsigned __int16 anyID; + typedef unsigned __int64 uint64; + #ifdef BUILDING_DLL + #define EXPORTDLL __declspec(dllexport) + #else + #define EXPORTDLL + #endif +#else + #include + typedef uint16_t anyID; + typedef uint64_t uint64; + #ifdef BUILDING_DLL + #define EXPORTDLL __attribute__ ((visibility("default"))) + #else + #define EXPORTDLL + #endif +#endif + +enum TalkStatus { + STATUS_NOT_TALKING = 0, + STATUS_TALKING = 1, + STATUS_TALKING_WHILE_DISABLED = 2, +}; + +enum CodecType { + CODEC_SPEEX_NARROWBAND = 0, //mono, 16bit, 8kHz, bitrate dependent on the quality setting + CODEC_SPEEX_WIDEBAND, //mono, 16bit, 16kHz, bitrate dependent on the quality setting + CODEC_SPEEX_ULTRAWIDEBAND, //mono, 16bit, 32kHz, bitrate dependent on the quality setting + CODEC_CELT_MONO, //mono, 16bit, 48kHz, bitrate dependent on the quality setting + CODEC_OPUS_VOICE, //mono, 16bit, 48khz, bitrate dependent on the quality setting, optimized for voice + CODEC_OPUS_MUSIC, //stereo, 16bit, 48khz, bitrate dependent on the quality setting, optimized for music +}; + +enum CodecEncryptionMode { + CODEC_ENCRYPTION_PER_CHANNEL = 0, + CODEC_ENCRYPTION_FORCED_OFF, + CODEC_ENCRYPTION_FORCED_ON, +}; + +enum TextMessageTargetMode { + TextMessageTarget_CLIENT=1, + TextMessageTarget_CHANNEL, + TextMessageTarget_SERVER, + TextMessageTarget_MAX +}; + +enum MuteInputStatus { + MUTEINPUT_NONE = 0, + MUTEINPUT_MUTED, +}; + +enum MuteOutputStatus { + MUTEOUTPUT_NONE = 0, + MUTEOUTPUT_MUTED, +}; + +enum HardwareInputStatus { + HARDWAREINPUT_DISABLED = 0, + HARDWAREINPUT_ENABLED, +}; + +enum HardwareOutputStatus { + HARDWAREOUTPUT_DISABLED = 0, + HARDWAREOUTPUT_ENABLED, +}; + +enum InputDeactivationStatus { + INPUT_ACTIVE = 0, + INPUT_DEACTIVATED = 1, +}; + +enum ReasonIdentifier { + REASON_NONE = 0, //no reason data + REASON_MOVED = 1, //{SectionInvoker} + REASON_SUBSCRIPTION = 2, //no reason data + REASON_LOST_CONNECTION = 3, //reasonmsg=reason + REASON_KICK_CHANNEL = 4, //{SectionInvoker} reasonmsg=reason //{SectionInvoker} is only added server->client + REASON_KICK_SERVER = 5, //{SectionInvoker} reasonmsg=reason //{SectionInvoker} is only added server->client + REASON_KICK_SERVER_BAN = 6, //{SectionInvoker} reasonmsg=reason bantime=time //{SectionInvoker} is only added server->client + REASON_SERVERSTOP = 7, //reasonmsg=reason + REASON_CLIENTDISCONNECT = 8, //reasonmsg=reason + REASON_CHANNELUPDATE = 9, //no reason data + REASON_CHANNELEDIT = 10, //{SectionInvoker} + REASON_CLIENTDISCONNECT_SERVER_SHUTDOWN = 11, //reasonmsg=reason +}; + +enum ChannelProperties { + CHANNEL_NAME = 0, //Available for all channels that are "in view", always up-to-date + CHANNEL_TOPIC, //Available for all channels that are "in view", always up-to-date + CHANNEL_DESCRIPTION, //Must be requested (=> requestChannelDescription) + CHANNEL_PASSWORD, //not available client side + CHANNEL_CODEC, //Available for all channels that are "in view", always up-to-date + CHANNEL_CODEC_QUALITY, //Available for all channels that are "in view", always up-to-date + CHANNEL_MAXCLIENTS, //Available for all channels that are "in view", always up-to-date + CHANNEL_MAXFAMILYCLIENTS, //Available for all channels that are "in view", always up-to-date + CHANNEL_ORDER, //Available for all channels that are "in view", always up-to-date + CHANNEL_FLAG_PERMANENT, //Available for all channels that are "in view", always up-to-date + CHANNEL_FLAG_SEMI_PERMANENT, //Available for all channels that are "in view", always up-to-date + CHANNEL_FLAG_DEFAULT, //Available for all channels that are "in view", always up-to-date + CHANNEL_FLAG_PASSWORD, //Available for all channels that are "in view", always up-to-date + CHANNEL_CODEC_LATENCY_FACTOR, //Available for all channels that are "in view", always up-to-date + CHANNEL_CODEC_IS_UNENCRYPTED, //Available for all channels that are "in view", always up-to-date + CHANNEL_SECURITY_SALT, //Not available client side, not used in teamspeak, only SDK. Sets the options+salt for security hash. + CHANNEL_DELETE_DELAY, //How many seconds to wait before deleting this channel + CHANNEL_ENDMARKER, +}; + +enum ClientProperties { + CLIENT_UNIQUE_IDENTIFIER = 0, //automatically up-to-date for any client "in view", can be used to identify this particular client installation + CLIENT_NICKNAME, //automatically up-to-date for any client "in view" + CLIENT_VERSION, //for other clients than ourself, this needs to be requested (=> requestClientVariables) + CLIENT_PLATFORM, //for other clients than ourself, this needs to be requested (=> requestClientVariables) + CLIENT_FLAG_TALKING, //automatically up-to-date for any client that can be heard (in room / whisper) + CLIENT_INPUT_MUTED, //automatically up-to-date for any client "in view", this clients microphone mute status + CLIENT_OUTPUT_MUTED, //automatically up-to-date for any client "in view", this clients headphones/speakers/mic combined mute status + CLIENT_OUTPUTONLY_MUTED, //automatically up-to-date for any client "in view", this clients headphones/speakers only mute status + CLIENT_INPUT_HARDWARE, //automatically up-to-date for any client "in view", this clients microphone hardware status (is the capture device opened?) + CLIENT_OUTPUT_HARDWARE, //automatically up-to-date for any client "in view", this clients headphone/speakers hardware status (is the playback device opened?) + CLIENT_INPUT_DEACTIVATED, //only usable for ourself, not propagated to the network + CLIENT_IDLE_TIME, //internal use + CLIENT_DEFAULT_CHANNEL, //only usable for ourself, the default channel we used to connect on our last connection attempt + CLIENT_DEFAULT_CHANNEL_PASSWORD, //internal use + CLIENT_SERVER_PASSWORD, //internal use + CLIENT_META_DATA, //automatically up-to-date for any client "in view", not used by TeamSpeak, free storage for sdk users + CLIENT_IS_MUTED, //only make sense on the client side locally, "1" if this client is currently muted by us, "0" if he is not + CLIENT_IS_RECORDING, //automatically up-to-date for any client "in view" + CLIENT_VOLUME_MODIFICATOR, //internal use + CLIENT_VERSION_SIGN, //sign + CLIENT_SECURITY_HASH, //SDK use, not used by teamspeak. Hash is provided by an outside source. A channel will use the security salt + other client data to calculate a hash, which must be the same as the one provided here. + CLIENT_ENCRYPTION_CIPHERS, //internal use + CLIENT_ENDMARKER, +}; + +enum VirtualServerProperties { + VIRTUALSERVER_UNIQUE_IDENTIFIER = 0, //available when connected, can be used to identify this particular server installation + VIRTUALSERVER_NAME, //available and always up-to-date when connected + VIRTUALSERVER_WELCOMEMESSAGE, //available when connected, (=> requestServerVariables) + VIRTUALSERVER_PLATFORM, //available when connected + VIRTUALSERVER_VERSION, //available when connected + VIRTUALSERVER_MAXCLIENTS, //only available on request (=> requestServerVariables), stores the maximum number of clients that may currently join the server + VIRTUALSERVER_PASSWORD, //not available to clients, the server password + VIRTUALSERVER_CLIENTS_ONLINE, //only available on request (=> requestServerVariables), + VIRTUALSERVER_CHANNELS_ONLINE, //only available on request (=> requestServerVariables), + VIRTUALSERVER_CREATED, //available when connected, stores the time when the server was created + VIRTUALSERVER_UPTIME, //only available on request (=> requestServerVariables), the time since the server was started + VIRTUALSERVER_CODEC_ENCRYPTION_MODE, //available and always up-to-date when connected + VIRTUALSERVER_ENCRYPTION_CIPHERS, //internal use + VIRTUALSERVER_ENDMARKER, +}; + +enum ConnectionProperties { + CONNECTION_PING = 0, //average latency for a round trip through and back this connection + CONNECTION_PING_DEVIATION, //standard deviation of the above average latency + CONNECTION_CONNECTED_TIME, //how long the connection exists already + CONNECTION_IDLE_TIME, //how long since the last action of this client + CONNECTION_CLIENT_IP, //IP of this client (as seen from the server side) + CONNECTION_CLIENT_PORT, //Port of this client (as seen from the server side) + CONNECTION_SERVER_IP, //IP of the server (seen from the client side) - only available on yourself, not for remote clients, not available server side + CONNECTION_SERVER_PORT, //Port of the server (seen from the client side) - only available on yourself, not for remote clients, not available server side + CONNECTION_PACKETS_SENT_SPEECH, //how many Speech packets were sent through this connection + CONNECTION_PACKETS_SENT_KEEPALIVE, + CONNECTION_PACKETS_SENT_CONTROL, + CONNECTION_PACKETS_SENT_TOTAL, //how many packets were sent totally (this is PACKETS_SENT_SPEECH + PACKETS_SENT_KEEPALIVE + PACKETS_SENT_CONTROL) + CONNECTION_BYTES_SENT_SPEECH, + CONNECTION_BYTES_SENT_KEEPALIVE, + CONNECTION_BYTES_SENT_CONTROL, + CONNECTION_BYTES_SENT_TOTAL, + CONNECTION_PACKETS_RECEIVED_SPEECH, + CONNECTION_PACKETS_RECEIVED_KEEPALIVE, + CONNECTION_PACKETS_RECEIVED_CONTROL, + CONNECTION_PACKETS_RECEIVED_TOTAL, + CONNECTION_BYTES_RECEIVED_SPEECH, + CONNECTION_BYTES_RECEIVED_KEEPALIVE, + CONNECTION_BYTES_RECEIVED_CONTROL, + CONNECTION_BYTES_RECEIVED_TOTAL, + CONNECTION_PACKETLOSS_SPEECH, + CONNECTION_PACKETLOSS_KEEPALIVE, + CONNECTION_PACKETLOSS_CONTROL, + CONNECTION_PACKETLOSS_TOTAL, //the probability with which a packet round trip failed because a packet was lost + CONNECTION_SERVER2CLIENT_PACKETLOSS_SPEECH, //the probability with which a speech packet failed from the server to the client + CONNECTION_SERVER2CLIENT_PACKETLOSS_KEEPALIVE, + CONNECTION_SERVER2CLIENT_PACKETLOSS_CONTROL, + CONNECTION_SERVER2CLIENT_PACKETLOSS_TOTAL, + CONNECTION_CLIENT2SERVER_PACKETLOSS_SPEECH, + CONNECTION_CLIENT2SERVER_PACKETLOSS_KEEPALIVE, + CONNECTION_CLIENT2SERVER_PACKETLOSS_CONTROL, + CONNECTION_CLIENT2SERVER_PACKETLOSS_TOTAL, + CONNECTION_BANDWIDTH_SENT_LAST_SECOND_SPEECH, //howmany bytes of speech packets we sent during the last second + CONNECTION_BANDWIDTH_SENT_LAST_SECOND_KEEPALIVE, + CONNECTION_BANDWIDTH_SENT_LAST_SECOND_CONTROL, + CONNECTION_BANDWIDTH_SENT_LAST_SECOND_TOTAL, + CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_SPEECH, //howmany bytes/s of speech packets we sent in average during the last minute + CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_KEEPALIVE, + CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_CONTROL, + CONNECTION_BANDWIDTH_SENT_LAST_MINUTE_TOTAL, + CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_SPEECH, + CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_KEEPALIVE, + CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_CONTROL, + CONNECTION_BANDWIDTH_RECEIVED_LAST_SECOND_TOTAL, + CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_SPEECH, + CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_KEEPALIVE, + CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_CONTROL, + CONNECTION_BANDWIDTH_RECEIVED_LAST_MINUTE_TOTAL, + CONNECTION_ENDMARKER, +}; + +typedef struct { + float x; /* X co-ordinate in 3D space. */ + float y; /* Y co-ordinate in 3D space. */ + float z; /* Z co-ordinate in 3D space. */ +} TS3_VECTOR; + +enum GroupWhisperType { + GROUPWHISPERTYPE_SERVERGROUP = 0, + GROUPWHISPERTYPE_CHANNELGROUP = 1, + GROUPWHISPERTYPE_CHANNELCOMMANDER = 2, + GROUPWHISPERTYPE_ALLCLIENTS = 3, + GROUPWHISPERTYPE_ENDMARKER, +}; + +enum GroupWhisperTargetMode { + GROUPWHISPERTARGETMODE_ALL = 0, + GROUPWHISPERTARGETMODE_CURRENTCHANNEL = 1, + GROUPWHISPERTARGETMODE_PARENTCHANNEL = 2, + GROUPWHISPERTARGETMODE_ALLPARENTCHANNELS = 3, + GROUPWHISPERTARGETMODE_CHANNELFAMILY = 4, + GROUPWHISPERTARGETMODE_ANCESTORCHANNELFAMILY = 5, + GROUPWHISPERTARGETMODE_SUBCHANNELS = 6, + GROUPWHISPERTARGETMODE_ENDMARKER, +}; + +enum MonoSoundDestination{ + MONO_SOUND_DESTINATION_ALL =0, /* Send mono sound to all available speakers */ + MONO_SOUND_DESTINATION_FRONT_CENTER =1, /* Send mono sound to front center speaker if available */ + MONO_SOUND_DESTINATION_FRONT_LEFT_AND_RIGHT =2 /* Send mono sound to front left/right speakers if available */ +}; + +enum SecuritySaltOptions { + SECURITY_SALT_CHECK_NICKNAME = 1, /* put nickname into security hash */ + SECURITY_SALT_CHECK_META_DATA = 2 /* put (game)meta data into security hash */ +}; + +/*this enum is used to disable client commands on the server*/ +enum ClientCommand{ + CLIENT_COMMAND_requestConnectionInfo = 0, + CLIENT_COMMAND_requestClientMove = 1, + CLIENT_COMMAND_requestXXMuteClients = 2, + CLIENT_COMMAND_requestClientKickFromXXX = 3, + CLIENT_COMMAND_flushChannelCreation = 4, + CLIENT_COMMAND_flushChannelUpdates = 5, + CLIENT_COMMAND_requestChannelMove = 6, + CLIENT_COMMAND_requestChannelDelete = 7, + CLIENT_COMMAND_requestChannelDescription = 8, + CLIENT_COMMAND_requestChannelXXSubscribeXXX = 9, + CLIENT_COMMAND_requestServerConnectionInfo = 10, + CLIENT_COMMAND_requestSendXXXTextMsg = 11, + CLIENT_COMMAND_filetransfers = 12, + CLIENT_COMMAND_ENDMARKER +}; + +/* Access Control List*/ +enum ACLType{ + ACL_NONE = 0, + ACL_WHITE_LIST = 1, + ACL_BLACK_LIST = 2 +}; + +/* file transfer actions*/ +enum FTAction{ + FT_INIT_SERVER = 0, + FT_INIT_CHANNEL = 1, + FT_UPLOAD = 2, + FT_DOWNLOAD = 3, + FT_DELETE = 4, + FT_CREATEDIR = 5, + FT_RENAME = 6, + FT_FILELIST = 7, + FT_FILEINFO = 8 +}; + +/* file transfer status */ +enum FileTransferState { + FILETRANSFER_INITIALISING = 0, + FILETRANSFER_ACTIVE, + FILETRANSFER_FINISHED, +}; + +/* file transfer types */ +enum { + FileListType_Directory = 0, + FileListType_File, +}; + +/* some structs to handle variables in callbacks */ +#define MAX_VARIABLES_EXPORT_COUNT 64 +struct VariablesExportItem{ + unsigned char itemIsValid; /* This item has valid values. ignore this item if 0 */ + unsigned char proposedIsSet; /* The value in proposed is set. if 0 ignore proposed */ + const char* current; /* current value (stored in memory) */ + const char* proposed; /* New value to change to (const, so no updates please) */ +}; + +struct VariablesExport{ + struct VariablesExportItem items[MAX_VARIABLES_EXPORT_COUNT]; +}; + +struct ClientMiniExport{ + anyID ID; + uint64 channel; + const char* ident; + const char* nickname; +}; + +struct TransformFilePathExport{ + uint64 channel; + const char* filename; + int action; + int transformedFileNameMaxSize; + int channelPathMaxSize; +}; + +struct TransformFilePathExportReturns{ + char* transformedFileName; + char* channelPath; + int logFileAction; +}; + +struct FileTransferCallbackExport{ + anyID clientID; + anyID transferID; + anyID remoteTransferID; + unsigned int status; + const char* statusMessage; + uint64 remotefileSize; + uint64 bytes; + int isSender; +}; + +/*define for file transfer bandwith limits*/ +#define BANDWIDTH_LIMIT_UNLIMITED 0xFFFFFFFFFFFFFFFFll + + +/*defines for speaker locations used by some sound callbacks*/ +#ifndef SPEAKER_FRONT_LEFT +#define SPEAKER_FRONT_LEFT 0x1 +#define SPEAKER_FRONT_RIGHT 0x2 +#define SPEAKER_FRONT_CENTER 0x4 +#define SPEAKER_LOW_FREQUENCY 0x8 +#define SPEAKER_BACK_LEFT 0x10 +#define SPEAKER_BACK_RIGHT 0x20 +#define SPEAKER_FRONT_LEFT_OF_CENTER 0x40 +#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80 +#define SPEAKER_BACK_CENTER 0x100 +#define SPEAKER_SIDE_LEFT 0x200 +#define SPEAKER_SIDE_RIGHT 0x400 +#define SPEAKER_TOP_CENTER 0x800 +#define SPEAKER_TOP_FRONT_LEFT 0x1000 +#define SPEAKER_TOP_FRONT_CENTER 0x2000 +#define SPEAKER_TOP_FRONT_RIGHT 0x4000 +#define SPEAKER_TOP_BACK_LEFT 0x8000 +#define SPEAKER_TOP_BACK_CENTER 0x10000 +#define SPEAKER_TOP_BACK_RIGHT 0x20000 +#endif +#define SPEAKER_HEADPHONES_LEFT 0x10000000 +#define SPEAKER_HEADPHONES_RIGHT 0x20000000 +#define SPEAKER_MONO 0x40000000 + +#endif /*PUBLIC_DEFINITIONS_H*/ diff --git a/include/teamspeak/public_errors.h b/include/teamspeak/public_errors.h new file mode 100644 index 0000000..0659d3d --- /dev/null +++ b/include/teamspeak/public_errors.h @@ -0,0 +1,194 @@ +#ifndef PUBLIC_ERRORS_H +#define PUBLIC_ERRORS_H + +//The idea here is: the values are 2 bytes wide, the first byte identifies the group, the second the count within that group + +enum Ts3ErrorType { + //general + ERROR_ok = 0x0000, + ERROR_undefined = 0x0001, + ERROR_not_implemented = 0x0002, + ERROR_ok_no_update = 0x0003, + ERROR_dont_notify = 0x0004, + ERROR_lib_time_limit_reached = 0x0005, + ERROR_out_of_memory = 0x0006, + ERROR_canceled = 0x0007, + + //dunno + ERROR_command_not_found = 0x0100, + ERROR_unable_to_bind_network_port = 0x0101, + ERROR_no_network_port_available = 0x0102, + ERROR_port_already_in_use = 0x0103, + + //client + ERROR_client_invalid_id = 0x0200, + ERROR_client_nickname_inuse = 0x0201, + ERROR_client_protocol_limit_reached = 0x0203, + ERROR_client_invalid_type = 0x0204, + ERROR_client_already_subscribed = 0x0205, + ERROR_client_not_logged_in = 0x0206, + ERROR_client_could_not_validate_identity = 0x0207, + ERROR_client_version_outdated = 0x020a, + ERROR_client_is_flooding = 0x020c, + ERROR_client_hacked = 0x020d, + ERROR_client_cannot_verify_now = 0x020e, + ERROR_client_login_not_permitted = 0x020f, + ERROR_client_not_subscribed = 0x0210, + + //channel + ERROR_channel_invalid_id = 0x0300, + ERROR_channel_protocol_limit_reached = 0x0301, + ERROR_channel_already_in = 0x0302, + ERROR_channel_name_inuse = 0x0303, + ERROR_channel_not_empty = 0x0304, + ERROR_channel_can_not_delete_default = 0x0305, + ERROR_channel_default_require_permanent = 0x0306, + ERROR_channel_invalid_flags = 0x0307, + ERROR_channel_parent_not_permanent = 0x0308, + ERROR_channel_maxclients_reached = 0x0309, + ERROR_channel_maxfamily_reached = 0x030a, + ERROR_channel_invalid_order = 0x030b, + ERROR_channel_no_filetransfer_supported = 0x030c, + ERROR_channel_invalid_password = 0x030d, + ERROR_channel_invalid_security_hash = 0x030f, //note 0x030e is defined in public_rare_errors; + + //server + ERROR_server_invalid_id = 0x0400, + ERROR_server_running = 0x0401, + ERROR_server_is_shutting_down = 0x0402, + ERROR_server_maxclients_reached = 0x0403, + ERROR_server_invalid_password = 0x0404, + ERROR_server_is_virtual = 0x0407, + ERROR_server_is_not_running = 0x0409, + ERROR_server_is_booting = 0x040a, + ERROR_server_status_invalid = 0x040b, + ERROR_server_version_outdated = 0x040d, + ERROR_server_duplicate_running = 0x040e, + + //parameter + ERROR_parameter_quote = 0x0600, + ERROR_parameter_invalid_count = 0x0601, + ERROR_parameter_invalid = 0x0602, + ERROR_parameter_not_found = 0x0603, + ERROR_parameter_convert = 0x0604, + ERROR_parameter_invalid_size = 0x0605, + ERROR_parameter_missing = 0x0606, + ERROR_parameter_checksum = 0x0607, + + //unsorted, need further investigation + ERROR_vs_critical = 0x0700, + ERROR_connection_lost = 0x0701, + ERROR_not_connected = 0x0702, + ERROR_no_cached_connection_info = 0x0703, + ERROR_currently_not_possible = 0x0704, + ERROR_failed_connection_initialisation = 0x0705, + ERROR_could_not_resolve_hostname = 0x0706, + ERROR_invalid_server_connection_handler_id = 0x0707, + ERROR_could_not_initialise_input_manager = 0x0708, + ERROR_clientlibrary_not_initialised = 0x0709, + ERROR_serverlibrary_not_initialised = 0x070a, + ERROR_whisper_too_many_targets = 0x070b, + ERROR_whisper_no_targets = 0x070c, + ERROR_connection_ip_protocol_missing = 0x070d, + //reserved = 0x070e, + ERROR_illegal_server_license = 0x070f, + + //file transfer + ERROR_file_invalid_name = 0x0800, + ERROR_file_invalid_permissions = 0x0801, + ERROR_file_already_exists = 0x0802, + ERROR_file_not_found = 0x0803, + ERROR_file_io_error = 0x0804, + ERROR_file_invalid_transfer_id = 0x0805, + ERROR_file_invalid_path = 0x0806, + ERROR_file_no_files_available = 0x0807, + ERROR_file_overwrite_excludes_resume = 0x0808, + ERROR_file_invalid_size = 0x0809, + ERROR_file_already_in_use = 0x080a, + ERROR_file_could_not_open_connection = 0x080b, + ERROR_file_no_space_left_on_device = 0x080c, + ERROR_file_exceeds_file_system_maximum_size = 0x080d, + ERROR_file_transfer_connection_timeout = 0x080e, + ERROR_file_connection_lost = 0x080f, + ERROR_file_exceeds_supplied_size = 0x0810, + ERROR_file_transfer_complete = 0x0811, + ERROR_file_transfer_canceled = 0x0812, + ERROR_file_transfer_interrupted = 0x0813, + ERROR_file_transfer_server_quota_exceeded = 0x0814, + ERROR_file_transfer_client_quota_exceeded = 0x0815, + ERROR_file_transfer_reset = 0x0816, + ERROR_file_transfer_limit_reached = 0x0817, + + //sound + ERROR_sound_preprocessor_disabled = 0x0900, + ERROR_sound_internal_preprocessor = 0x0901, + ERROR_sound_internal_encoder = 0x0902, + ERROR_sound_internal_playback = 0x0903, + ERROR_sound_no_capture_device_available = 0x0904, + ERROR_sound_no_playback_device_available = 0x0905, + ERROR_sound_could_not_open_capture_device = 0x0906, + ERROR_sound_could_not_open_playback_device = 0x0907, + ERROR_sound_handler_has_device = 0x0908, + ERROR_sound_invalid_capture_device = 0x0909, + ERROR_sound_invalid_playback_device = 0x090a, + ERROR_sound_invalid_wave = 0x090b, + ERROR_sound_unsupported_wave = 0x090c, + ERROR_sound_open_wave = 0x090d, + ERROR_sound_internal_capture = 0x090e, + ERROR_sound_device_in_use = 0x090f, + ERROR_sound_device_already_registerred = 0x0910, + ERROR_sound_unknown_device = 0x0911, + ERROR_sound_unsupported_frequency = 0x0912, + ERROR_sound_invalid_channel_count = 0x0913, + ERROR_sound_read_wave = 0x0914, + ERROR_sound_need_more_data = 0x0915, //for internal purposes only + ERROR_sound_device_busy = 0x0916, //for internal purposes only + ERROR_sound_no_data = 0x0917, + ERROR_sound_channel_mask_mismatch = 0x0918, + + + //permissions + ERROR_permissions_client_insufficient = 0x0a08, + ERROR_permissions = 0x0a0c, + + //accounting + ERROR_accounting_virtualserver_limit_reached = 0x0b00, + ERROR_accounting_slot_limit_reached = 0x0b01, + ERROR_accounting_license_file_not_found = 0x0b02, + ERROR_accounting_license_date_not_ok = 0x0b03, + ERROR_accounting_unable_to_connect_to_server = 0x0b04, + ERROR_accounting_unknown_error = 0x0b05, + ERROR_accounting_server_error = 0x0b06, + ERROR_accounting_instance_limit_reached = 0x0b07, + ERROR_accounting_instance_check_error = 0x0b08, + ERROR_accounting_license_file_invalid = 0x0b09, + ERROR_accounting_running_elsewhere = 0x0b0a, + ERROR_accounting_instance_duplicated = 0x0b0b, + ERROR_accounting_already_started = 0x0b0c, + ERROR_accounting_not_started = 0x0b0d, + ERROR_accounting_to_many_starts = 0x0b0e, + + //provisioning server + ERROR_provisioning_invalid_password = 0x1100, + ERROR_provisioning_invalid_request = 0x1101, + ERROR_provisioning_no_slots_available = 0x1102, + ERROR_provisioning_pool_missing = 0x1103, + ERROR_provisioning_pool_unknown = 0x1104, + ERROR_provisioning_unknown_ip_location = 0x1105, + ERROR_provisioning_internal_tries_exceeded = 0x1106, + ERROR_provisioning_too_many_slots_requested = 0x1107, + ERROR_provisioning_too_many_reserved = 0x1108, + ERROR_provisioning_could_not_connect = 0x1109, + ERROR_provisioning_auth_server_not_connected = 0x1110, + ERROR_provisioning_auth_data_too_large = 0x1111, + ERROR_provisioning_already_initialized = 0x1112, + ERROR_provisioning_not_initialized = 0x1113, + ERROR_provisioning_connecting = 0x1114, + ERROR_provisioning_already_connected = 0x1115, + ERROR_provisioning_not_connected = 0x1116, + ERROR_provisioning_io_error = 0x1117, + ERROR_provisioning_invalid_timeout = 0x1118, + ERROR_provisioning_ts3server_not_found = 0x1119, + ERROR_provisioning_no_permission = 0x111A, +}; +#endif diff --git a/include/teamspeak/public_errors_rare.h b/include/teamspeak/public_errors_rare.h new file mode 100644 index 0000000..82eb5d5 --- /dev/null +++ b/include/teamspeak/public_errors_rare.h @@ -0,0 +1,97 @@ +#ifndef PUBLIC_ERRORS__RARE_H +#define PUBLIC_ERRORS__RARE_H + +//The idea here is: the values are 2 bytes wide, the first byte identifies the group, the second the count within that group + +enum Ts3RareErrorType { + //client + ERROR_client_invalid_password = 0x0208, + ERROR_client_too_many_clones_connected = 0x0209, + ERROR_client_is_online = 0x020b, + + //channel + ERROR_channel_is_private_channel = 0x030e, + //note 0x030f is defined in public_errors; + + //database + ERROR_database = 0x0500, + ERROR_database_empty_result = 0x0501, + ERROR_database_duplicate_entry = 0x0502, + ERROR_database_no_modifications = 0x0503, + ERROR_database_constraint = 0x0504, + ERROR_database_reinvoke = 0x0505, + + //permissions + ERROR_permission_invalid_group_id = 0x0a00, + ERROR_permission_duplicate_entry = 0x0a01, + ERROR_permission_invalid_perm_id = 0x0a02, + ERROR_permission_empty_result = 0x0a03, + ERROR_permission_default_group_forbidden = 0x0a04, + ERROR_permission_invalid_size = 0x0a05, + ERROR_permission_invalid_value = 0x0a06, + ERROR_permissions_group_not_empty = 0x0a07, + ERROR_permissions_insufficient_group_power = 0x0a09, + ERROR_permissions_insufficient_permission_power = 0x0a0a, + ERROR_permission_template_group_is_used = 0x0a0b, + //0x0a0c is in public_errors.h + ERROR_permission_used_by_integration = 0x0a0d, + + //server + ERROR_server_deployment_active = 0x0405, + ERROR_server_unable_to_stop_own_server = 0x0406, + ERROR_server_wrong_machineid = 0x0408, + ERROR_server_modal_quit = 0x040c, + ERROR_server_time_difference_too_large = 0x040f, + ERROR_server_blacklisted = 0x0410, + + //messages + ERROR_message_invalid_id = 0x0c00, + + //ban + ERROR_ban_invalid_id = 0x0d00, + ERROR_connect_failed_banned = 0x0d01, + ERROR_rename_failed_banned = 0x0d02, + ERROR_ban_flooding = 0x0d03, + + //tts + ERROR_tts_unable_to_initialize = 0x0e00, + + //privilege key + ERROR_privilege_key_invalid = 0x0f00, + + //voip + ERROR_voip_pjsua = 0x1000, + ERROR_voip_already_initialized = 0x1001, + ERROR_voip_too_many_accounts = 0x1002, + ERROR_voip_invalid_account = 0x1003, + ERROR_voip_internal_error = 0x1004, + ERROR_voip_invalid_connectionId = 0x1005, + ERROR_voip_cannot_answer_initiated_call = 0x1006, + ERROR_voip_not_initialized = 0x1007, + + //ed25519 + ERROR_ed25519_rng_fail = 0x1300, + ERROR_ed25519_signature_invalid = 0x1301, + ERROR_ed25519_invalid_key = 0x1302, + ERROR_ed25519_unable_to_create_valid_key = 0x1303, + ERROR_ed25519_out_of_memory = 0x1304, + ERROR_ed25519_exists = 0x1305, + ERROR_ed25519_read_beyond_eof = 0x1306, + ERROR_ed25519_write_beyond_eof = 0x1307, + ERROR_ed25519_version = 0x1308, + ERROR_ed25519_invalid = 0x1309, + ERROR_ed25519_invalid_date = 0x130A, + ERROR_ed25519_unauthorized = 0x130B, + ERROR_ed25519_invalid_type = 0x130C, + ERROR_ed25519_address_nomatch = 0x130D, + ERROR_ed25519_not_valid_yet = 0x130E, + ERROR_ed25519_expired = 0x130F, + ERROR_ed25519_index_out_of_range = 0x1310, + ERROR_ed25519_invalid_size = 0x1311, + + //mytsid - client + ERROR_invalid_mytsid_data = 0x1200, + ERROR_invalid_integration = 0x1201, +}; + +#endif diff --git a/include/teamspeak/public_rare_definitions.h b/include/teamspeak/public_rare_definitions.h new file mode 100644 index 0000000..86c09a9 --- /dev/null +++ b/include/teamspeak/public_rare_definitions.h @@ -0,0 +1,359 @@ +#ifndef PUBLIC_RARE_DEFINITIONS_H +#define PUBLIC_RARE_DEFINITIONS_H + +#include "public_definitions.h" + +//limited length, measured in characters +#define TS3_MAX_SIZE_CLIENT_NICKNAME_NONSDK 30 +#define TS3_MIN_SIZE_CLIENT_NICKNAME_NONSDK 3 +#define TS3_MAX_SIZE_AWAY_MESSAGE 80 +#define TS3_MAX_SIZE_GROUP_NAME 30 +#define TS3_MAX_SIZE_TALK_REQUEST_MESSAGE 50 +#define TS3_MAX_SIZE_COMPLAIN_MESSAGE 200 +#define TS3_MAX_SIZE_CLIENT_DESCRIPTION 200 +#define TS3_MAX_SIZE_HOST_MESSAGE 200 +#define TS3_MAX_SIZE_HOSTBUTTON_TOOLTIP 50 +#define TS3_MAX_SIZE_POKE_MESSAGE 100 +#define TS3_MAX_SIZE_OFFLINE_MESSAGE 4096 +#define TS3_MAX_SIZE_OFFLINE_MESSAGE_SUBJECT 200 + +//limited length, measured in bytes (utf8 encoded) +#define TS3_MAX_SIZE_PLUGIN_COMMAND 1024*8 +#define TS3_MAX_SIZE_VIRTUALSERVER_HOSTBANNER_GFX_URL 2000 + + +enum GroupShowNameTreeMode { + GroupShowNameTreeMode_NONE= 0, //dont group show name + GroupShowNameTreeMode_BEFORE, //show group name before client name + GroupShowNameTreeMode_BEHIND //show group name behind client name +}; + +enum PluginTargetMode { + PluginCommandTarget_CURRENT_CHANNEL=0, //send plugincmd to all clients in current channel + PluginCommandTarget_SERVER, //send plugincmd to all clients on server + PluginCommandTarget_CLIENT, //send plugincmd to all given client ids + PluginCommandTarget_CURRENT_CHANNEL_SUBSCRIBED_CLIENTS, //send plugincmd to all subscribed clients in current channel + PluginCommandTarget_MAX +}; + +enum { + SERVER_BINDING_VIRTUALSERVER=0, + SERVER_BINDING_SERVERQUERY =1, + SERVER_BINDING_FILETRANSFER =2, +}; + +enum HostMessageMode { + HostMessageMode_NONE=0, //dont display anything + HostMessageMode_LOG, //display message inside log + HostMessageMode_MODAL, //display message inside a modal dialog + HostMessageMode_MODALQUIT //display message inside a modal dialog and quit/close server/connection +}; + +enum HostBannerMode { + HostBannerMode_NO_ADJUST=0, //Do not adjust + HostBannerMode_ADJUST_IGNORE_ASPECT, //Adjust but ignore aspect ratio + HostBannerMode_ADJUST_KEEP_ASPECT, //Adjust and keep aspect ratio +}; + +enum ClientType { + ClientType_NORMAL = 0, + ClientType_SERVERQUERY, +}; + +enum AwayStatus { + AWAY_NONE = 0, + AWAY_ZZZ, +}; + +enum CommandLinePropertiesRare { +#ifdef SERVER + COMMANDLINE_CREATE_DEFAULT_VIRTUALSERVER= 0, //create default virtualserver + COMMANDLINE_MACHINE_ID, //machine id (starts only virtualserver with given machineID + COMMANDLINE_DEFAULT_VOICE_PORT, + COMMANDLINE_VOICE_IP, + COMMANDLINE_THREADS_VOICE_UDP, + COMMANDLINE_LICENSEPATH, +#ifndef SDK + COMMANDLINE_FILETRANSFER_PORT, + COMMANDLINE_FILETRANSFER_IP, + COMMANDLINE_QUERY_PORT, + COMMANDLINE_QUERY_IP, + COMMANDLINE_QUERY_IP_WHITELIST, + COMMANDLINE_QUERY_IP_BLACKLIST, + COMMANDLINE_CLEAR_DATABASE, + COMMANDLINE_SERVERADMIN_PASSWORD, + COMMANDLINE_DBPLUGIN, + COMMANDLINE_DBPLUGINPARAMETER, + COMMANDLINE_DBSQLPATH, + COMMANDLINE_DBSQLCREATEPATH, + COMMANDLINE_DBCONNECTIONS, + COMMANDLINE_LOGPATH, + COMMANDLINE_CREATEINIFILE, + COMMANDLINE_INIFILE, + COMMANDLINE_LOGQUERYCOMMANDS, + COMMANDLINE_DBCLIENTKEEPDAYS, + COMMANDLINE_NO_PERMISSION_UPDATE, + COMMANDLINE_OPEN_WIN_CONSOLE, + COMMANDLINE_NO_PASSWORD_DIALOG, + COMMANDLINE_LOGAPPEND, + COMMANDLINE_QUERY_SKIPBRUTEFORCECHECK, + COMMANDLINE_QUERY_BUFFER_MB, + COMMANDLINE_HTTP_PROXY, + COMMANDLINE_LICENSE_ACCEPTED, + COMMANDLINE_SERVERQUERYDOCS_PATH, + COMMANDLINE_QUERY_SSH_IP, + COMMANDLINE_QUERY_SSH_PORT, + COMMANDLINE_QUERY_PROTOCOLS, + COMMANDLINE_QUERY_SSH_RSA_HOST_KEY, + COMMANDLINE_QUERY_TIMEOUT, + COMMANDLINE_VERSION, + COMMANDLINE_CRASHDUMPSPATH, + COMMANDLINE_DAEMON, + COMMANDLINE_PID_FILE, +#endif +#else + COMMANDLINE_NOTHING=0, +#endif + COMMANDLINE_ENDMARKER_RARE, +}; + +enum ServerInstancePropertiesRare { + SERVERINSTANCE_DATABASE_VERSION= 0, + SERVERINSTANCE_FILETRANSFER_PORT, + SERVERINSTANCE_SERVER_ENTROPY, + SERVERINSTANCE_MONTHLY_TIMESTAMP, + SERVERINSTANCE_MAX_DOWNLOAD_TOTAL_BANDWIDTH, + SERVERINSTANCE_MAX_UPLOAD_TOTAL_BANDWIDTH, + SERVERINSTANCE_GUEST_SERVERQUERY_GROUP, + SERVERINSTANCE_SERVERQUERY_FLOOD_COMMANDS, //how many commands we can issue while in the SERVERINSTANCE_SERVERQUERY_FLOOD_TIME window + SERVERINSTANCE_SERVERQUERY_FLOOD_TIME, //time window in seconds for max command execution check + SERVERINSTANCE_SERVERQUERY_BAN_TIME, //how many seconds someone get banned if he floods + SERVERINSTANCE_TEMPLATE_SERVERADMIN_GROUP, + SERVERINSTANCE_TEMPLATE_SERVERDEFAULT_GROUP, + SERVERINSTANCE_TEMPLATE_CHANNELADMIN_GROUP, + SERVERINSTANCE_TEMPLATE_CHANNELDEFAULT_GROUP, + SERVERINSTANCE_PERMISSIONS_VERSION, + SERVERINSTANCE_PENDING_CONNECTIONS_PER_IP, + SERVERINSTANCE_SERVERQUERY_MAX_CONNECTIONS_PER_IP, + SERVERINSTANCE_ENDMARKER_RARE, +}; + +enum VirtualServerPropertiesRare { + VIRTUALSERVER_DUMMY_1 = VIRTUALSERVER_ENDMARKER, + VIRTUALSERVER_DUMMY_2, + VIRTUALSERVER_DUMMY_3, + VIRTUALSERVER_DUMMY_4, + VIRTUALSERVER_DUMMY_5, + VIRTUALSERVER_DUMMY_6, + VIRTUALSERVER_DUMMY_7, + VIRTUALSERVER_DUMMY_8, + VIRTUALSERVER_KEYPAIR, //internal use + VIRTUALSERVER_HOSTMESSAGE, //available when connected, not updated while connected + VIRTUALSERVER_HOSTMESSAGE_MODE, //available when connected, not updated while connected + VIRTUALSERVER_FILEBASE, //not available to clients, stores the folder used for file transfers + VIRTUALSERVER_DEFAULT_SERVER_GROUP, //the client permissions server group that a new client gets assigned + VIRTUALSERVER_DEFAULT_CHANNEL_GROUP, //the channel permissions group that a new client gets assigned when joining a channel + VIRTUALSERVER_FLAG_PASSWORD, //only available on request (=> requestServerVariables) + VIRTUALSERVER_DEFAULT_CHANNEL_ADMIN_GROUP, //the channel permissions group that a client gets assigned when creating a channel + VIRTUALSERVER_MAX_DOWNLOAD_TOTAL_BANDWIDTH, //only available on request (=> requestServerVariables) + VIRTUALSERVER_MAX_UPLOAD_TOTAL_BANDWIDTH, //only available on request (=> requestServerVariables) + VIRTUALSERVER_HOSTBANNER_URL, //available when connected, always up-to-date + VIRTUALSERVER_HOSTBANNER_GFX_URL, //available when connected, always up-to-date + VIRTUALSERVER_HOSTBANNER_GFX_INTERVAL, //available when connected, always up-to-date + VIRTUALSERVER_COMPLAIN_AUTOBAN_COUNT, //only available on request (=> requestServerVariables) + VIRTUALSERVER_COMPLAIN_AUTOBAN_TIME, //only available on request (=> requestServerVariables) + VIRTUALSERVER_COMPLAIN_REMOVE_TIME, //only available on request (=> requestServerVariables) + VIRTUALSERVER_MIN_CLIENTS_IN_CHANNEL_BEFORE_FORCED_SILENCE,//only available on request (=> requestServerVariables) + VIRTUALSERVER_PRIORITY_SPEAKER_DIMM_MODIFICATOR, //available when connected, always up-to-date + VIRTUALSERVER_ID, //available when connected + VIRTUALSERVER_ANTIFLOOD_POINTS_TICK_REDUCE, //only available on request (=> requestServerVariables) + VIRTUALSERVER_ANTIFLOOD_POINTS_NEEDED_COMMAND_BLOCK, //only available on request (=> requestServerVariables) + VIRTUALSERVER_ANTIFLOOD_POINTS_NEEDED_IP_BLOCK, //only available on request (=> requestServerVariables) + VIRTUALSERVER_CLIENT_CONNECTIONS, //only available on request (=> requestServerVariables) + VIRTUALSERVER_QUERY_CLIENT_CONNECTIONS, //only available on request (=> requestServerVariables) + VIRTUALSERVER_HOSTBUTTON_TOOLTIP, //available when connected, always up-to-date + VIRTUALSERVER_HOSTBUTTON_URL, //available when connected, always up-to-date + VIRTUALSERVER_HOSTBUTTON_GFX_URL, //available when connected, always up-to-date + VIRTUALSERVER_QUERYCLIENTS_ONLINE, //only available on request (=> requestServerVariables) + VIRTUALSERVER_DOWNLOAD_QUOTA, //only available on request (=> requestServerVariables) + VIRTUALSERVER_UPLOAD_QUOTA, //only available on request (=> requestServerVariables) + VIRTUALSERVER_MONTH_BYTES_DOWNLOADED, //only available on request (=> requestServerVariables) + VIRTUALSERVER_MONTH_BYTES_UPLOADED, //only available on request (=> requestServerVariables) + VIRTUALSERVER_TOTAL_BYTES_DOWNLOADED, //only available on request (=> requestServerVariables) + VIRTUALSERVER_TOTAL_BYTES_UPLOADED, //only available on request (=> requestServerVariables) + VIRTUALSERVER_PORT, //only available on request (=> requestServerVariables) + VIRTUALSERVER_AUTOSTART, //only available on request (=> requestServerVariables) + VIRTUALSERVER_MACHINE_ID, //only available on request (=> requestServerVariables) + VIRTUALSERVER_NEEDED_IDENTITY_SECURITY_LEVEL, //only available on request (=> requestServerVariables) + VIRTUALSERVER_LOG_CLIENT, //only available on request (=> requestServerVariables) + VIRTUALSERVER_LOG_QUERY, //only available on request (=> requestServerVariables) + VIRTUALSERVER_LOG_CHANNEL, //only available on request (=> requestServerVariables) + VIRTUALSERVER_LOG_PERMISSIONS, //only available on request (=> requestServerVariables) + VIRTUALSERVER_LOG_SERVER, //only available on request (=> requestServerVariables) + VIRTUALSERVER_LOG_FILETRANSFER, //only available on request (=> requestServerVariables) + VIRTUALSERVER_MIN_CLIENT_VERSION, //only available on request (=> requestServerVariables) + VIRTUALSERVER_NAME_PHONETIC, //available when connected, always up-to-date + VIRTUALSERVER_ICON_ID, //available when connected, always up-to-date + VIRTUALSERVER_RESERVED_SLOTS, //available when connected, always up-to-date + VIRTUALSERVER_TOTAL_PACKETLOSS_SPEECH, //only available on request (=> requestServerVariables) + VIRTUALSERVER_TOTAL_PACKETLOSS_KEEPALIVE, //only available on request (=> requestServerVariables) + VIRTUALSERVER_TOTAL_PACKETLOSS_CONTROL, //only available on request (=> requestServerVariables) + VIRTUALSERVER_TOTAL_PACKETLOSS_TOTAL, //only available on request (=> requestServerVariables) + VIRTUALSERVER_TOTAL_PING, //only available on request (=> requestServerVariables) + VIRTUALSERVER_IP, //internal use | contains comma separated ip list + VIRTUALSERVER_WEBLIST_ENABLED, //only available on request (=> requestServerVariables) + VIRTUALSERVER_AUTOGENERATED_PRIVILEGEKEY, //internal use + VIRTUALSERVER_ASK_FOR_PRIVILEGEKEY, //available when connected + VIRTUALSERVER_HOSTBANNER_MODE, //available when connected, always up-to-date + VIRTUALSERVER_CHANNEL_TEMP_DELETE_DELAY_DEFAULT, //available when connected, always up-to-date + VIRTUALSERVER_MIN_ANDROID_VERSION, //only available on request (=> requestServerVariables) + VIRTUALSERVER_MIN_IOS_VERSION, //only available on request (=> requestServerVariables) + VIRTUALSERVER_MIN_WINPHONE_VERSION, //only available on request (=> requestServerVariables) + VIRTUALSERVER_NICKNAME, //available when connected, always up-to-date + VIRTUALSERVER_ACCOUNTING_TOKEN, //internal use | contains base64 encoded token data + VIRTUALSERVER_PROTOCOL_VERIFY_KEYPAIR, //internal use + VIRTUALSERVER_ANTIFLOOD_POINTS_NEEDED_PLUGIN_BLOCK, //only available on request (=> requestServerVariables) + VIRTUALSERVER_ENDMARKER_RARE +}; + +enum ChannelPropertiesRare { + CHANNEL_DUMMY_2= CHANNEL_ENDMARKER, + CHANNEL_DUMMY_3, + CHANNEL_DUMMY_4, + CHANNEL_DUMMY_5, + CHANNEL_DUMMY_6, + CHANNEL_DUMMY_7, + CHANNEL_FLAG_MAXCLIENTS_UNLIMITED, //Available for all channels that are "in view", always up-to-date + CHANNEL_FLAG_MAXFAMILYCLIENTS_UNLIMITED,//Available for all channels that are "in view", always up-to-date + CHANNEL_FLAG_MAXFAMILYCLIENTS_INHERITED,//Available for all channels that are "in view", always up-to-date + CHANNEL_FLAG_ARE_SUBSCRIBED, //Only available client side, stores whether we are subscribed to this channel + CHANNEL_FILEPATH, //not available client side, the folder used for file-transfers for this channel + CHANNEL_NEEDED_TALK_POWER, //Available for all channels that are "in view", always up-to-date + CHANNEL_FORCED_SILENCE, //Available for all channels that are "in view", always up-to-date + CHANNEL_NAME_PHONETIC, //Available for all channels that are "in view", always up-to-date + CHANNEL_ICON_ID, //Available for all channels that are "in view", always up-to-date + CHANNEL_BANNER_GFX_URL, //Available for all channels that are "in view", always up-to-date + CHANNEL_BANNER_MODE, //Available for all channels that are "in view", always up-to-date + CHANNEL_ENDMARKER_RARE, + CHANNEL_DELETE_DELAY_DEADLINE = 127 //(for clientlibv2) expected delete time in monotonic clock seconds or 0 if nothing is expected +}; + +enum ClientPropertiesRare { + CLIENT_DUMMY_4 = CLIENT_ENDMARKER, + CLIENT_DUMMY_5, + CLIENT_DUMMY_6, + CLIENT_DUMMY_7, + CLIENT_DUMMY_8, + CLIENT_DUMMY_9, + CLIENT_KEY_OFFSET, //internal use + CLIENT_LAST_VAR_REQUEST, //internal use + CLIENT_LOGIN_NAME, //used for serverquery clients, makes no sense on normal clients currently + CLIENT_LOGIN_PASSWORD, //used for serverquery clients, makes no sense on normal clients currently + CLIENT_DATABASE_ID, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds database client id + CLIENT_CHANNEL_GROUP_ID, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds database client id + CLIENT_SERVERGROUPS, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds all servergroups client belongs too + CLIENT_CREATED, //this needs to be requested (=> requestClientVariables), first time this client connected to this server + CLIENT_LASTCONNECTED, //this needs to be requested (=> requestClientVariables), last time this client connected to this server + CLIENT_TOTALCONNECTIONS, //this needs to be requested (=> requestClientVariables), how many times this client connected to this server + CLIENT_AWAY, //automatically up-to-date for any client "in view", this clients away status + CLIENT_AWAY_MESSAGE, //automatically up-to-date for any client "in view", this clients away message + CLIENT_TYPE, //automatically up-to-date for any client "in view", determines if this is a real client or a server-query connection + CLIENT_FLAG_AVATAR, //automatically up-to-date for any client "in view", this client got an avatar + CLIENT_TALK_POWER, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds database client id + CLIENT_TALK_REQUEST, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds timestamp where client requested to talk + CLIENT_TALK_REQUEST_MSG, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, holds matter for the request + CLIENT_DESCRIPTION, //automatically up-to-date for any client "in view" + CLIENT_IS_TALKER, //automatically up-to-date for any client "in view" + CLIENT_MONTH_BYTES_UPLOADED, //this needs to be requested (=> requestClientVariables) + CLIENT_MONTH_BYTES_DOWNLOADED, //this needs to be requested (=> requestClientVariables) + CLIENT_TOTAL_BYTES_UPLOADED, //this needs to be requested (=> requestClientVariables) + CLIENT_TOTAL_BYTES_DOWNLOADED, //this needs to be requested (=> requestClientVariables) + CLIENT_IS_PRIORITY_SPEAKER, //automatically up-to-date for any client "in view" + CLIENT_UNREAD_MESSAGES, //automatically up-to-date for any client "in view" + CLIENT_NICKNAME_PHONETIC, //automatically up-to-date for any client "in view" + CLIENT_NEEDED_SERVERQUERY_VIEW_POWER, //automatically up-to-date for any client "in view" + CLIENT_DEFAULT_TOKEN, //only usable for ourself, the default token we used to connect on our last connection attempt + CLIENT_ICON_ID, //automatically up-to-date for any client "in view" + CLIENT_IS_CHANNEL_COMMANDER, //automatically up-to-date for any client "in view" + CLIENT_COUNTRY, //automatically up-to-date for any client "in view" + CLIENT_CHANNEL_GROUP_INHERITED_CHANNEL_ID, //automatically up-to-date for any client "in view", only valid with PERMISSION feature, contains channel_id where the channel_group_id is set from + CLIENT_BADGES, //automatically up-to-date for any client "in view", stores icons for partner badges + CLIENT_MYTEAMSPEAK_ID, //automatically up-to-date for any client "in view", stores myteamspeak id + CLIENT_INTEGRATIONS, //automatically up-to-date for any client "in view", stores integrations + CLIENT_ACTIVE_INTEGRATIONS_INFO, //stores info from the myts server and contains the subscription info + CLIENT_MYTS_AVATAR, + CLIENT_SIGNED_BADGES, + CLIENT_ENDMARKER_RARE, + CLIENT_HW_ID = 127 //(for clientlibv2) unique hardware id +}; + +enum ConnectionPropertiesRare { + CONNECTION_DUMMY_0= CONNECTION_ENDMARKER, + CONNECTION_DUMMY_1, + CONNECTION_DUMMY_2, + CONNECTION_DUMMY_3, + CONNECTION_DUMMY_4, + CONNECTION_DUMMY_5, + CONNECTION_DUMMY_6, + CONNECTION_DUMMY_7, + CONNECTION_DUMMY_8, + CONNECTION_DUMMY_9, + CONNECTION_FILETRANSFER_BANDWIDTH_SENT, //how many bytes per second are currently being sent by file transfers + CONNECTION_FILETRANSFER_BANDWIDTH_RECEIVED, //how many bytes per second are currently being received by file transfers + CONNECTION_FILETRANSFER_BYTES_RECEIVED_TOTAL, //how many bytes we received in total through file transfers + CONNECTION_FILETRANSFER_BYTES_SENT_TOTAL, //how many bytes we sent in total through file transfers + CONNECTION_ENDMARKER_RARE, +}; + +enum BBCodeTags { + BBCodeTag_B = 0x00000001, + BBCodeTag_I = 0x00000002, + BBCodeTag_U = 0x00000004, + BBCodeTag_S = 0x00000008, + BBCodeTag_SUP = 0x00000010, + BBCodeTag_SUB = 0x00000020, + BBCodeTag_COLOR = 0x00000040, + BBCodeTag_SIZE = 0x00000080, + BBCodeTag_group_text = 0x000000FF, + + BBCodeTag_LEFT = 0x00001000, + BBCodeTag_RIGHT = 0x00002000, + BBCodeTag_CENTER = 0x00004000, + BBCodeTag_group_align = 0x00007000, + + BBCodeTag_URL = 0x00010000, + BBCodeTag_IMAGE = 0x00020000, + BBCodeTag_HR = 0x00040000, + + BBCodeTag_LIST = 0x00100000, + BBCodeTag_LISTITEM = 0x00200000, + BBCodeTag_group_list = 0x00300000, + + BBCodeTag_TABLE = 0x00400000, + BBCodeTag_TR = 0x00800000, + BBCodeTag_TH = 0x01000000, + BBCodeTag_TD = 0x02000000, + BBCodeTag_group_table = 0x03C00000, + + BBCodeTag_def_simple = BBCodeTag_B | BBCodeTag_I | BBCodeTag_U | BBCodeTag_S | BBCodeTag_SUP | BBCodeTag_SUB |BBCodeTag_COLOR | BBCodeTag_URL, + BBCodeTag_def_simple_Img = BBCodeTag_def_simple | BBCodeTag_IMAGE, + BBCodeTag_def_extended = BBCodeTag_group_text | BBCodeTag_group_align | BBCodeTag_URL | BBCodeTag_IMAGE | BBCodeTag_HR | BBCodeTag_group_list | BBCodeTag_group_table, +}; + +enum LicenseIssue { + Blacklisted = 0, + Greylisted +}; + +enum MytsDataUnsetFlags { + MytsDataUnsetFlag_None = 0, + MytsDataUnsetFlag_Badges = 1, + MytsDataUnsetFlag_Avatar = 1 << 1, + + MytsDataUnsetFlag_All = MytsDataUnsetFlag_Badges | MytsDataUnsetFlag_Avatar // make sure "all" really contains all flags +}; + +typedef int(*ExtraBBCodeValidator)(void* userparam, const char* tag, const char* paramValue, int paramValueSize, const char* childValue, int childValueSize); +typedef const char* (*ExtraBBCodeParamTransform)(void* userparam, const char* tag, const char* paramValue); + +#endif //PUBLIC_RARE_DEFINITIONS_H diff --git a/include/ts3_functions.h b/include/ts3_functions.h new file mode 100644 index 0000000..39236a1 --- /dev/null +++ b/include/ts3_functions.h @@ -0,0 +1,283 @@ +#ifndef TS3_FUNCTIONS_H +#define TS3_FUNCTIONS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "teamspeak/clientlib_publicdefinitions.h" +#include "teamspeak/public_definitions.h" +#include "plugin_definitions.h" + +/* Functions exported to plugin from main binary */ +struct TS3Functions { + unsigned int (*getClientLibVersion)(char** result); + unsigned int (*getClientLibVersionNumber)(uint64* result); + unsigned int (*spawnNewServerConnectionHandler)(int port, uint64* result); + unsigned int (*destroyServerConnectionHandler)(uint64 serverConnectionHandlerID); + + /* Error handling */ + unsigned int (*getErrorMessage)(unsigned int errorCode, char** error); + + /* Memory management */ + unsigned int (*freeMemory)(void* pointer); + + /* Logging */ + unsigned int (*logMessage)(const char* logMessage, enum LogLevel severity, const char* channel, uint64 logID); + + /* Sound */ + unsigned int (*getPlaybackDeviceList)(const char* modeID, char**** result); + unsigned int (*getPlaybackModeList)(char*** result); + unsigned int (*getCaptureDeviceList)(const char* modeID, char**** result); + unsigned int (*getCaptureModeList)(char*** result); + unsigned int (*getDefaultPlaybackDevice)(const char* modeID, char*** result); + unsigned int (*getDefaultPlayBackMode)(char** result); + unsigned int (*getDefaultCaptureDevice)(const char* modeID, char*** result); + unsigned int (*getDefaultCaptureMode)(char** result); + unsigned int (*openPlaybackDevice)(uint64 serverConnectionHandlerID, const char* modeID, const char* playbackDevice); + unsigned int (*openCaptureDevice)(uint64 serverConnectionHandlerID, const char* modeID, const char* captureDevice); + unsigned int (*getCurrentPlaybackDeviceName)(uint64 serverConnectionHandlerID, char** result, int* isDefault); + unsigned int (*getCurrentPlayBackMode)(uint64 serverConnectionHandlerID, char** result); + unsigned int (*getCurrentCaptureDeviceName)(uint64 serverConnectionHandlerID, char** result, int* isDefault); + unsigned int (*getCurrentCaptureMode)(uint64 serverConnectionHandlerID, char** result); + unsigned int (*initiateGracefulPlaybackShutdown)(uint64 serverConnectionHandlerID); + unsigned int (*closePlaybackDevice)(uint64 serverConnectionHandlerID); + unsigned int (*closeCaptureDevice)(uint64 serverConnectionHandlerID); + unsigned int (*activateCaptureDevice)(uint64 serverConnectionHandlerID); + unsigned int (*playWaveFileHandle)(uint64 serverConnectionHandlerID, const char* path, int loop, uint64* waveHandle); + unsigned int (*pauseWaveFileHandle)(uint64 serverConnectionHandlerID, uint64 waveHandle, int pause); + unsigned int (*closeWaveFileHandle)(uint64 serverConnectionHandlerID, uint64 waveHandle); + unsigned int (*playWaveFile)(uint64 serverConnectionHandlerID, const char* path); + unsigned int (*registerCustomDevice)(const char* deviceID, const char* deviceDisplayName, int capFrequency, int capChannels, int playFrequency, int playChannels); + unsigned int (*unregisterCustomDevice)(const char* deviceID); + unsigned int (*processCustomCaptureData)(const char* deviceName, const short* buffer, int samples); + unsigned int (*acquireCustomPlaybackData)(const char* deviceName, short* buffer, int samples); + + /* Preprocessor */ + unsigned int (*getPreProcessorInfoValueFloat)(uint64 serverConnectionHandlerID, const char* ident, float* result); + unsigned int (*getPreProcessorConfigValue)(uint64 serverConnectionHandlerID, const char* ident, char** result); + unsigned int (*setPreProcessorConfigValue)(uint64 serverConnectionHandlerID, const char* ident, const char* value); + + /* Encoder */ + unsigned int (*getEncodeConfigValue)(uint64 serverConnectionHandlerID, const char* ident, char** result); + + /* Playback */ + unsigned int (*getPlaybackConfigValueAsFloat)(uint64 serverConnectionHandlerID, const char* ident, float* result); + unsigned int (*setPlaybackConfigValue)(uint64 serverConnectionHandlerID, const char* ident, const char* value); + unsigned int (*setClientVolumeModifier)(uint64 serverConnectionHandlerID, anyID clientID, float value); + + /* Recording */ + unsigned int (*startVoiceRecording)(uint64 serverConnectionHandlerID); + unsigned int (*stopVoiceRecording)(uint64 serverConnectionHandlerID); + + /* 3d sound positioning */ + unsigned int (*systemset3DListenerAttributes) (uint64 serverConnectionHandlerID, const TS3_VECTOR* position, const TS3_VECTOR* forward, const TS3_VECTOR* up); + unsigned int (*set3DWaveAttributes) (uint64 serverConnectionHandlerID, uint64 waveHandle, const TS3_VECTOR* position); + unsigned int (*systemset3DSettings) (uint64 serverConnectionHandlerID, float distanceFactor, float rolloffScale); + unsigned int (*channelset3DAttributes) (uint64 serverConnectionHandlerID, anyID clientID, const TS3_VECTOR* position); + + /* Interaction with the server */ + unsigned int (*startConnection)(uint64 serverConnectionHandlerID, const char* identity, const char* ip, unsigned int port, const char* nickname, + const char** defaultChannelArray, const char* defaultChannelPassword, const char* serverPassword); + unsigned int (*stopConnection)(uint64 serverConnectionHandlerID, const char* quitMessage); + unsigned int (*requestClientMove)(uint64 serverConnectionHandlerID, anyID clientID, uint64 newChannelID, const char* password, const char* returnCode); + unsigned int (*requestClientVariables)(uint64 serverConnectionHandlerID, anyID clientID, const char* returnCode); + unsigned int (*requestClientKickFromChannel)(uint64 serverConnectionHandlerID, anyID clientID, const char* kickReason, const char* returnCode); + unsigned int (*requestClientKickFromServer)(uint64 serverConnectionHandlerID, anyID clientID, const char* kickReason, const char* returnCode); + unsigned int (*requestChannelDelete)(uint64 serverConnectionHandlerID, uint64 channelID, int force, const char* returnCode); + unsigned int (*requestChannelMove)(uint64 serverConnectionHandlerID, uint64 channelID, uint64 newChannelParentID, uint64 newChannelOrder, const char* returnCode); + unsigned int (*requestSendPrivateTextMsg)(uint64 serverConnectionHandlerID, const char* message, anyID targetClientID, const char* returnCode); + unsigned int (*requestSendChannelTextMsg)(uint64 serverConnectionHandlerID, const char* message, uint64 targetChannelID, const char* returnCode); + unsigned int (*requestSendServerTextMsg)(uint64 serverConnectionHandlerID, const char* message, const char* returnCode); + unsigned int (*requestConnectionInfo)(uint64 serverConnectionHandlerID, anyID clientID, const char* returnCode); + unsigned int (*requestClientSetWhisperList)(uint64 serverConnectionHandlerID, anyID clientID, const uint64* targetChannelIDArray, const anyID* targetClientIDArray, const char* returnCode); + unsigned int (*requestChannelSubscribe)(uint64 serverConnectionHandlerID, const uint64* channelIDArray, const char* returnCode); + unsigned int (*requestChannelSubscribeAll)(uint64 serverConnectionHandlerID, const char* returnCode); + unsigned int (*requestChannelUnsubscribe)(uint64 serverConnectionHandlerID, const uint64* channelIDArray, const char* returnCode); + unsigned int (*requestChannelUnsubscribeAll)(uint64 serverConnectionHandlerID, const char* returnCode); + unsigned int (*requestChannelDescription)(uint64 serverConnectionHandlerID, uint64 channelID, const char* returnCode); + unsigned int (*requestMuteClients)(uint64 serverConnectionHandlerID, const anyID* clientIDArray, const char* returnCode); + unsigned int (*requestUnmuteClients)(uint64 serverConnectionHandlerID, const anyID* clientIDArray, const char* returnCode); + unsigned int (*requestClientPoke)(uint64 serverConnectionHandlerID, anyID clientID, const char* message, const char* returnCode); + unsigned int (*requestClientIDs)(uint64 serverConnectionHandlerID, const char* clientUniqueIdentifier, const char* returnCode); + unsigned int (*clientChatClosed)(uint64 serverConnectionHandlerID, const char* clientUniqueIdentifier, anyID clientID, const char* returnCode); + unsigned int (*clientChatComposing)(uint64 serverConnectionHandlerID, anyID clientID, const char* returnCode); + unsigned int (*requestServerTemporaryPasswordAdd)(uint64 serverConnectionHandlerID, const char* password, const char* description, uint64 duration, uint64 targetChannelID, const char* targetChannelPW, const char* returnCode); + unsigned int (*requestServerTemporaryPasswordDel)(uint64 serverConnectionHandlerID, const char* password, const char* returnCode); + unsigned int (*requestServerTemporaryPasswordList)(uint64 serverConnectionHandlerID, const char* returnCode); + + /* Access clientlib information */ + + /* Query own client ID */ + unsigned int (*getClientID)(uint64 serverConnectionHandlerID, anyID* result); + + /* Client info */ + unsigned int (*getClientSelfVariableAsInt)(uint64 serverConnectionHandlerID, size_t flag, int* result); + unsigned int (*getClientSelfVariableAsString)(uint64 serverConnectionHandlerID, size_t flag, char** result); + unsigned int (*setClientSelfVariableAsInt)(uint64 serverConnectionHandlerID, size_t flag, int value); + unsigned int (*setClientSelfVariableAsString)(uint64 serverConnectionHandlerID, size_t flag, const char* value); + unsigned int (*flushClientSelfUpdates)(uint64 serverConnectionHandlerID, const char* returnCode); + unsigned int (*getClientVariableAsInt)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, int* result); + unsigned int (*getClientVariableAsUInt64)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, uint64* result); + unsigned int (*getClientVariableAsString)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, char** result); + unsigned int (*getClientList)(uint64 serverConnectionHandlerID, anyID** result); + unsigned int (*getChannelOfClient)(uint64 serverConnectionHandlerID, anyID clientID, uint64* result); + + /* Channel info */ + unsigned int (*getChannelVariableAsInt)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, int* result); + unsigned int (*getChannelVariableAsUInt64)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, uint64* result); + unsigned int (*getChannelVariableAsString)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, char** result); + unsigned int (*getChannelIDFromChannelNames)(uint64 serverConnectionHandlerID, char** channelNameArray, uint64* result); + unsigned int (*setChannelVariableAsInt)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, int value); + unsigned int (*setChannelVariableAsUInt64)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, uint64 value); + unsigned int (*setChannelVariableAsString)(uint64 serverConnectionHandlerID, uint64 channelID, size_t flag, const char* value); + unsigned int (*flushChannelUpdates)(uint64 serverConnectionHandlerID, uint64 channelID, const char* returnCode); + unsigned int (*flushChannelCreation)(uint64 serverConnectionHandlerID, uint64 channelParentID, const char* returnCode); + unsigned int (*getChannelList)(uint64 serverConnectionHandlerID, uint64** result); + unsigned int (*getChannelClientList)(uint64 serverConnectionHandlerID, uint64 channelID, anyID** result); + unsigned int (*getParentChannelOfChannel)(uint64 serverConnectionHandlerID, uint64 channelID, uint64* result); + + /* Server info */ + unsigned int (*getServerConnectionHandlerList)(uint64** result); + unsigned int (*getServerVariableAsInt)(uint64 serverConnectionHandlerID, size_t flag, int* result); + unsigned int (*getServerVariableAsUInt64)(uint64 serverConnectionHandlerID, size_t flag, uint64* result); + unsigned int (*getServerVariableAsString)(uint64 serverConnectionHandlerID, size_t flag, char** result); + unsigned int (*requestServerVariables)(uint64 serverConnectionHandlerID); + + /* Connection info */ + unsigned int (*getConnectionStatus)(uint64 serverConnectionHandlerID, int* result); + unsigned int (*getConnectionVariableAsUInt64)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, uint64* result); + unsigned int (*getConnectionVariableAsDouble)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, double* result); + unsigned int (*getConnectionVariableAsString)(uint64 serverConnectionHandlerID, anyID clientID, size_t flag, char** result); + unsigned int (*cleanUpConnectionInfo)(uint64 serverConnectionHandlerID, anyID clientID); + + /* Client related */ + unsigned int (*requestClientDBIDfromUID)(uint64 serverConnectionHandlerID, const char* clientUniqueIdentifier, const char* returnCode); + unsigned int (*requestClientNamefromUID)(uint64 serverConnectionHandlerID, const char* clientUniqueIdentifier, const char* returnCode); + unsigned int (*requestClientNamefromDBID)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const char* returnCode); + unsigned int (*requestClientEditDescription)(uint64 serverConnectionHandlerID, anyID clientID, const char* clientDescription, const char* returnCode); + unsigned int (*requestClientSetIsTalker)(uint64 serverConnectionHandlerID, anyID clientID, int isTalker, const char* returnCode); + unsigned int (*requestIsTalker)(uint64 serverConnectionHandlerID, int isTalkerRequest, const char* isTalkerRequestMessage, const char* returnCode); + + /* Plugin related */ + unsigned int (*requestSendClientQueryCommand)(uint64 serverConnectionHandlerID, const char* command, const char* returnCode); + + /* Filetransfer */ + unsigned int (*getTransferFileName)(anyID transferID, char** result); + unsigned int (*getTransferFilePath)(anyID transferID, char** result); + unsigned int (*getTransferFileSize)(anyID transferID, uint64* result); + unsigned int (*getTransferFileSizeDone)(anyID transferID, uint64* result); + unsigned int (*isTransferSender)(anyID transferID, int* result); /* 1 == upload, 0 == download */ + unsigned int (*getTransferStatus)(anyID transferID, int* result); + unsigned int (*getCurrentTransferSpeed)(anyID transferID, float* result); + unsigned int (*getAverageTransferSpeed)(anyID transferID, float* result); + unsigned int (*getTransferRunTime)(anyID transferID, uint64* result); + unsigned int (*sendFile)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* file, int overwrite, int resume, const char* sourceDirectory, anyID* result, const char* returnCode); + unsigned int (*requestFile)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* file, int overwrite, int resume, const char* destinationDirectory, anyID* result, const char* returnCode); + unsigned int (*haltTransfer)(uint64 serverConnectionHandlerID, anyID transferID, int deleteUnfinishedFile, const char* returnCode); + unsigned int (*requestFileList)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* path, const char* returnCode); + unsigned int (*requestFileInfo)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* file, const char* returnCode); + unsigned int (*requestDeleteFile)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char** file, const char* returnCode); + unsigned int (*requestCreateDirectory)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPW, const char* directoryPath, const char* returnCode); + unsigned int (*requestRenameFile)(uint64 serverConnectionHandlerID, uint64 fromChannelID, const char* channelPW, uint64 toChannelID, const char* toChannelPW, const char* oldFile, const char* newFile, const char* returnCode); + + /* Offline message management */ + unsigned int (*requestMessageAdd)(uint64 serverConnectionHandlerID, const char* toClientUID, const char* subject, const char* message, const char* returnCode); + unsigned int (*requestMessageDel)(uint64 serverConnectionHandlerID, uint64 messageID, const char* returnCode); + unsigned int (*requestMessageGet)(uint64 serverConnectionHandlerID, uint64 messageID, const char* returnCode); + unsigned int (*requestMessageList)(uint64 serverConnectionHandlerID, const char* returnCode); + unsigned int (*requestMessageUpdateFlag)(uint64 serverConnectionHandlerID, uint64 messageID, int flag, const char* returnCode); + + /* Interacting with the server - confirming passwords */ + unsigned int (*verifyServerPassword)(uint64 serverConnectionHandlerID, const char* serverPassword, const char* returnCode); + unsigned int (*verifyChannelPassword)(uint64 serverConnectionHandlerID, uint64 channelID, const char* channelPassword, const char* returnCode); + + /* Interacting with the server - banning */ + unsigned int (*banclient)(uint64 serverConnectionHandlerID, anyID clientID, uint64 timeInSeconds, const char* banReason, const char* returnCode); + unsigned int (*banadd)(uint64 serverConnectionHandlerID, const char* ipRegExp, const char* nameRegexp, const char* uniqueIdentity, const char* mytsID, uint64 timeInSeconds, const char* banReason, const char* returnCode); + unsigned int (*banclientdbid)(uint64 serverConnectionHandlerID, uint64 clientDBID, uint64 timeInSeconds, const char* banReason, const char* returnCode); + unsigned int (*bandel)(uint64 serverConnectionHandlerID, uint64 banID, const char* returnCode); + unsigned int (*bandelall)(uint64 serverConnectionHandlerID, const char* returnCode); + unsigned int (*requestBanList)(uint64 serverConnectionHandlerID, uint64 start, unsigned int duration, const char* returnCode); + + /* Interacting with the server - complain */ + unsigned int (*requestComplainAdd)(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, const char* complainReason, const char* returnCode); + unsigned int (*requestComplainDel)(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, uint64 fromClientDatabaseID, const char* returnCode); + unsigned int (*requestComplainDelAll)(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, const char* returnCode); + unsigned int (*requestComplainList)(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, const char* returnCode); + + /* Permissions */ + unsigned int (*requestServerGroupList)(uint64 serverConnectionHandlerID, const char* returnCode); + unsigned int (*requestServerGroupAdd)(uint64 serverConnectionHandlerID, const char* groupName, int groupType, const char* returnCode); + unsigned int (*requestServerGroupDel)(uint64 serverConnectionHandlerID, uint64 serverGroupID, int force, const char* returnCode); + unsigned int (*requestServerGroupAddClient)(uint64 serverConnectionHandlerID, uint64 serverGroupID, uint64 clientDatabaseID, const char* returnCode); + unsigned int (*requestServerGroupDelClient)(uint64 serverConnectionHandlerID, uint64 serverGroupID, uint64 clientDatabaseID, const char* returnCode); + unsigned int (*requestServerGroupsByClientID)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const char* returnCode); + unsigned int (*requestServerGroupAddPerm)(uint64 serverConnectionHandlerID, uint64 serverGroupID, int continueonerror, const unsigned int* permissionIDArray, const int* permissionValueArray, const int* permissionNegatedArray, const int* permissionSkipArray, int arraySize, const char* returnCode); + unsigned int (*requestServerGroupDelPerm)(uint64 serverConnectionHandlerID, uint64 serverGroupID, int continueOnError, const unsigned int* permissionIDArray, int arraySize, const char* returnCode); + unsigned int (*requestServerGroupPermList)(uint64 serverConnectionHandlerID, uint64 serverGroupID, const char* returnCode); + unsigned int (*requestServerGroupClientList)(uint64 serverConnectionHandlerID, uint64 serverGroupID, int withNames, const char* returnCode); + unsigned int (*requestChannelGroupList)(uint64 serverConnectionHandlerID, const char* returnCode); + unsigned int (*requestChannelGroupAdd)(uint64 serverConnectionHandlerID, const char* groupName, int groupType, const char* returnCode); + unsigned int (*requestChannelGroupDel)(uint64 serverConnectionHandlerID, uint64 channelGroupID, int force, const char* returnCode); + unsigned int (*requestChannelGroupAddPerm)(uint64 serverConnectionHandlerID, uint64 channelGroupID, int continueonerror, const unsigned int* permissionIDArray, const int* permissionValueArray, int arraySize, const char* returnCode); + unsigned int (*requestChannelGroupDelPerm)(uint64 serverConnectionHandlerID, uint64 channelGroupID, int continueOnError, const unsigned int* permissionIDArray, int arraySize, const char* returnCode); + unsigned int (*requestChannelGroupPermList)(uint64 serverConnectionHandlerID, uint64 channelGroupID, const char* returnCode); + unsigned int (*requestSetClientChannelGroup)(uint64 serverConnectionHandlerID, const uint64* channelGroupIDArray, const uint64* channelIDArray, const uint64* clientDatabaseIDArray, int arraySize, const char* returnCode); + unsigned int (*requestChannelAddPerm)(uint64 serverConnectionHandlerID, uint64 channelID, const unsigned int* permissionIDArray, const int* permissionValueArray, int arraySize, const char* returnCode); + unsigned int (*requestChannelDelPerm)(uint64 serverConnectionHandlerID, uint64 channelID, const unsigned int* permissionIDArray, int arraySize, const char* returnCode); + unsigned int (*requestChannelPermList)(uint64 serverConnectionHandlerID, uint64 channelID, const char* returnCode); + unsigned int (*requestClientAddPerm)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const unsigned int* permissionIDArray, const int* permissionValueArray, const int* permissionSkipArray, int arraySize, const char* returnCode); + unsigned int (*requestClientDelPerm)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const unsigned int* permissionIDArray, int arraySize, const char* returnCode); + unsigned int (*requestClientPermList)(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, const char* returnCode); + unsigned int (*requestChannelClientAddPerm)(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID, const unsigned int* permissionIDArray, const int* permissionValueArray, int arraySize, const char* returnCode); + unsigned int (*requestChannelClientDelPerm)(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID, const unsigned int* permissionIDArray, int arraySize, const char* returnCode); + unsigned int (*requestChannelClientPermList)(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID, const char* returnCode); + unsigned int (*privilegeKeyUse)(uint64 serverConnectionHandler, const char* tokenKey, const char* returnCode); + unsigned int (*requestPermissionList)(uint64 serverConnectionHandler, const char* returnCode); + unsigned int (*requestPermissionOverview)(uint64 serverConnectionHandler, uint64 clientDBID, uint64 channelID, const char* returnCode); + + /* Helper Functions */ + unsigned int (*clientPropertyStringToFlag)(const char* clientPropertyString, size_t* resultFlag); + unsigned int (*channelPropertyStringToFlag)(const char* channelPropertyString, size_t* resultFlag); + unsigned int (*serverPropertyStringToFlag)(const char* serverPropertyString, size_t* resultFlag); + + /* Client functions */ + void (*getAppPath)(char* path, size_t maxLen); + void (*getResourcesPath)(char* path, size_t maxLen); + void (*getConfigPath)(char* path, size_t maxLen); + void (*getPluginPath)(char* path, size_t maxLen, const char* pluginID); + uint64 (*getCurrentServerConnectionHandlerID)(); + void (*printMessage)(uint64 serverConnectionHandlerID, const char* message, enum PluginMessageTarget messageTarget); + void (*printMessageToCurrentTab)(const char* message); + void (*urlsToBB)(const char* text, char* result, size_t maxLen); + void (*sendPluginCommand)(uint64 serverConnectionHandlerID, const char* pluginID, const char* command, int targetMode, const anyID* targetIDs, const char* returnCode); + void (*getDirectories)(const char* path, char* result, size_t maxLen); + unsigned int (*getServerConnectInfo)(uint64 scHandlerID, char* host, unsigned short* port, char* password, size_t maxLen); + unsigned int (*getChannelConnectInfo)(uint64 scHandlerID, uint64 channelID, char* path, char* password, size_t maxLen); + void (*createReturnCode)(const char* pluginID, char* returnCode, size_t maxLen); + unsigned int (*requestInfoUpdate)(uint64 scHandlerID, enum PluginItemType itemType, uint64 itemID); + uint64 (*getServerVersion)(uint64 scHandlerID); + unsigned int (*isWhispering)(uint64 scHandlerID, anyID clientID, int* result); + unsigned int (*isReceivingWhisper)(uint64 scHandlerID, anyID clientID, int* result); + unsigned int (*getAvatar)(uint64 scHandlerID, anyID clientID, char* result, size_t maxLen); + void (*setPluginMenuEnabled)(const char* pluginID, int menuID, int enabled); + void (*showHotkeySetup)(); + void (*requestHotkeyInputDialog)(const char* pluginID, const char* keyword, int isDown, void* qParentWindow); + unsigned int (*getHotkeyFromKeyword)(const char* pluginID, const char** keywords, char** hotkeys, size_t arrayLen, size_t hotkeyBufSize); + unsigned int (*getClientDisplayName)(uint64 scHandlerID, anyID clientID, char* result, size_t maxLen); + unsigned int (*getBookmarkList)(struct PluginBookmarkList** list); + unsigned int (*getProfileList)(enum PluginGuiProfile profile, int* defaultProfileIdx, char*** result); + unsigned int (*guiConnect)(enum PluginConnectTab connectTab, const char* serverLabel, const char* serverAddress, const char* serverPassword, const char* nickname, const char* channel, const char* channelPassword, const char* captureProfile, const char* playbackProfile, const char* hotkeyProfile, const char* soundProfile, const char* userIdentity, const char* oneTimeKey, const char* phoneticName, uint64* scHandlerID); + unsigned int (*guiConnectBookmark)(enum PluginConnectTab connectTab, const char* bookmarkuuid, uint64* scHandlerID); + unsigned int (*createBookmark)(const char* bookmarkuuid, const char* serverLabel, const char* serverAddress, const char* serverPassword, const char* nickname, const char* channel, const char* channelPassword, const char* captureProfile, const char* playbackProfile, const char* hotkeyProfile, const char* soundProfile, const char* uniqueUserId, const char* oneTimeKey, const char* phoneticName); + unsigned int (*getPermissionIDByName)(uint64 serverConnectionHandlerID, const char* permissionName, unsigned int* result); + unsigned int (*getClientNeededPermission)(uint64 serverConnectionHandlerID, const char* permissionName, int* result); + void(*notifyKeyEvent)(const char *pluginID, const char *keyIdentifier, int up_down); +}; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..fd39c1b --- /dev/null +++ b/readme.txt @@ -0,0 +1,23 @@ +TeamSpeak 3 Plugin Software Development Kit +Copyright (c) TeamSpeak Systems GmbH + +Contents +- Demo plugin sourcecode as template for developing own plugins +- Required header files +- Clientlib documentation + +bin\plugins\ + Target build directory for the sample project. Instead you might want to configure your output directory + to the plugins directory within your TeamSpeak 3 client installation. +docs\ + Clientlib documentation +include\ + Required header files +src\ + Sourcecode of our test plugin + +We strongly recommend to build upon the test plugin. Plugins are required to export some special functions, +which already exist in the test plugin. Optional functions may be removed if not used. See code comments +for details. + +For questions please visit our forums at https://forum.teamspeak.com diff --git a/src/icons/1.png b/src/icons/1.png new file mode 100644 index 0000000..aa4632b Binary files /dev/null and b/src/icons/1.png differ diff --git a/src/icons/2.png b/src/icons/2.png new file mode 100644 index 0000000..fe83f3f Binary files /dev/null and b/src/icons/2.png differ diff --git a/src/icons/3.png b/src/icons/3.png new file mode 100644 index 0000000..bcc6557 Binary files /dev/null and b/src/icons/3.png differ diff --git a/src/icons/t.png b/src/icons/t.png new file mode 100644 index 0000000..3c82521 Binary files /dev/null and b/src/icons/t.png differ diff --git a/src/plugin.c b/src/plugin.c new file mode 100644 index 0000000..8dcbac4 --- /dev/null +++ b/src/plugin.c @@ -0,0 +1,1169 @@ +/* + * TeamSpeak 3 demo plugin + * + * Copyright (c) TeamSpeak Systems GmbH + */ + +#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) +#pragma warning (disable : 4100) /* Disable Unreferenced parameter warning */ +#include +#endif + +#include +#include +#include +#include +#include "teamspeak/public_errors.h" +#include "teamspeak/public_errors_rare.h" +#include "teamspeak/public_definitions.h" +#include "teamspeak/public_rare_definitions.h" +#include "teamspeak/clientlib_publicdefinitions.h" +#include "ts3_functions.h" +#include "plugin.h" + +static struct TS3Functions ts3Functions; + +#ifdef _WIN32 +#define _strcpy(dest, destSize, src) strcpy_s(dest, destSize, src) +#define snprintf sprintf_s +#else +#define _strcpy(dest, destSize, src) { strncpy(dest, src, destSize-1); (dest)[destSize-1] = '\0'; } +#endif + +#define PLUGIN_API_VERSION 23 + +#define PATH_BUFSIZE 512 +#define COMMAND_BUFSIZE 128 +#define INFODATA_BUFSIZE 128 +#define SERVERINFO_BUFSIZE 256 +#define CHANNELINFO_BUFSIZE 512 +#define RETURNCODE_BUFSIZE 128 + +static char* pluginID = NULL; + +#ifdef _WIN32 +/* Helper function to convert wchar_T to Utf-8 encoded strings on Windows */ +static int wcharToUtf8(const wchar_t* str, char** result) { + int outlen = WideCharToMultiByte(CP_UTF8, 0, str, -1, 0, 0, 0, 0); + *result = (char*)malloc(outlen); + if(WideCharToMultiByte(CP_UTF8, 0, str, -1, *result, outlen, 0, 0) == 0) { + *result = NULL; + return -1; + } + return 0; +} +#endif + +/*********************************** Required functions ************************************/ +/* + * If any of these required functions is not implemented, TS3 will refuse to load the plugin + */ + +/* Unique name identifying this plugin */ +const char* ts3plugin_name() { +#ifdef _WIN32 + /* TeamSpeak expects UTF-8 encoded characters. Following demonstrates a possibility how to convert UTF-16 wchar_t into UTF-8. */ + static char* result = NULL; /* Static variable so it's allocated only once */ + if(!result) { + const wchar_t* name = L"Test Plugin"; + if(wcharToUtf8(name, &result) == -1) { /* Convert name into UTF-8 encoded result */ + result = "Test Plugin"; /* Conversion failed, fallback here */ + } + } + return result; +#else + return "Test Plugin"; +#endif +} + +/* Plugin version */ +const char* ts3plugin_version() { + return "1.2"; +} + +/* Plugin API version. Must be the same as the clients API major version, else the plugin fails to load. */ +int ts3plugin_apiVersion() { + return PLUGIN_API_VERSION; +} + +/* Plugin author */ +const char* ts3plugin_author() { + /* If you want to use wchar_t, see ts3plugin_name() on how to use */ + return "TeamSpeak Systems GmbH"; +} + +/* Plugin description */ +const char* ts3plugin_description() { + /* If you want to use wchar_t, see ts3plugin_name() on how to use */ + return "This plugin demonstrates the TeamSpeak 3 client plugin architecture."; +} + +/* Set TeamSpeak 3 callback functions */ +void ts3plugin_setFunctionPointers(const struct TS3Functions funcs) { + ts3Functions = funcs; +} + +/* + * Custom code called right after loading the plugin. Returns 0 on success, 1 on failure. + * If the function returns 1 on failure, the plugin will be unloaded again. + */ +int ts3plugin_init() { + char appPath[PATH_BUFSIZE]; + char resourcesPath[PATH_BUFSIZE]; + char configPath[PATH_BUFSIZE]; + char pluginPath[PATH_BUFSIZE]; + + /* Your plugin init code here */ + printf("PLUGIN: init\n"); + + /* Example on how to query application, resources and configuration paths from client */ + /* Note: Console client returns empty string for app and resources path */ + ts3Functions.getAppPath(appPath, PATH_BUFSIZE); + ts3Functions.getResourcesPath(resourcesPath, PATH_BUFSIZE); + ts3Functions.getConfigPath(configPath, PATH_BUFSIZE); + ts3Functions.getPluginPath(pluginPath, PATH_BUFSIZE, pluginID); + + printf("PLUGIN: App path: %s\nResources path: %s\nConfig path: %s\nPlugin path: %s\n", appPath, resourcesPath, configPath, pluginPath); + + return 0; /* 0 = success, 1 = failure, -2 = failure but client will not show a "failed to load" warning */ + /* -2 is a very special case and should only be used if a plugin displays a dialog (e.g. overlay) asking the user to disable + * the plugin again, avoiding the show another dialog by the client telling the user the plugin failed to load. + * For normal case, if a plugin really failed to load because of an error, the correct return value is 1. */ +} + +/* Custom code called right before the plugin is unloaded */ +void ts3plugin_shutdown() { + /* Your plugin cleanup code here */ + printf("PLUGIN: shutdown\n"); + + /* + * Note: + * If your plugin implements a settings dialog, it must be closed and deleted here, else the + * TeamSpeak client will most likely crash (DLL removed but dialog from DLL code still open). + */ + + /* Free pluginID if we registered it */ + if(pluginID) { + free(pluginID); + pluginID = NULL; + } +} + +/****************************** Optional functions ********************************/ +/* + * Following functions are optional, if not needed you don't need to implement them. + */ + +/* Tell client if plugin offers a configuration window. If this function is not implemented, it's an assumed "does not offer" (PLUGIN_OFFERS_NO_CONFIGURE). */ +int ts3plugin_offersConfigure() { + printf("PLUGIN: offersConfigure\n"); + /* + * Return values: + * PLUGIN_OFFERS_NO_CONFIGURE - Plugin does not implement ts3plugin_configure + * PLUGIN_OFFERS_CONFIGURE_NEW_THREAD - Plugin does implement ts3plugin_configure and requests to run this function in an own thread + * PLUGIN_OFFERS_CONFIGURE_QT_THREAD - Plugin does implement ts3plugin_configure and requests to run this function in the Qt GUI thread + */ + return PLUGIN_OFFERS_NO_CONFIGURE; /* In this case ts3plugin_configure does not need to be implemented */ +} + +/* Plugin might offer a configuration window. If ts3plugin_offersConfigure returns 0, this function does not need to be implemented. */ +void ts3plugin_configure(void* handle, void* qParentWidget) { + printf("PLUGIN: configure\n"); +} + +/* + * If the plugin wants to use error return codes, plugin commands, hotkeys or menu items, it needs to register a command ID. This function will be + * automatically called after the plugin was initialized. This function is optional. If you don't use these features, this function can be omitted. + * Note the passed pluginID parameter is no longer valid after calling this function, so you must copy it and store it in the plugin. + */ +void ts3plugin_registerPluginID(const char* id) { + const size_t sz = strlen(id) + 1; + pluginID = (char*)malloc(sz * sizeof(char)); + _strcpy(pluginID, sz, id); /* The id buffer will invalidate after exiting this function */ + printf("PLUGIN: registerPluginID: %s\n", pluginID); +} + +/* Plugin command keyword. Return NULL or "" if not used. */ +const char* ts3plugin_commandKeyword() { + return "test"; +} + +static void print_and_free_bookmarks_list(struct PluginBookmarkList* list) +{ + int i; + for (i = 0; i < list->itemcount; ++i) { + if (list->items[i].isFolder) { + printf("Folder: name=%s\n", list->items[i].name); + print_and_free_bookmarks_list(list->items[i].folder); + ts3Functions.freeMemory(list->items[i].name); + } else { + printf("Bookmark: name=%s uuid=%s\n", list->items[i].name, list->items[i].uuid); + ts3Functions.freeMemory(list->items[i].name); + ts3Functions.freeMemory(list->items[i].uuid); + } + } + ts3Functions.freeMemory(list); +} + +/* Plugin processes console command. Return 0 if plugin handled the command, 1 if not handled. */ +int ts3plugin_processCommand(uint64 serverConnectionHandlerID, const char* command) { + char buf[COMMAND_BUFSIZE]; + char *s, *param1 = NULL, *param2 = NULL; + int i = 0; + enum { CMD_NONE = 0, CMD_JOIN, CMD_COMMAND, CMD_SERVERINFO, CMD_CHANNELINFO, CMD_AVATAR, CMD_ENABLEMENU, CMD_SUBSCRIBE, CMD_UNSUBSCRIBE, CMD_SUBSCRIBEALL, CMD_UNSUBSCRIBEALL, CMD_BOOKMARKSLIST } cmd = CMD_NONE; +#ifdef _WIN32 + char* context = NULL; +#endif + + printf("PLUGIN: process command: '%s'\n", command); + + _strcpy(buf, COMMAND_BUFSIZE, command); +#ifdef _WIN32 + s = strtok_s(buf, " ", &context); +#else + s = strtok(buf, " "); +#endif + while(s != NULL) { + if(i == 0) { + if(!strcmp(s, "join")) { + cmd = CMD_JOIN; + } else if(!strcmp(s, "command")) { + cmd = CMD_COMMAND; + } else if(!strcmp(s, "serverinfo")) { + cmd = CMD_SERVERINFO; + } else if(!strcmp(s, "channelinfo")) { + cmd = CMD_CHANNELINFO; + } else if(!strcmp(s, "avatar")) { + cmd = CMD_AVATAR; + } else if(!strcmp(s, "enablemenu")) { + cmd = CMD_ENABLEMENU; + } else if(!strcmp(s, "subscribe")) { + cmd = CMD_SUBSCRIBE; + } else if(!strcmp(s, "unsubscribe")) { + cmd = CMD_UNSUBSCRIBE; + } else if(!strcmp(s, "subscribeall")) { + cmd = CMD_SUBSCRIBEALL; + } else if(!strcmp(s, "unsubscribeall")) { + cmd = CMD_UNSUBSCRIBEALL; + } else if (!strcmp(s, "bookmarkslist")) { + cmd = CMD_BOOKMARKSLIST; + } + } else if(i == 1) { + param1 = s; + } else { + param2 = s; + } +#ifdef _WIN32 + s = strtok_s(NULL, " ", &context); +#else + s = strtok(NULL, " "); +#endif + i++; + } + + switch(cmd) { + case CMD_NONE: + return 1; /* Command not handled by plugin */ + case CMD_JOIN: /* /test join [optionalCannelPassword] */ + if(param1) { + uint64 channelID = (uint64)atoi(param1); + char* password = param2 ? param2 : ""; + char returnCode[RETURNCODE_BUFSIZE]; + anyID myID; + + /* Get own clientID */ + if(ts3Functions.getClientID(serverConnectionHandlerID, &myID) != ERROR_ok) { + ts3Functions.logMessage("Error querying client ID", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + break; + } + + /* Create return code for requestClientMove function call. If creation fails, returnCode will be NULL, which can be + * passed into the client functions meaning no return code is used. + * Note: To use return codes, the plugin needs to register a plugin ID using ts3plugin_registerPluginID */ + ts3Functions.createReturnCode(pluginID, returnCode, RETURNCODE_BUFSIZE); + + /* In a real world plugin, the returnCode should be remembered (e.g. in a dynamic STL vector, if it's a C++ plugin). + * onServerErrorEvent can then check the received returnCode, compare with the remembered ones and thus identify + * which function call has triggered the event and react accordingly. */ + + /* Request joining specified channel using above created return code */ + if(ts3Functions.requestClientMove(serverConnectionHandlerID, myID, channelID, password, returnCode) != ERROR_ok) { + ts3Functions.logMessage("Error requesting client move", LogLevel_INFO, "Plugin", serverConnectionHandlerID); + } + } else { + ts3Functions.printMessageToCurrentTab("Missing channel ID parameter."); + } + break; + case CMD_COMMAND: /* /test command */ + if(param1) { + /* Send plugin command to all clients in current channel. In this case targetIds is unused and can be NULL. */ + if(pluginID) { + /* See ts3plugin_registerPluginID for how to obtain a pluginID */ + printf("PLUGIN: Sending plugin command to current channel: %s\n", param1); + ts3Functions.sendPluginCommand(serverConnectionHandlerID, pluginID, param1, PluginCommandTarget_CURRENT_CHANNEL, NULL, NULL); + } else { + printf("PLUGIN: Failed to send plugin command, was not registered.\n"); + } + } else { + ts3Functions.printMessageToCurrentTab("Missing command parameter."); + } + break; + case CMD_SERVERINFO: { /* /test serverinfo */ + /* Query host, port and server password of current server tab. + * The password parameter can be NULL if the plugin does not want to receive the server password. + * Note: Server password is only available if the user has actually used it when connecting. If a user has + * connected with the permission to ignore passwords (b_virtualserver_join_ignore_password) and the password, + * was not entered, it will not be available. + * getServerConnectInfo returns 0 on success, 1 on error or if current server tab is disconnected. */ + char host[SERVERINFO_BUFSIZE]; + /*char password[SERVERINFO_BUFSIZE];*/ + char* password = NULL; /* Don't receive server password */ + unsigned short port; + if(!ts3Functions.getServerConnectInfo(serverConnectionHandlerID, host, &port, password, SERVERINFO_BUFSIZE)) { + char msg[SERVERINFO_BUFSIZE]; + snprintf(msg, sizeof(msg), "Server Connect Info: %s:%d", host, port); + ts3Functions.printMessageToCurrentTab(msg); + } else { + ts3Functions.printMessageToCurrentTab("No server connect info available."); + } + break; + } + case CMD_CHANNELINFO: { /* /test channelinfo */ + /* Query channel path and password of current server tab. + * The password parameter can be NULL if the plugin does not want to receive the channel password. + * Note: Channel password is only available if the user has actually used it when entering the channel. If a user has + * entered a channel with the permission to ignore passwords (b_channel_join_ignore_password) and the password, + * was not entered, it will not be available. + * getChannelConnectInfo returns 0 on success, 1 on error or if current server tab is disconnected. */ + char path[CHANNELINFO_BUFSIZE]; + /*char password[CHANNELINFO_BUFSIZE];*/ + char* password = NULL; /* Don't receive channel password */ + + /* Get own clientID and channelID */ + anyID myID; + uint64 myChannelID; + if(ts3Functions.getClientID(serverConnectionHandlerID, &myID) != ERROR_ok) { + ts3Functions.logMessage("Error querying client ID", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + break; + } + /* Get own channel ID */ + if(ts3Functions.getChannelOfClient(serverConnectionHandlerID, myID, &myChannelID) != ERROR_ok) { + ts3Functions.logMessage("Error querying channel ID", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + break; + } + + /* Get channel connect info of own channel */ + if(!ts3Functions.getChannelConnectInfo(serverConnectionHandlerID, myChannelID, path, password, CHANNELINFO_BUFSIZE)) { + char msg[CHANNELINFO_BUFSIZE]; + snprintf(msg, sizeof(msg), "Channel Connect Info: %s", path); + ts3Functions.printMessageToCurrentTab(msg); + } else { + ts3Functions.printMessageToCurrentTab("No channel connect info available."); + } + break; + } + case CMD_AVATAR: { /* /test avatar */ + char avatarPath[PATH_BUFSIZE]; + anyID clientID = (anyID)atoi(param1); + unsigned int error; + + memset(avatarPath, 0, PATH_BUFSIZE); + error = ts3Functions.getAvatar(serverConnectionHandlerID, clientID, avatarPath, PATH_BUFSIZE); + if(error == ERROR_ok) { /* ERROR_ok means the client has an avatar set. */ + if(strlen(avatarPath)) { /* Avatar path contains the full path to the avatar image in the TS3Client cache directory */ + printf("Avatar path: %s\n", avatarPath); + } else { /* Empty avatar path means the client has an avatar but the image has not yet been cached. The TeamSpeak + * client will automatically start the download and call onAvatarUpdated when done */ + printf("Avatar not yet downloaded, waiting for onAvatarUpdated...\n"); + } + } else if(error == ERROR_database_empty_result) { /* Not an error, the client simply has no avatar set */ + printf("Client has no avatar\n"); + } else { /* Other error occured (invalid server connection handler ID, invalid client ID, file io error etc) */ + printf("Error getting avatar: %d\n", error); + } + break; + } + case CMD_ENABLEMENU: /* /test enablemenu <0|1> */ + if(param1) { + int menuID = atoi(param1); + int enable = param2 ? atoi(param2) : 0; + ts3Functions.setPluginMenuEnabled(pluginID, menuID, enable); + } else { + ts3Functions.printMessageToCurrentTab("Usage is: /test enablemenu <0|1>"); + } + break; + case CMD_SUBSCRIBE: /* /test subscribe */ + if(param1) { + char returnCode[RETURNCODE_BUFSIZE]; + uint64 channelIDArray[2]; + channelIDArray[0] = (uint64)atoi(param1); + channelIDArray[1] = 0; + ts3Functions.createReturnCode(pluginID, returnCode, RETURNCODE_BUFSIZE); + if(ts3Functions.requestChannelSubscribe(serverConnectionHandlerID, channelIDArray, returnCode) != ERROR_ok) { + ts3Functions.logMessage("Error subscribing channel", LogLevel_INFO, "Plugin", serverConnectionHandlerID); + } + } + break; + case CMD_UNSUBSCRIBE: /* /test unsubscribe */ + if(param1) { + char returnCode[RETURNCODE_BUFSIZE]; + uint64 channelIDArray[2]; + channelIDArray[0] = (uint64)atoi(param1); + channelIDArray[1] = 0; + ts3Functions.createReturnCode(pluginID, returnCode, RETURNCODE_BUFSIZE); + if(ts3Functions.requestChannelUnsubscribe(serverConnectionHandlerID, channelIDArray, NULL) != ERROR_ok) { + ts3Functions.logMessage("Error unsubscribing channel", LogLevel_INFO, "Plugin", serverConnectionHandlerID); + } + } + break; + case CMD_SUBSCRIBEALL: { /* /test subscribeall */ + char returnCode[RETURNCODE_BUFSIZE]; + ts3Functions.createReturnCode(pluginID, returnCode, RETURNCODE_BUFSIZE); + if(ts3Functions.requestChannelSubscribeAll(serverConnectionHandlerID, returnCode) != ERROR_ok) { + ts3Functions.logMessage("Error subscribing channel", LogLevel_INFO, "Plugin", serverConnectionHandlerID); + } + break; + } + case CMD_UNSUBSCRIBEALL: { /* /test unsubscribeall */ + char returnCode[RETURNCODE_BUFSIZE]; + ts3Functions.createReturnCode(pluginID, returnCode, RETURNCODE_BUFSIZE); + if(ts3Functions.requestChannelUnsubscribeAll(serverConnectionHandlerID, returnCode) != ERROR_ok) { + ts3Functions.logMessage("Error subscribing channel", LogLevel_INFO, "Plugin", serverConnectionHandlerID); + } + break; + } + case CMD_BOOKMARKSLIST: { /* test bookmarkslist */ + struct PluginBookmarkList* list; + unsigned int error = ts3Functions.getBookmarkList(&list); + if (error == ERROR_ok) { + print_and_free_bookmarks_list(list); + } + else { + ts3Functions.logMessage("Error getting bookmarks list", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + } + break; + } + } + + return 0; /* Plugin handled command */ +} + +/* Client changed current server connection handler */ +void ts3plugin_currentServerConnectionChanged(uint64 serverConnectionHandlerID) { + printf("PLUGIN: currentServerConnectionChanged %llu (%llu)\n", (long long unsigned int)serverConnectionHandlerID, (long long unsigned int)ts3Functions.getCurrentServerConnectionHandlerID()); +} + +/* + * Implement the following three functions when the plugin should display a line in the server/channel/client info. + * If any of ts3plugin_infoTitle, ts3plugin_infoData or ts3plugin_freeMemory is missing, the info text will not be displayed. + */ + +/* Static title shown in the left column in the info frame */ +const char* ts3plugin_infoTitle() { + return "Test plugin info"; +} + +/* + * Dynamic content shown in the right column in the info frame. Memory for the data string needs to be allocated in this + * function. The client will call ts3plugin_freeMemory once done with the string to release the allocated memory again. + * Check the parameter "type" if you want to implement this feature only for specific item types. Set the parameter + * "data" to NULL to have the client ignore the info data. + */ +void ts3plugin_infoData(uint64 serverConnectionHandlerID, uint64 id, enum PluginItemType type, char** data) { + char* name; + + /* For demonstration purpose, display the name of the currently selected server, channel or client. */ + switch(type) { + case PLUGIN_SERVER: + if(ts3Functions.getServerVariableAsString(serverConnectionHandlerID, VIRTUALSERVER_NAME, &name) != ERROR_ok) { + printf("Error getting virtual server name\n"); + return; + } + break; + case PLUGIN_CHANNEL: + if(ts3Functions.getChannelVariableAsString(serverConnectionHandlerID, id, CHANNEL_NAME, &name) != ERROR_ok) { + printf("Error getting channel name\n"); + return; + } + break; + case PLUGIN_CLIENT: + if(ts3Functions.getClientVariableAsString(serverConnectionHandlerID, (anyID)id, CLIENT_NICKNAME, &name) != ERROR_ok) { + printf("Error getting client nickname\n"); + return; + } + break; + default: + printf("Invalid item type: %d\n", type); + data = NULL; /* Ignore */ + return; + } + + *data = (char*)malloc(INFODATA_BUFSIZE * sizeof(char)); /* Must be allocated in the plugin! */ + snprintf(*data, INFODATA_BUFSIZE, "The nickname is [I]\"%s\"[/I]", name); /* bbCode is supported. HTML is not supported */ + ts3Functions.freeMemory(name); +} + +/* Required to release the memory for parameter "data" allocated in ts3plugin_infoData and ts3plugin_initMenus */ +void ts3plugin_freeMemory(void* data) { + free(data); +} + +/* + * Plugin requests to be always automatically loaded by the TeamSpeak 3 client unless + * the user manually disabled it in the plugin dialog. + * This function is optional. If missing, no autoload is assumed. + */ +int ts3plugin_requestAutoload() { + return 0; /* 1 = request autoloaded, 0 = do not request autoload */ +} + +/* Helper function to create a menu item */ +static struct PluginMenuItem* createMenuItem(enum PluginMenuType type, int id, const char* text, const char* icon) { + struct PluginMenuItem* menuItem = (struct PluginMenuItem*)malloc(sizeof(struct PluginMenuItem)); + menuItem->type = type; + menuItem->id = id; + _strcpy(menuItem->text, PLUGIN_MENU_BUFSZ, text); + _strcpy(menuItem->icon, PLUGIN_MENU_BUFSZ, icon); + return menuItem; +} + +/* Some makros to make the code to create menu items a bit more readable */ +#define BEGIN_CREATE_MENUS(x) const size_t sz = x + 1; size_t n = 0; *menuItems = (struct PluginMenuItem**)malloc(sizeof(struct PluginMenuItem*) * sz); +#define CREATE_MENU_ITEM(a, b, c, d) (*menuItems)[n++] = createMenuItem(a, b, c, d); +#define END_CREATE_MENUS (*menuItems)[n++] = NULL; assert(n == sz); + +/* + * Menu IDs for this plugin. Pass these IDs when creating a menuitem to the TS3 client. When the menu item is triggered, + * ts3plugin_onMenuItemEvent will be called passing the menu ID of the triggered menu item. + * These IDs are freely choosable by the plugin author. It's not really needed to use an enum, it just looks prettier. + */ +enum { + MENU_ID_CLIENT_1 = 1, + MENU_ID_CLIENT_2, + MENU_ID_CHANNEL_1, + MENU_ID_CHANNEL_2, + MENU_ID_CHANNEL_3, + MENU_ID_GLOBAL_1, + MENU_ID_GLOBAL_2 +}; + +/* + * Initialize plugin menus. + * This function is called after ts3plugin_init and ts3plugin_registerPluginID. A pluginID is required for plugin menus to work. + * Both ts3plugin_registerPluginID and ts3plugin_freeMemory must be implemented to use menus. + * If plugin menus are not used by a plugin, do not implement this function or return NULL. + */ +void ts3plugin_initMenus(struct PluginMenuItem*** menuItems, char** menuIcon) { + /* + * Create the menus + * There are three types of menu items: + * - PLUGIN_MENU_TYPE_CLIENT: Client context menu + * - PLUGIN_MENU_TYPE_CHANNEL: Channel context menu + * - PLUGIN_MENU_TYPE_GLOBAL: "Plugins" menu in menu bar of main window + * + * Menu IDs are used to identify the menu item when ts3plugin_onMenuItemEvent is called + * + * The menu text is required, max length is 128 characters + * + * The icon is optional, max length is 128 characters. When not using icons, just pass an empty string. + * Icons are loaded from a subdirectory in the TeamSpeak client plugins folder. The subdirectory must be named like the + * plugin filename, without dll/so/dylib suffix + * e.g. for "test_plugin.dll", icon "1.png" is loaded from \plugins\test_plugin\1.png + */ + + BEGIN_CREATE_MENUS(7); /* IMPORTANT: Number of menu items must be correct! */ + CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CLIENT, MENU_ID_CLIENT_1, "Client item 1", "1.png"); + CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CLIENT, MENU_ID_CLIENT_2, "Client item 2", "2.png"); + CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CHANNEL, MENU_ID_CHANNEL_1, "Channel item 1", "1.png"); + CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CHANNEL, MENU_ID_CHANNEL_2, "Channel item 2", "2.png"); + CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_CHANNEL, MENU_ID_CHANNEL_3, "Channel item 3", "3.png"); + CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_GLOBAL, MENU_ID_GLOBAL_1, "Global item 1", "1.png"); + CREATE_MENU_ITEM(PLUGIN_MENU_TYPE_GLOBAL, MENU_ID_GLOBAL_2, "Global item 2", "2.png"); + END_CREATE_MENUS; /* Includes an assert checking if the number of menu items matched */ + + /* + * Specify an optional icon for the plugin. This icon is used for the plugins submenu within context and main menus + * If unused, set menuIcon to NULL + */ + *menuIcon = (char*)malloc(PLUGIN_MENU_BUFSZ * sizeof(char)); + _strcpy(*menuIcon, PLUGIN_MENU_BUFSZ, "t.png"); + + /* + * Menus can be enabled or disabled with: ts3Functions.setPluginMenuEnabled(pluginID, menuID, 0|1); + * Test it with plugin command: /test enablemenu <0|1> + * Menus are enabled by default. Please note that shown menus will not automatically enable or disable when calling this function to + * ensure Qt menus are not modified by any thread other the UI thread. The enabled or disable state will change the next time a + * menu is displayed. + */ + /* For example, this would disable MENU_ID_GLOBAL_2: */ + /* ts3Functions.setPluginMenuEnabled(pluginID, MENU_ID_GLOBAL_2, 0); */ + + /* All memory allocated in this function will be automatically released by the TeamSpeak client later by calling ts3plugin_freeMemory */ +} + +/* Helper function to create a hotkey */ +static struct PluginHotkey* createHotkey(const char* keyword, const char* description) { + struct PluginHotkey* hotkey = (struct PluginHotkey*)malloc(sizeof(struct PluginHotkey)); + _strcpy(hotkey->keyword, PLUGIN_HOTKEY_BUFSZ, keyword); + _strcpy(hotkey->description, PLUGIN_HOTKEY_BUFSZ, description); + return hotkey; +} + +/* Some makros to make the code to create hotkeys a bit more readable */ +#define BEGIN_CREATE_HOTKEYS(x) const size_t sz = x + 1; size_t n = 0; *hotkeys = (struct PluginHotkey**)malloc(sizeof(struct PluginHotkey*) * sz); +#define CREATE_HOTKEY(a, b) (*hotkeys)[n++] = createHotkey(a, b); +#define END_CREATE_HOTKEYS (*hotkeys)[n++] = NULL; assert(n == sz); + +/* + * Initialize plugin hotkeys. If your plugin does not use this feature, this function can be omitted. + * Hotkeys require ts3plugin_registerPluginID and ts3plugin_freeMemory to be implemented. + * This function is automatically called by the client after ts3plugin_init. + */ +void ts3plugin_initHotkeys(struct PluginHotkey*** hotkeys) { + /* Register hotkeys giving a keyword and a description. + * The keyword will be later passed to ts3plugin_onHotkeyEvent to identify which hotkey was triggered. + * The description is shown in the clients hotkey dialog. */ + BEGIN_CREATE_HOTKEYS(3); /* Create 3 hotkeys. Size must be correct for allocating memory. */ + CREATE_HOTKEY("keyword_1", "Test hotkey 1"); + CREATE_HOTKEY("keyword_2", "Test hotkey 2"); + CREATE_HOTKEY("keyword_3", "Test hotkey 3"); + END_CREATE_HOTKEYS; + + /* The client will call ts3plugin_freeMemory to release all allocated memory */ +} + +/************************** TeamSpeak callbacks ***************************/ +/* + * Following functions are optional, feel free to remove unused callbacks. + * See the clientlib documentation for details on each function. + */ + +/* Clientlib */ + +void ts3plugin_onConnectStatusChangeEvent(uint64 serverConnectionHandlerID, int newStatus, unsigned int errorNumber) { + /* Some example code following to show how to use the information query functions. */ + + if(newStatus == STATUS_CONNECTION_ESTABLISHED) { /* connection established and we have client and channels available */ + char* s; + char msg[1024]; + anyID myID; + uint64* ids; + size_t i; + unsigned int error; + + /* Print clientlib version */ + if(ts3Functions.getClientLibVersion(&s) == ERROR_ok) { + printf("PLUGIN: Client lib version: %s\n", s); + ts3Functions.freeMemory(s); /* Release string */ + } else { + ts3Functions.logMessage("Error querying client lib version", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + return; + } + + /* Write plugin name and version to log */ + snprintf(msg, sizeof(msg), "Plugin %s, Version %s, Author: %s", ts3plugin_name(), ts3plugin_version(), ts3plugin_author()); + ts3Functions.logMessage(msg, LogLevel_INFO, "Plugin", serverConnectionHandlerID); + + /* Print virtual server name */ + if((error = ts3Functions.getServerVariableAsString(serverConnectionHandlerID, VIRTUALSERVER_NAME, &s)) != ERROR_ok) { + if(error != ERROR_not_connected) { /* Don't spam error in this case (failed to connect) */ + ts3Functions.logMessage("Error querying server name", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + } + return; + } + printf("PLUGIN: Server name: %s\n", s); + ts3Functions.freeMemory(s); + + /* Print virtual server welcome message */ + if(ts3Functions.getServerVariableAsString(serverConnectionHandlerID, VIRTUALSERVER_WELCOMEMESSAGE, &s) != ERROR_ok) { + ts3Functions.logMessage("Error querying server welcome message", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + return; + } + printf("PLUGIN: Server welcome message: %s\n", s); + ts3Functions.freeMemory(s); /* Release string */ + + /* Print own client ID and nickname on this server */ + if(ts3Functions.getClientID(serverConnectionHandlerID, &myID) != ERROR_ok) { + ts3Functions.logMessage("Error querying client ID", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + return; + } + if(ts3Functions.getClientSelfVariableAsString(serverConnectionHandlerID, CLIENT_NICKNAME, &s) != ERROR_ok) { + ts3Functions.logMessage("Error querying client nickname", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + return; + } + printf("PLUGIN: My client ID = %d, nickname = %s\n", myID, s); + ts3Functions.freeMemory(s); + + /* Print list of all channels on this server */ + if(ts3Functions.getChannelList(serverConnectionHandlerID, &ids) != ERROR_ok) { + ts3Functions.logMessage("Error getting channel list", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + return; + } + printf("PLUGIN: Available channels:\n"); + for(i=0; ids[i]; i++) { + /* Query channel name */ + if(ts3Functions.getChannelVariableAsString(serverConnectionHandlerID, ids[i], CHANNEL_NAME, &s) != ERROR_ok) { + ts3Functions.logMessage("Error querying channel name", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + return; + } + printf("PLUGIN: Channel ID = %llu, name = %s\n", (long long unsigned int)ids[i], s); + ts3Functions.freeMemory(s); + } + ts3Functions.freeMemory(ids); /* Release array */ + + /* Print list of existing server connection handlers */ + printf("PLUGIN: Existing server connection handlers:\n"); + if(ts3Functions.getServerConnectionHandlerList(&ids) != ERROR_ok) { + ts3Functions.logMessage("Error getting server list", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + return; + } + for(i=0; ids[i]; i++) { + if((error = ts3Functions.getServerVariableAsString(ids[i], VIRTUALSERVER_NAME, &s)) != ERROR_ok) { + if(error != ERROR_not_connected) { /* Don't spam error in this case (failed to connect) */ + ts3Functions.logMessage("Error querying server name", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + } + continue; + } + printf("- %llu - %s\n", (long long unsigned int)ids[i], s); + ts3Functions.freeMemory(s); + } + ts3Functions.freeMemory(ids); + } +} + +void ts3plugin_onNewChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID) { +} + +void ts3plugin_onNewChannelCreatedEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) { +} + +void ts3plugin_onDelChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) { +} + +void ts3plugin_onChannelMoveEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 newChannelParentID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) { +} + +void ts3plugin_onUpdateChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID) { +} + +void ts3plugin_onUpdateChannelEditedEvent(uint64 serverConnectionHandlerID, uint64 channelID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) { +} + +void ts3plugin_onUpdateClientEvent(uint64 serverConnectionHandlerID, anyID clientID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier) { +} + +void ts3plugin_onClientMoveEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* moveMessage) { +} + +void ts3plugin_onClientMoveSubscriptionEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility) { +} + +void ts3plugin_onClientMoveTimeoutEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* timeoutMessage) { +} + +void ts3plugin_onClientMoveMovedEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID moverID, const char* moverName, const char* moverUniqueIdentifier, const char* moveMessage) { +} + +void ts3plugin_onClientKickFromChannelEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID kickerID, const char* kickerName, const char* kickerUniqueIdentifier, const char* kickMessage) { +} + +void ts3plugin_onClientKickFromServerEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID kickerID, const char* kickerName, const char* kickerUniqueIdentifier, const char* kickMessage) { +} + +void ts3plugin_onClientIDsEvent(uint64 serverConnectionHandlerID, const char* uniqueClientIdentifier, anyID clientID, const char* clientName) { +} + +void ts3plugin_onClientIDsFinishedEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onServerEditedEvent(uint64 serverConnectionHandlerID, anyID editerID, const char* editerName, const char* editerUniqueIdentifier) { +} + +void ts3plugin_onServerUpdatedEvent(uint64 serverConnectionHandlerID) { +} + +int ts3plugin_onServerErrorEvent(uint64 serverConnectionHandlerID, const char* errorMessage, unsigned int error, const char* returnCode, const char* extraMessage) { + printf("PLUGIN: onServerErrorEvent %llu %s %d %s\n", (long long unsigned int)serverConnectionHandlerID, errorMessage, error, (returnCode ? returnCode : "")); + if(returnCode) { + /* A plugin could now check the returnCode with previously (when calling a function) remembered returnCodes and react accordingly */ + /* In case of using a a plugin return code, the plugin can return: + * 0: Client will continue handling this error (print to chat tab) + * 1: Client will ignore this error, the plugin announces it has handled it */ + return 1; + } + return 0; /* If no plugin return code was used, the return value of this function is ignored */ +} + +void ts3plugin_onServerStopEvent(uint64 serverConnectionHandlerID, const char* shutdownMessage) { +} + +int ts3plugin_onTextMessageEvent(uint64 serverConnectionHandlerID, anyID targetMode, anyID toID, anyID fromID, const char* fromName, const char* fromUniqueIdentifier, const char* message, int ffIgnored) { + printf("PLUGIN: onTextMessageEvent %llu %d %d %s %s %d\n", (long long unsigned int)serverConnectionHandlerID, targetMode, fromID, fromName, message, ffIgnored); + + /* Friend/Foe manager has ignored the message, so ignore here as well. */ + if(ffIgnored) { + return 0; /* Client will ignore the message anyways, so return value here doesn't matter */ + } + +#if 0 + { + /* Example code: Autoreply to sender */ + /* Disabled because quite annoying, but should give you some ideas what is possible here */ + /* Careful, when two clients use this, they will get banned quickly... */ + anyID myID; + if(ts3Functions.getClientID(serverConnectionHandlerID, &myID) != ERROR_ok) { + ts3Functions.logMessage("Error querying own client id", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + return 0; + } + if(fromID != myID) { /* Don't reply when source is own client */ + if(ts3Functions.requestSendPrivateTextMsg(serverConnectionHandlerID, "Text message back!", fromID, NULL) != ERROR_ok) { + ts3Functions.logMessage("Error requesting send text message", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + } + } + } +#endif + + return 0; /* 0 = handle normally, 1 = client will ignore the text message */ +} + +void ts3plugin_onTalkStatusChangeEvent(uint64 serverConnectionHandlerID, int status, int isReceivedWhisper, anyID clientID) { + /* Demonstrate usage of getClientDisplayName */ + char name[512]; + if(ts3Functions.getClientDisplayName(serverConnectionHandlerID, clientID, name, 512) == ERROR_ok) { + if(status == STATUS_TALKING) { + printf("--> %s starts talking\n", name); + } else { + printf("--> %s stops talking\n", name); + } + } +} + +void ts3plugin_onConnectionInfoEvent(uint64 serverConnectionHandlerID, anyID clientID) { +} + +void ts3plugin_onServerConnectionInfoEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onChannelSubscribeEvent(uint64 serverConnectionHandlerID, uint64 channelID) { +} + +void ts3plugin_onChannelSubscribeFinishedEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onChannelUnsubscribeEvent(uint64 serverConnectionHandlerID, uint64 channelID) { +} + +void ts3plugin_onChannelUnsubscribeFinishedEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onChannelDescriptionUpdateEvent(uint64 serverConnectionHandlerID, uint64 channelID) { +} + +void ts3plugin_onChannelPasswordChangedEvent(uint64 serverConnectionHandlerID, uint64 channelID) { +} + +void ts3plugin_onPlaybackShutdownCompleteEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onSoundDeviceListChangedEvent(const char* modeID, int playOrCap) { +} + +void ts3plugin_onEditPlaybackVoiceDataEvent(uint64 serverConnectionHandlerID, anyID clientID, short* samples, int sampleCount, int channels) { +} + +void ts3plugin_onEditPostProcessVoiceDataEvent(uint64 serverConnectionHandlerID, anyID clientID, short* samples, int sampleCount, int channels, const unsigned int* channelSpeakerArray, unsigned int* channelFillMask) { +} + +void ts3plugin_onEditMixedPlaybackVoiceDataEvent(uint64 serverConnectionHandlerID, short* samples, int sampleCount, int channels, const unsigned int* channelSpeakerArray, unsigned int* channelFillMask) { +} + +void ts3plugin_onEditCapturedVoiceDataEvent(uint64 serverConnectionHandlerID, short* samples, int sampleCount, int channels, int* edited) { +} + +void ts3plugin_onCustom3dRolloffCalculationClientEvent(uint64 serverConnectionHandlerID, anyID clientID, float distance, float* volume) { +} + +void ts3plugin_onCustom3dRolloffCalculationWaveEvent(uint64 serverConnectionHandlerID, uint64 waveHandle, float distance, float* volume) { +} + +void ts3plugin_onUserLoggingMessageEvent(const char* logMessage, int logLevel, const char* logChannel, uint64 logID, const char* logTime, const char* completeLogString) { +} + +/* Clientlib rare */ + +void ts3plugin_onClientBanFromServerEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID kickerID, const char* kickerName, const char* kickerUniqueIdentifier, uint64 time, const char* kickMessage) { +} + +int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClientID, const char* pokerName, const char* pokerUniqueIdentity, const char* message, int ffIgnored) { + anyID myID; + + printf("PLUGIN onClientPokeEvent: %llu %d %s %s %d\n", (long long unsigned int)serverConnectionHandlerID, fromClientID, pokerName, message, ffIgnored); + + /* Check if the Friend/Foe manager has already blocked this poke */ + if(ffIgnored) { + return 0; /* Client will block anyways, doesn't matter what we return */ + } + + /* Example code: Send text message back to poking client */ + if(ts3Functions.getClientID(serverConnectionHandlerID, &myID) != ERROR_ok) { /* Get own client ID */ + ts3Functions.logMessage("Error querying own client id", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + return 0; + } + if(fromClientID != myID) { /* Don't reply when source is own client */ + if(ts3Functions.requestSendPrivateTextMsg(serverConnectionHandlerID, "Received your poke!", fromClientID, NULL) != ERROR_ok) { + ts3Functions.logMessage("Error requesting send text message", LogLevel_ERROR, "Plugin", serverConnectionHandlerID); + } + } + + return 0; /* 0 = handle normally, 1 = client will ignore the poke */ +} + +void ts3plugin_onClientSelfVariableUpdateEvent(uint64 serverConnectionHandlerID, int flag, const char* oldValue, const char* newValue) { +} + +void ts3plugin_onFileListEvent(uint64 serverConnectionHandlerID, uint64 channelID, const char* path, const char* name, uint64 size, uint64 datetime, int type, uint64 incompletesize, const char* returnCode) { +} + +void ts3plugin_onFileListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelID, const char* path) { +} + +void ts3plugin_onFileInfoEvent(uint64 serverConnectionHandlerID, uint64 channelID, const char* name, uint64 size, uint64 datetime) { +} + +void ts3plugin_onServerGroupListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, const char* name, int type, int iconID, int saveDB) { +} + +void ts3plugin_onServerGroupListFinishedEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onServerGroupByClientIDEvent(uint64 serverConnectionHandlerID, const char* name, uint64 serverGroupList, uint64 clientDatabaseID) { +} + +void ts3plugin_onServerGroupPermListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip) { +} + +void ts3plugin_onServerGroupPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID) { +} + +void ts3plugin_onServerGroupClientListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, uint64 clientDatabaseID, const char* clientNameIdentifier, const char* clientUniqueID) { +} + +void ts3plugin_onChannelGroupListEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, const char* name, int type, int iconID, int saveDB) { +} + +void ts3plugin_onChannelGroupListFinishedEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onChannelGroupPermListEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip) { +} + +void ts3plugin_onChannelGroupPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID) { +} + +void ts3plugin_onChannelPermListEvent(uint64 serverConnectionHandlerID, uint64 channelID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip) { +} + +void ts3plugin_onChannelPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelID) { +} + +void ts3plugin_onClientPermListEvent(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip) { +} + +void ts3plugin_onClientPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 clientDatabaseID) { +} + +void ts3plugin_onChannelClientPermListEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip) { +} + +void ts3plugin_onChannelClientPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID) { +} + +void ts3plugin_onClientChannelGroupChangedEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, uint64 channelID, anyID clientID, anyID invokerClientID, const char* invokerName, const char* invokerUniqueIdentity) { +} + +int ts3plugin_onServerPermissionErrorEvent(uint64 serverConnectionHandlerID, const char* errorMessage, unsigned int error, const char* returnCode, unsigned int failedPermissionID) { + return 0; /* See onServerErrorEvent for return code description */ +} + +void ts3plugin_onPermissionListGroupEndIDEvent(uint64 serverConnectionHandlerID, unsigned int groupEndID) { +} + +void ts3plugin_onPermissionListEvent(uint64 serverConnectionHandlerID, unsigned int permissionID, const char* permissionName, const char* permissionDescription) { +} + +void ts3plugin_onPermissionListFinishedEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onPermissionOverviewEvent(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, uint64 channelID, int overviewType, uint64 overviewID1, uint64 overviewID2, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip) { +} + +void ts3plugin_onPermissionOverviewFinishedEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onServerGroupClientAddedEvent(uint64 serverConnectionHandlerID, anyID clientID, const char* clientName, const char* clientUniqueIdentity, uint64 serverGroupID, anyID invokerClientID, const char* invokerName, const char* invokerUniqueIdentity) { +} + +void ts3plugin_onServerGroupClientDeletedEvent(uint64 serverConnectionHandlerID, anyID clientID, const char* clientName, const char* clientUniqueIdentity, uint64 serverGroupID, anyID invokerClientID, const char* invokerName, const char* invokerUniqueIdentity) { +} + +void ts3plugin_onClientNeededPermissionsEvent(uint64 serverConnectionHandlerID, unsigned int permissionID, int permissionValue) { +} + +void ts3plugin_onClientNeededPermissionsFinishedEvent(uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onFileTransferStatusEvent(anyID transferID, unsigned int status, const char* statusMessage, uint64 remotefileSize, uint64 serverConnectionHandlerID) { +} + +void ts3plugin_onClientChatClosedEvent(uint64 serverConnectionHandlerID, anyID clientID, const char* clientUniqueIdentity) { +} + +void ts3plugin_onClientChatComposingEvent(uint64 serverConnectionHandlerID, anyID clientID, const char* clientUniqueIdentity) { +} + +void ts3plugin_onServerLogEvent(uint64 serverConnectionHandlerID, const char* logMsg) { +} + +void ts3plugin_onServerLogFinishedEvent(uint64 serverConnectionHandlerID, uint64 lastPos, uint64 fileSize) { +} + +void ts3plugin_onMessageListEvent(uint64 serverConnectionHandlerID, uint64 messageID, const char* fromClientUniqueIdentity, const char* subject, uint64 timestamp, int flagRead) { +} + +void ts3plugin_onMessageGetEvent(uint64 serverConnectionHandlerID, uint64 messageID, const char* fromClientUniqueIdentity, const char* subject, const char* message, uint64 timestamp) { +} + +void ts3plugin_onClientDBIDfromUIDEvent(uint64 serverConnectionHandlerID, const char* uniqueClientIdentifier, uint64 clientDatabaseID) { +} + +void ts3plugin_onClientNamefromUIDEvent(uint64 serverConnectionHandlerID, const char* uniqueClientIdentifier, uint64 clientDatabaseID, const char* clientNickName) { +} + +void ts3plugin_onClientNamefromDBIDEvent(uint64 serverConnectionHandlerID, const char* uniqueClientIdentifier, uint64 clientDatabaseID, const char* clientNickName) { +} + +void ts3plugin_onComplainListEvent(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, const char* targetClientNickName, uint64 fromClientDatabaseID, const char* fromClientNickName, const char* complainReason, uint64 timestamp) { +} + +void ts3plugin_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) { +} + +void ts3plugin_onClientServerQueryLoginPasswordEvent(uint64 serverConnectionHandlerID, const char* loginPassword) { +} + +void ts3plugin_onPluginCommandEvent(uint64 serverConnectionHandlerID, const char* pluginName, const char* pluginCommand, anyID invokerClientID, const char* invokerName, const char* invokerUniqueIdentity) { + printf("ON PLUGIN COMMAND: %s %s %d %s %s\n", pluginName, pluginCommand, invokerClientID, invokerName, invokerUniqueIdentity); +} + +void ts3plugin_onIncomingClientQueryEvent(uint64 serverConnectionHandlerID, const char* commandText) { +} + +void ts3plugin_onServerTemporaryPasswordListEvent(uint64 serverConnectionHandlerID, const char* clientNickname, const char* uniqueClientIdentifier, const char* description, const char* password, uint64 timestampStart, uint64 timestampEnd, uint64 targetChannelID, const char* targetChannelPW) { +} + +/* Client UI callbacks */ + +/* + * Called from client when an avatar image has been downloaded to or deleted from cache. + * This callback can be called spontaneously or in response to ts3Functions.getAvatar() + */ +void ts3plugin_onAvatarUpdated(uint64 serverConnectionHandlerID, anyID clientID, const char* avatarPath) { + /* If avatarPath is NULL, the avatar got deleted */ + /* If not NULL, avatarPath contains the path to the avatar file in the TS3Client cache */ + if(avatarPath != NULL) { + printf("onAvatarUpdated: %llu %d %s\n", (long long unsigned int)serverConnectionHandlerID, clientID, avatarPath); + } else { + printf("onAvatarUpdated: %llu %d - deleted\n", (long long unsigned int)serverConnectionHandlerID, clientID); + } +} + +/* + * Called when a plugin menu item (see ts3plugin_initMenus) is triggered. Optional function, when not using plugin menus, do not implement this. + * + * Parameters: + * - serverConnectionHandlerID: ID of the current server tab + * - type: Type of the menu (PLUGIN_MENU_TYPE_CHANNEL, PLUGIN_MENU_TYPE_CLIENT or PLUGIN_MENU_TYPE_GLOBAL) + * - menuItemID: Id used when creating the menu item + * - selectedItemID: Channel or Client ID in the case of PLUGIN_MENU_TYPE_CHANNEL and PLUGIN_MENU_TYPE_CLIENT. 0 for PLUGIN_MENU_TYPE_GLOBAL. + */ +void ts3plugin_onMenuItemEvent(uint64 serverConnectionHandlerID, enum PluginMenuType type, int menuItemID, uint64 selectedItemID) { + printf("PLUGIN: onMenuItemEvent: serverConnectionHandlerID=%llu, type=%d, menuItemID=%d, selectedItemID=%llu\n", (long long unsigned int)serverConnectionHandlerID, type, menuItemID, (long long unsigned int)selectedItemID); + switch(type) { + case PLUGIN_MENU_TYPE_GLOBAL: + /* Global menu item was triggered. selectedItemID is unused and set to zero. */ + switch(menuItemID) { + case MENU_ID_GLOBAL_1: + /* Menu global 1 was triggered */ + break; + case MENU_ID_GLOBAL_2: + /* Menu global 2 was triggered */ + break; + default: + break; + } + break; + case PLUGIN_MENU_TYPE_CHANNEL: + /* Channel contextmenu item was triggered. selectedItemID is the channelID of the selected channel */ + switch(menuItemID) { + case MENU_ID_CHANNEL_1: + /* Menu channel 1 was triggered */ + break; + case MENU_ID_CHANNEL_2: + /* Menu channel 2 was triggered */ + break; + case MENU_ID_CHANNEL_3: + /* Menu channel 3 was triggered */ + break; + default: + break; + } + break; + case PLUGIN_MENU_TYPE_CLIENT: + /* Client contextmenu item was triggered. selectedItemID is the clientID of the selected client */ + switch(menuItemID) { + case MENU_ID_CLIENT_1: + /* Menu client 1 was triggered */ + break; + case MENU_ID_CLIENT_2: + /* Menu client 2 was triggered */ + break; + default: + break; + } + break; + default: + break; + } +} + +/* This function is called if a plugin hotkey was pressed. Omit if hotkeys are unused. */ +void ts3plugin_onHotkeyEvent(const char* keyword) { + printf("PLUGIN: Hotkey event: %s\n", keyword); + /* Identify the hotkey by keyword ("keyword_1", "keyword_2" or "keyword_3" in this example) and handle here... */ +} + +/* Called when recording a hotkey has finished after calling ts3Functions.requestHotkeyInputDialog */ +void ts3plugin_onHotkeyRecordedEvent(const char* keyword, const char* key) { +} + +// This function receives your key Identifier you send to notifyKeyEvent and should return +// the friendly device name of the device this hotkey originates from. Used for display in UI. +const char* ts3plugin_keyDeviceName(const char* keyIdentifier) { + return NULL; +} + +// This function translates the given key identifier to a friendly key name for display in the UI +const char* ts3plugin_displayKeyText(const char* keyIdentifier) { + return NULL; +} + +// This is used internally as a prefix for hotkeys so we can store them without collisions. +// Should be unique across plugins. +const char* ts3plugin_keyPrefix() { + return NULL; +} + +/* Called when client custom nickname changed */ +void ts3plugin_onClientDisplayNameChanged(uint64 serverConnectionHandlerID, anyID clientID, const char* displayName, const char* uniqueClientIdentifier) { +} diff --git a/src/plugin.h b/src/plugin.h new file mode 100644 index 0000000..f045cb4 --- /dev/null +++ b/src/plugin.h @@ -0,0 +1,150 @@ +/* + * TeamSpeak 3 demo plugin + * + * Copyright (c) TeamSpeak Systems GmbH + */ + +#ifndef PLUGIN_H +#define PLUGIN_H + +#if defined(WIN32) || defined(__WIN32__) || defined(_WIN32) +#define PLUGINS_EXPORTDLL __declspec(dllexport) +#else +#define PLUGINS_EXPORTDLL __attribute__ ((visibility("default"))) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Required functions */ +PLUGINS_EXPORTDLL const char* ts3plugin_name(); +PLUGINS_EXPORTDLL const char* ts3plugin_version(); +PLUGINS_EXPORTDLL int ts3plugin_apiVersion(); +PLUGINS_EXPORTDLL const char* ts3plugin_author(); +PLUGINS_EXPORTDLL const char* ts3plugin_description(); +PLUGINS_EXPORTDLL void ts3plugin_setFunctionPointers(const struct TS3Functions funcs); +PLUGINS_EXPORTDLL int ts3plugin_init(); +PLUGINS_EXPORTDLL void ts3plugin_shutdown(); + +/* Optional functions */ +PLUGINS_EXPORTDLL int ts3plugin_offersConfigure(); +PLUGINS_EXPORTDLL void ts3plugin_configure(void* handle, void* qParentWidget); +PLUGINS_EXPORTDLL void ts3plugin_registerPluginID(const char* id); +PLUGINS_EXPORTDLL const char* ts3plugin_commandKeyword(); +PLUGINS_EXPORTDLL int ts3plugin_processCommand(uint64 serverConnectionHandlerID, const char* command); +PLUGINS_EXPORTDLL void ts3plugin_currentServerConnectionChanged(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL const char* ts3plugin_infoTitle(); +PLUGINS_EXPORTDLL void ts3plugin_infoData(uint64 serverConnectionHandlerID, uint64 id, enum PluginItemType type, char** data); +PLUGINS_EXPORTDLL void ts3plugin_freeMemory(void* data); +PLUGINS_EXPORTDLL int ts3plugin_requestAutoload(); +PLUGINS_EXPORTDLL void ts3plugin_initMenus(struct PluginMenuItem*** menuItems, char** menuIcon); +PLUGINS_EXPORTDLL void ts3plugin_initHotkeys(struct PluginHotkey*** hotkeys); + +/* Clientlib */ +PLUGINS_EXPORTDLL void ts3plugin_onConnectStatusChangeEvent(uint64 serverConnectionHandlerID, int newStatus, unsigned int errorNumber); +PLUGINS_EXPORTDLL void ts3plugin_onNewChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID); +PLUGINS_EXPORTDLL void ts3plugin_onNewChannelCreatedEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 channelParentID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier); +PLUGINS_EXPORTDLL void ts3plugin_onDelChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier); +PLUGINS_EXPORTDLL void ts3plugin_onChannelMoveEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 newChannelParentID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier); +PLUGINS_EXPORTDLL void ts3plugin_onUpdateChannelEvent(uint64 serverConnectionHandlerID, uint64 channelID); +PLUGINS_EXPORTDLL void ts3plugin_onUpdateChannelEditedEvent(uint64 serverConnectionHandlerID, uint64 channelID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier); +PLUGINS_EXPORTDLL void ts3plugin_onUpdateClientEvent(uint64 serverConnectionHandlerID, anyID clientID, anyID invokerID, const char* invokerName, const char* invokerUniqueIdentifier); +PLUGINS_EXPORTDLL void ts3plugin_onClientMoveEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* moveMessage); +PLUGINS_EXPORTDLL void ts3plugin_onClientMoveSubscriptionEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility); +PLUGINS_EXPORTDLL void ts3plugin_onClientMoveTimeoutEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, const char* timeoutMessage); +PLUGINS_EXPORTDLL void ts3plugin_onClientMoveMovedEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID moverID, const char* moverName, const char* moverUniqueIdentifier, const char* moveMessage); +PLUGINS_EXPORTDLL void ts3plugin_onClientKickFromChannelEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID kickerID, const char* kickerName, const char* kickerUniqueIdentifier, const char* kickMessage); +PLUGINS_EXPORTDLL void ts3plugin_onClientKickFromServerEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID kickerID, const char* kickerName, const char* kickerUniqueIdentifier, const char* kickMessage); +PLUGINS_EXPORTDLL void ts3plugin_onClientIDsEvent(uint64 serverConnectionHandlerID, const char* uniqueClientIdentifier, anyID clientID, const char* clientName); +PLUGINS_EXPORTDLL void ts3plugin_onClientIDsFinishedEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onServerEditedEvent(uint64 serverConnectionHandlerID, anyID editerID, const char* editerName, const char* editerUniqueIdentifier); +PLUGINS_EXPORTDLL void ts3plugin_onServerUpdatedEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL int ts3plugin_onServerErrorEvent(uint64 serverConnectionHandlerID, const char* errorMessage, unsigned int error, const char* returnCode, const char* extraMessage); +PLUGINS_EXPORTDLL void ts3plugin_onServerStopEvent(uint64 serverConnectionHandlerID, const char* shutdownMessage); +PLUGINS_EXPORTDLL int ts3plugin_onTextMessageEvent(uint64 serverConnectionHandlerID, anyID targetMode, anyID toID, anyID fromID, const char* fromName, const char* fromUniqueIdentifier, const char* message, int ffIgnored); +PLUGINS_EXPORTDLL void ts3plugin_onTalkStatusChangeEvent(uint64 serverConnectionHandlerID, int status, int isReceivedWhisper, anyID clientID); +PLUGINS_EXPORTDLL void ts3plugin_onConnectionInfoEvent(uint64 serverConnectionHandlerID, anyID clientID); +PLUGINS_EXPORTDLL void ts3plugin_onServerConnectionInfoEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelSubscribeEvent(uint64 serverConnectionHandlerID, uint64 channelID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelSubscribeFinishedEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelUnsubscribeEvent(uint64 serverConnectionHandlerID, uint64 channelID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelUnsubscribeFinishedEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelDescriptionUpdateEvent(uint64 serverConnectionHandlerID, uint64 channelID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelPasswordChangedEvent(uint64 serverConnectionHandlerID, uint64 channelID); +PLUGINS_EXPORTDLL void ts3plugin_onPlaybackShutdownCompleteEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onSoundDeviceListChangedEvent(const char* modeID, int playOrCap); +PLUGINS_EXPORTDLL void ts3plugin_onEditPlaybackVoiceDataEvent(uint64 serverConnectionHandlerID, anyID clientID, short* samples, int sampleCount, int channels); +PLUGINS_EXPORTDLL void ts3plugin_onEditPostProcessVoiceDataEvent(uint64 serverConnectionHandlerID, anyID clientID, short* samples, int sampleCount, int channels, const unsigned int* channelSpeakerArray, unsigned int* channelFillMask); +PLUGINS_EXPORTDLL void ts3plugin_onEditMixedPlaybackVoiceDataEvent(uint64 serverConnectionHandlerID, short* samples, int sampleCount, int channels, const unsigned int* channelSpeakerArray, unsigned int* channelFillMask); +PLUGINS_EXPORTDLL void ts3plugin_onEditCapturedVoiceDataEvent(uint64 serverConnectionHandlerID, short* samples, int sampleCount, int channels, int* edited); +PLUGINS_EXPORTDLL void ts3plugin_onCustom3dRolloffCalculationClientEvent(uint64 serverConnectionHandlerID, anyID clientID, float distance, float* volume); +PLUGINS_EXPORTDLL void ts3plugin_onCustom3dRolloffCalculationWaveEvent(uint64 serverConnectionHandlerID, uint64 waveHandle, float distance, float* volume); +PLUGINS_EXPORTDLL void ts3plugin_onUserLoggingMessageEvent(const char* logMessage, int logLevel, const char* logChannel, uint64 logID, const char* logTime, const char* completeLogString); + +/* Clientlib rare */ +PLUGINS_EXPORTDLL void ts3plugin_onClientBanFromServerEvent(uint64 serverConnectionHandlerID, anyID clientID, uint64 oldChannelID, uint64 newChannelID, int visibility, anyID kickerID, const char* kickerName, const char* kickerUniqueIdentifier, uint64 time, const char* kickMessage); +PLUGINS_EXPORTDLL int ts3plugin_onClientPokeEvent(uint64 serverConnectionHandlerID, anyID fromClientID, const char* pokerName, const char* pokerUniqueIdentity, const char* message, int ffIgnored); +PLUGINS_EXPORTDLL void ts3plugin_onClientSelfVariableUpdateEvent(uint64 serverConnectionHandlerID, int flag, const char* oldValue, const char* newValue); +PLUGINS_EXPORTDLL void ts3plugin_onFileListEvent(uint64 serverConnectionHandlerID, uint64 channelID, const char* path, const char* name, uint64 size, uint64 datetime, int type, uint64 incompletesize, const char* returnCode); +PLUGINS_EXPORTDLL void ts3plugin_onFileListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelID, const char* path); +PLUGINS_EXPORTDLL void ts3plugin_onFileInfoEvent(uint64 serverConnectionHandlerID, uint64 channelID, const char* name, uint64 size, uint64 datetime); +PLUGINS_EXPORTDLL void ts3plugin_onServerGroupListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, const char* name, int type, int iconID, int saveDB); +PLUGINS_EXPORTDLL void ts3plugin_onServerGroupListFinishedEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onServerGroupByClientIDEvent(uint64 serverConnectionHandlerID, const char* name, uint64 serverGroupList, uint64 clientDatabaseID); +PLUGINS_EXPORTDLL void ts3plugin_onServerGroupPermListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip); +PLUGINS_EXPORTDLL void ts3plugin_onServerGroupPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID); +PLUGINS_EXPORTDLL void ts3plugin_onServerGroupClientListEvent(uint64 serverConnectionHandlerID, uint64 serverGroupID, uint64 clientDatabaseID, const char* clientNameIdentifier, const char* clientUniqueID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelGroupListEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, const char* name, int type, int iconID, int saveDB); +PLUGINS_EXPORTDLL void ts3plugin_onChannelGroupListFinishedEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelGroupPermListEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip); +PLUGINS_EXPORTDLL void ts3plugin_onChannelGroupPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelPermListEvent(uint64 serverConnectionHandlerID, uint64 channelID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip); +PLUGINS_EXPORTDLL void ts3plugin_onChannelPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelID); +PLUGINS_EXPORTDLL void ts3plugin_onClientPermListEvent(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip); +PLUGINS_EXPORTDLL void ts3plugin_onClientPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 clientDatabaseID); +PLUGINS_EXPORTDLL void ts3plugin_onChannelClientPermListEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip); +PLUGINS_EXPORTDLL void ts3plugin_onChannelClientPermListFinishedEvent(uint64 serverConnectionHandlerID, uint64 channelID, uint64 clientDatabaseID); +PLUGINS_EXPORTDLL void ts3plugin_onClientChannelGroupChangedEvent(uint64 serverConnectionHandlerID, uint64 channelGroupID, uint64 channelID, anyID clientID, anyID invokerClientID, const char* invokerName, const char* invokerUniqueIdentity); +PLUGINS_EXPORTDLL int ts3plugin_onServerPermissionErrorEvent(uint64 serverConnectionHandlerID, const char* errorMessage, unsigned int error, const char* returnCode, unsigned int failedPermissionID); +PLUGINS_EXPORTDLL void ts3plugin_onPermissionListGroupEndIDEvent(uint64 serverConnectionHandlerID, unsigned int groupEndID); +PLUGINS_EXPORTDLL void ts3plugin_onPermissionListEvent(uint64 serverConnectionHandlerID, unsigned int permissionID, const char* permissionName, const char* permissionDescription); +PLUGINS_EXPORTDLL void ts3plugin_onPermissionListFinishedEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onPermissionOverviewEvent(uint64 serverConnectionHandlerID, uint64 clientDatabaseID, uint64 channelID, int overviewType, uint64 overviewID1, uint64 overviewID2, unsigned int permissionID, int permissionValue, int permissionNegated, int permissionSkip); +PLUGINS_EXPORTDLL void ts3plugin_onPermissionOverviewFinishedEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onServerGroupClientAddedEvent(uint64 serverConnectionHandlerID, anyID clientID, const char* clientName, const char* clientUniqueIdentity, uint64 serverGroupID, anyID invokerClientID, const char* invokerName, const char* invokerUniqueIdentity); +PLUGINS_EXPORTDLL void ts3plugin_onServerGroupClientDeletedEvent(uint64 serverConnectionHandlerID, anyID clientID, const char* clientName, const char* clientUniqueIdentity, uint64 serverGroupID, anyID invokerClientID, const char* invokerName, const char* invokerUniqueIdentity); +PLUGINS_EXPORTDLL void ts3plugin_onClientNeededPermissionsEvent(uint64 serverConnectionHandlerID, unsigned int permissionID, int permissionValue); +PLUGINS_EXPORTDLL void ts3plugin_onClientNeededPermissionsFinishedEvent(uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onFileTransferStatusEvent(anyID transferID, unsigned int status, const char* statusMessage, uint64 remotefileSize, uint64 serverConnectionHandlerID); +PLUGINS_EXPORTDLL void ts3plugin_onClientChatClosedEvent(uint64 serverConnectionHandlerID, anyID clientID, const char* clientUniqueIdentity); +PLUGINS_EXPORTDLL void ts3plugin_onClientChatComposingEvent(uint64 serverConnectionHandlerID, anyID clientID, const char* clientUniqueIdentity); +PLUGINS_EXPORTDLL void ts3plugin_onServerLogEvent(uint64 serverConnectionHandlerID, const char* logMsg); +PLUGINS_EXPORTDLL void ts3plugin_onServerLogFinishedEvent(uint64 serverConnectionHandlerID, uint64 lastPos, uint64 fileSize); +PLUGINS_EXPORTDLL void ts3plugin_onMessageListEvent(uint64 serverConnectionHandlerID, uint64 messageID, const char* fromClientUniqueIdentity, const char* subject, uint64 timestamp, int flagRead); +PLUGINS_EXPORTDLL void ts3plugin_onMessageGetEvent(uint64 serverConnectionHandlerID, uint64 messageID, const char* fromClientUniqueIdentity, const char* subject, const char* message, uint64 timestamp); +PLUGINS_EXPORTDLL void ts3plugin_onClientDBIDfromUIDEvent(uint64 serverConnectionHandlerID, const char* uniqueClientIdentifier, uint64 clientDatabaseID); +PLUGINS_EXPORTDLL void ts3plugin_onClientNamefromUIDEvent(uint64 serverConnectionHandlerID, const char* uniqueClientIdentifier, uint64 clientDatabaseID, const char* clientNickName); +PLUGINS_EXPORTDLL void ts3plugin_onClientNamefromDBIDEvent(uint64 serverConnectionHandlerID, const char* uniqueClientIdentifier, uint64 clientDatabaseID, const char* clientNickName); +PLUGINS_EXPORTDLL void ts3plugin_onComplainListEvent(uint64 serverConnectionHandlerID, uint64 targetClientDatabaseID, const char* targetClientNickName, uint64 fromClientDatabaseID, const char* fromClientNickName, const char* complainReason, uint64 timestamp); +PLUGINS_EXPORTDLL void ts3plugin_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); +PLUGINS_EXPORTDLL void ts3plugin_onClientServerQueryLoginPasswordEvent(uint64 serverConnectionHandlerID, const char* loginPassword); +PLUGINS_EXPORTDLL void ts3plugin_onPluginCommandEvent(uint64 serverConnectionHandlerID, const char* pluginName, const char* pluginCommand, anyID invokerClientID, const char* invokerName, const char* invokerUniqueIdentity); +PLUGINS_EXPORTDLL void ts3plugin_onIncomingClientQueryEvent(uint64 serverConnectionHandlerID, const char* commandText); +PLUGINS_EXPORTDLL void ts3plugin_onServerTemporaryPasswordListEvent(uint64 serverConnectionHandlerID, const char* clientNickname, const char* uniqueClientIdentifier, const char* description, const char* password, uint64 timestampStart, uint64 timestampEnd, uint64 targetChannelID, const char* targetChannelPW); + +/* Client UI callbacks */ +PLUGINS_EXPORTDLL void ts3plugin_onAvatarUpdated(uint64 serverConnectionHandlerID, anyID clientID, const char* avatarPath); +PLUGINS_EXPORTDLL void ts3plugin_onMenuItemEvent(uint64 serverConnectionHandlerID, enum PluginMenuType type, int menuItemID, uint64 selectedItemID); +PLUGINS_EXPORTDLL void ts3plugin_onHotkeyEvent(const char* keyword); +PLUGINS_EXPORTDLL void ts3plugin_onHotkeyRecordedEvent(const char* keyword, const char* key); +PLUGINS_EXPORTDLL void ts3plugin_onClientDisplayNameChanged(uint64 serverConnectionHandlerID, anyID clientID, const char* displayName, const char* uniqueClientIdentifier); +PLUGINS_EXPORTDLL const char* ts3plugin_keyDeviceName(const char* keyIdentifier); +PLUGINS_EXPORTDLL const char* ts3plugin_displayKeyText(const char* keyIdentifier); +PLUGINS_EXPORTDLL const char* ts3plugin_keyPrefix(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/test_plugin.sln b/src/test_plugin.sln new file mode 100644 index 0000000..efc2a54 --- /dev/null +++ b/src/test_plugin.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29926.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_plugin", "test_plugin.vcxproj", "{192D646D-748B-450B-AF3D-BF8EDD5FC897}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {192D646D-748B-450B-AF3D-BF8EDD5FC897}.Debug|Win32.ActiveCfg = Debug|Win32 + {192D646D-748B-450B-AF3D-BF8EDD5FC897}.Debug|Win32.Build.0 = Debug|Win32 + {192D646D-748B-450B-AF3D-BF8EDD5FC897}.Debug|x64.ActiveCfg = Debug|x64 + {192D646D-748B-450B-AF3D-BF8EDD5FC897}.Debug|x64.Build.0 = Debug|x64 + {192D646D-748B-450B-AF3D-BF8EDD5FC897}.Release|Win32.ActiveCfg = Release|Win32 + {192D646D-748B-450B-AF3D-BF8EDD5FC897}.Release|Win32.Build.0 = Release|Win32 + {192D646D-748B-450B-AF3D-BF8EDD5FC897}.Release|x64.ActiveCfg = Release|x64 + {192D646D-748B-450B-AF3D-BF8EDD5FC897}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8FD60E3B-57E6-4338-A735-E4EFD3DFB6C2} + EndGlobalSection +EndGlobal diff --git a/src/test_plugin.vcxproj b/src/test_plugin.vcxproj new file mode 100644 index 0000000..f662893 --- /dev/null +++ b/src/test_plugin.vcxproj @@ -0,0 +1,165 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {192D646D-748B-450B-AF3D-BF8EDD5FC897} + test_plugin + Win32Proj + 10.0 + WIFILED + + + + DynamicLibrary + v120_xp + Unicode + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>12.0.30501.0 + + + \projects\teamspeak\plugins\ + $(Configuration)\ + WIFILED + + + WIFILED + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + + + + Disabled + ..\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;TEST_PLUGIN_EXPORTS;WINDOWS;WIN32_LEAN_AND_MEAN;NOFMOD;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + Level3 + ProgramDatabase + stdcpp14 + + + true + Windows + + MachineX86 + + + + + Disabled + ..\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;TEST_PLUGIN_EXPORTS;WINDOWS;WIN32_LEAN_AND_MEAN;NOFMOD;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + stdcpp14 + + + true + Windows + + + + + + + WIN32;NDEBUG;_WINDOWS;_USRDLL;TEST_PLUGIN_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + + Level3 + ProgramDatabase + ..\include;%(AdditionalIncludeDirectories) + + + Windows + + MachineX86 + + + + + WIN32;NDEBUG;_WINDOWS;_USRDLL;TEST_PLUGIN_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + ..\include;%(AdditionalIncludeDirectories) + + + Windows + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test_plugin.vcxproj.filters b/src/test_plugin.vcxproj.filters new file mode 100644 index 0000000..79cc68b --- /dev/null +++ b/src/test_plugin.vcxproj.filters @@ -0,0 +1,53 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {424f4ce9-e47e-43e3-91bc-85bbfec2c680} + + + {d76dfa87-907d-4936-a5cf-59462dba95d7} + + + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files\teamspeak + + + Header Files\teamspeak + + + Header Files\teamspeak + + + Header Files\teamspeak + + + Header Files\teamspeak + + + Header Files\teamlog + + + Header Files + + + \ No newline at end of file