Server information

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

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

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

unsigned int ts3client_getServerVariableAsString(serverConnectionHandlerID,  
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

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,  
uint64 serverConnectionHandlerID;
anyID editerID;
const char* editerName;
const char* editerUniqueIdentifier;