Client info call
This commit is contained in:
+17
-1
@@ -768,6 +768,23 @@ public class LocalTeamspeakClientSocket
|
|||||||
executeCommand(command).complete();
|
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()
|
public void disconnect()
|
||||||
throws
|
throws
|
||||||
IOException, TimeoutException,
|
IOException, TimeoutException,
|
||||||
@@ -786,5 +803,4 @@ public class LocalTeamspeakClientSocket
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.github.manevolent.ts3j;
|
package com.github.manevolent.ts3j;
|
||||||
|
|
||||||
import com.github.manevolent.ts3j.api.Channel;
|
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.identity.LocalIdentity;
|
||||||
import com.github.manevolent.ts3j.protocol.client.ClientConnectionState;
|
import com.github.manevolent.ts3j.protocol.client.ClientConnectionState;
|
||||||
import com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket;
|
import com.github.manevolent.ts3j.protocol.socket.client.LocalTeamspeakClientSocket;
|
||||||
@@ -40,6 +41,10 @@ public class ServerConnectionTest {
|
|||||||
|
|
||||||
assertEquals(client.getState(), ClientConnectionState.CONNECTED);
|
assertEquals(client.getState(), ClientConnectionState.CONNECTED);
|
||||||
|
|
||||||
|
for (Client c : client.listClients()) {
|
||||||
|
client.getClientInfo(c.getId());
|
||||||
|
}
|
||||||
|
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
|
|
||||||
client.waitForState(ClientConnectionState.DISCONNECTED, 10000L);
|
client.waitForState(ClientConnectionState.DISCONNECTED, 10000L);
|
||||||
|
|||||||
Reference in New Issue
Block a user