Miscellaneous functions

Freeing memory

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

unsigned int ts3server_freeMemory(pointer); 
void* pointer;
 

  • pointer

    Address of the variable to be released.

Example:

char* version;

if(ts3server_getServerLibVersion(&version) == ERROR_ok) {
    printf("Version: %s\n", version);
    ts3server_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.


Setting the log level

The severity of log messages that are passed to the callback onUserLoggingMessageEvent can be configured with:

unsigned int ts3server_setLogVerbosity(logVerbosity); 
enum LogLevel logVerbosity;
 

  • logVerbosity

    Only messages with a LogLevel equal or higher than logVerbosity will be sent to the callback.

    The default value is LogLevel_DEVEL.

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

For example, after calling

ts3server_setLogVerbosity(LogLevel_ERROR);

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


Disabling protocol commands

SDK users can opt to disable specific protocol commands in a TeamSpeak server instance, so clients are unable to call these commands. The server can still issue disabled commands by calling the appropriate Server Lib functions.

This is an optional features. If certain commands are not disabled specifically, all commands are enabled by default.

For example, a SDK user may decide that clients should not be able to delete channels on a TeamSpeak server and implement this action in the Server Lib only. So he disabled the CLIENT_COMMAND_requestChannelDelete protocol command in the server and all client calls to ts3client_requestChannelDelete will be rejected by the server on the protocol level.

To disable specific protocol commands call:

unsigned int ts3server_disableClientCommand(clientCommand); 
int clientCommand;
 

  • clientCommand

    The command to disable in the server. Can be one of the following:

    enum ClientCommand {
    	CLIENT_COMMAND_requestConnectionInfo        =  0, 
    	CLIENT_COMMAND_requestClientMove            =  1, -> disables any channel switching requested by the client. (server can still move clients)
    	CLIENT_COMMAND_requestXXMuteClients         =  2, -> disable muting/unmuting clients
    	CLIENT_COMMAND_requestClientKickFromXXX     =  3, -> disable kick requests from clients
    	CLIENT_COMMAND_flushChannelCreation         =  4, -> disable creating new channels
    	CLIENT_COMMAND_flushChannelUpdates          =  5, -> disables editing(changing) channel 
    	CLIENT_COMMAND_requestChannelMove           =  6, -> disbale moving channels around
    	CLIENT_COMMAND_requestChannelDelete         =  7, -> disable deleting channels
    	CLIENT_COMMAND_requestChannelDescription    =  8, -> disable getting channel description
    	CLIENT_COMMAND_requestChannelXXSubscribeXXX =  9, -> disable subscriptions
    	CLIENT_COMMAND_requestServerConnectionInfo  = 10,
    	CLIENT_COMMAND_requestSendXXXTextMsg        = 11, -> disable sending text messages
        CLIENT_COMMAND_filetransfers                = 12, -> disable client filetransfer commands
        CLIENT_COMMAND_ENDMARKER
    };

If you want to disable multiple commands, call this function multiple times with one command per call.

There is no enable command. We recommend doing this call soon after calling ts3server_initServerLib.