List available clients, channels, servers
List servers
A list of all virtual servers can be queried with
-
unsigned int ts3server_getVirtualServerList(uint64 **result)
get a list of virtual servers in this instance
- Parameters:
result – address of a variable to receive a zero terminated array of virtual server ids. Like {4, 8, …, 0} Memory is allocated by the server library and caller must free the array using ts3server_freeMemory
- Returns:
An Error code from the Ts3ErrorType enum indicating either success or the failure reason
Note
Unless specified otherwise using advanced server creation the first virtual server has ID 1.
List clients
A list of all clients currently online on the specified virtual server can be queried with
-
unsigned int ts3server_getClientList(uint64 serverID, anyID **result)
get a list of all clients connected to a server
- Parameters:
serverID – specifies the server on which to get the list of clients
result – address of a variable to receive the zero terminated list of clients, like {1, 2, 50, …, 0} Memory is allocated by the server library and caller must free the array using ts3server_freeMemory
- Returns:
An Error code from the Ts3ErrorType enum indicating either success or the failure reason
To get a list of all clients currently in the specified channel
-
unsigned int ts3server_getChannelClientList(uint64 serverID, uint64 channelID, anyID **result)
get list of clients in a channel
- Parameters:
serverID – the server on which the channel is located
channelID – the channel of which to get the list of clients
result – address of a variable to receive a zero terminated array of client ids in the channel. Like {3, 5, 39, …, 0} Memory is allocated by the server library and caller must free the array using ts3server_freeMemory
- Returns:
An Error code from the Ts3ErrorType enum indicating either success or the failure reason
List channels
A list of all channels currently available on the specified virtual server can be queried with
-
unsigned int ts3server_getChannelList(uint64 serverID, uint64 **result)
list all channels on the server
- Parameters:
serverID – the server to get the list of channels on
result – address of a variable to receive a zero terminted array of channel ids. Like {4, 65, 23, …, 0} Memory is allocated by the server library and caller must free the array using ts3server_freeMemory
- Returns:
An Error code from the Ts3ErrorType enum indicating either success or the failure reason
To query the current channel of a client use
-
unsigned int ts3server_getChannelOfClient(uint64 serverID, anyID clientID, uint64 *result)
get the id of the clients current channel
- Parameters:
serverID – specifies the server the client is on
clientID – the client to get the channel of
result – address of a variable to receive the channel id
- Returns:
An Error code from the Ts3ErrorType enum indicating either success or the failure reason
Get the parent channel of a given channel with
-
unsigned int ts3server_getParentChannelOfChannel(uint64 serverID, uint64 channelID, uint64 *result)
get the parent channel of a channel
- Parameters:
serverID – the server on which the channel is located
channelID – the channel of which to get the parent channel
result – address of a variable to receive the parent channel id
- Returns:
An Error code from the Ts3ErrorType enum indicating either success or the failure reason
Example
Example to print a list of all channels on a virtual server:
1uint64* channels;
2
3if (ts3server_getChannelList(serverID, &channels) == ERROR_ok) {
4 for (int i = 0; channels[i] != NULL; i++) {
5 printf("Channel ID: %u\n", channels[i]);
6 }
7 ts3server_freeMemory(channels);
8}
Examples
Example to print all clients who are member of the channel with ID 123:
1uint64 channelID = 123; /* ID in our example */
2anyID* clients;
3
4if (ts3server_getChannelClientList(serverID, channelID, &clients) == ERROR_ok) {
5 for (int i = 0; clients[i] != NULL; i++) {
6 printf("Client ID: %u\n", clients[i]);
7 }
8 ts3server_freeMemory(clients);
9}