Client info call

This commit is contained in:
Manevolent
2018-08-04 23:10:14 -04:00
parent 95adfc6e3d
commit 07ca284851
2 changed files with 22 additions and 1 deletions
@@ -768,6 +768,23 @@ public class LocalTeamspeakClientSocket
executeCommand(command).complete();
}
public void subscribeAll() throws IOException, TimeoutException, ExecutionException, InterruptedException {
Command command = new SingleCommand("channelsubscribeall", ProtocolRole.CLIENT);
executeCommand(command).get();
}
public Client getClientInfo(int clientId)
throws IOException, TimeoutException, ExecutionException, InterruptedException {
Command command = new SingleCommand(
"clientinfo",
ProtocolRole.CLIENT,
new CommandSingleParameter("clid", Integer.toString(clientId))
);
Iterable<Client> clients = executeCommand(command, x -> new Client(x.toMap())).get();
return clients.iterator().next();
}
public void disconnect()
throws
IOException, TimeoutException,
@@ -786,5 +803,4 @@ public class LocalTeamspeakClientSocket
}
}
}
@@ -1,6 +1,7 @@
package com.github.manevolent.ts3j;
import com.github.manevolent.ts3j.api.Channel;
import com.github.manevolent.ts3j.api.Client;
import com.github.manevolent.ts3j.identity.LocalIdentity;
import com.github.manevolent.ts3j.protocol.client.ClientConnectionState;
import com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket;
@@ -40,6 +41,10 @@ public class ServerConnectionTest {
assertEquals(client.getState(), ClientConnectionState.CONNECTED);
for (Client c : client.listClients()) {
client.getClientInfo(c.getId());
}
client.disconnect();
client.waitForState(ClientConnectionState.DISCONNECTED, 10000L);