Server information

Available variables are defined in the VirtualServerProperties enum.

Query information

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

unsigned int ts3client_getServerVariableAsInt(uint64 serverConnectionHandlerID, size_t flag, int *result)

get the value of an integer server property.

Not all properties are available as integer. Some are only available as string or unsigned 64 bit integer.

Parameters:
  • serverConnectionHandlerID – specifies the server on which to retrieve the property

  • flag – specifies which property to retrieve. One of the values from the VirtualServerProperties or VirtualServerPropertiesRare enums

  • result – address of a variable to receive the property value on success.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

unsigned int ts3client_getServerVariableAsUInt64(uint64 serverConnectionHandlerID, size_t flag, uint64 *result)

get the value of an unsigned 64 bit integer server property.

Not all properties are available as unsigned 64 bit integer. Some are only available as string or integer.

Parameters:
  • serverConnectionHandlerID – specifies the server on which to retrieve the property

  • flag – specifies which property to retrieve. One of the values from the VirtualServerProperties or VirtualServerPropertiesRare enums

  • result – address of a variable to receive the property value on success.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

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

get the value of a string server property.

Not all properties are available as string. Some are only available as integer or unsigned 64 bit integer

Parameters:
  • serverConnectionHandlerID – specifies the server on which to retrieve the property

  • flag – specifies which property to retrieve. One of the values from the VirtualServerProperties or VirtualServerPropertiesRare enums

  • result – address of a variable to receive the property value on success. Memory is allocated by the client lib and must be freed by caller using ts3client_freeMemory

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

Example

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

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

Request updated information

A client can request updated server information for all variables that are not updated automatically using

unsigned int ts3client_requestServerVariables(uint64 serverConnectionHandlerID, const char *returnCode)

Make request only server variables available locally.

You will receive an onServerUpdateEvent once the request only properties are available. Prior to the callback being called the variables are not available, and querying them will yield undefined results.

Parameters:
  • serverConnectionHandlerID – connection handler on which to request the variables

  • returnCode – a c string to identify this request in callbacks. Pass an empty string if unused.

Returns:

An Error code from the Ts3ErrorType enum indicating either success or the failure reason

The following callback is called when the requested information is available

struct ClientUIFunctions

Defines available callbacks that you can receive.

Set the members of this struct to a function to call when the specific event happens.

Public Members

void (*onServerUpdatedEvent)(uint64 serverConnectionHandlerID)

called whenever updates about changed server properties are received from the server.

Happens after a call to ts3client_requestServerVariables but can also be called sporadically.

Param serverConnectionHandlerID:

specifies on which connection the updated variables are available

When the server was edited the following callback is called

struct ClientUIFunctions

Defines available callbacks that you can receive.

Set the members of this struct to a function to call when the specific event happens.

Public Members

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

called when the server was edited

Param serverConnectionHandlerID:

specifies on which connection the callback was called

Param editerID:

id of the client that edited the server

Param editerName:

utf8 encoded c string containing the display name of the client editing the server

Param editerUniqueIdentifier:

utf8 encoded c string containing the public identity of the client