List channels
A list of all channels on the specified virtual server can be queried with
-
unsigned int ts3client_getChannelList(uint64 serverConnectionHandlerID, uint64 **result)
Get a list of all channels currently on the server.
- Parameters:
serverConnectionHandlerID – connection handler on which to retrieve the channels
result – address of a variable to receive a zero terminated array of channel ids, like {1, 4023, 49, 8534, …, 0} 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
To query the id of the channel the specified client has currently joined use
-
unsigned int ts3client_getChannelOfClient(uint64 serverConnectionHandlerID, anyID clientID, uint64 *result)
Get id of the current channel the specified client is in.
- Parameters:
serverConnectionHandlerID – connection handler on which the client is located
clientID – the client to receive the current channel for
result – address of a variable to receive the channel id of the specified client
- Returns:
An Error code from the Ts3ErrorType enum indicating either success or the failure reason
To get the parent channel of a given channel use
-
unsigned int ts3client_getParentChannelOfChannel(uint64 serverConnectionHandlerID, uint64 channelID, uint64 *result)
get the id of the parent channel of the specified channel.
If the channel specified by channelID is a root channel, the result will be 0.
- Parameters:
serverConnectionHandlerID – connection handler on which the channel is located
channelID – id of the channel to retrieve the parent of
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
Examples
Example code to print a list of all channels on a virtual server:
1uint64* channels;
2
3if (ts3client_getChannelList(serverID, &channels) == ERROR_ok) {
4 for (int i=0; channels[i] != NULL; i++) {
5 printf("Channel ID: %u\n", channels[i]);
6 }
7 ts3client_freeMemory(channels);
8}
To print all visible clients:
1anyID* clients;
2
3if (ts3client_getClientList(scHandlerID, &clients) == ERROR_ok) {
4 for (int i=0; clients[i] != NULL; i++) {
5 printf("Client ID: %u\n", clients[i]);
6 }
7 ts3client_freeMemory(clients);
8}
Example to print all clients who are member of channel with ID 123:
1uint64 channelID = 123; /* Channel ID in this example */
2anyID *clients;
3
4if (ts3client_getChannelClientList(scHandlerID, channelID) == ERROR_ok) {
5 for (int i=0; clients[i] != NULL; i++) {
6 printf("Client ID: %u\n", clients[i]);
7 }
8 ts3client_freeMemory(clients);
9}