From 4c235badd5c0a1cb4df823e95db12712a27ab522 Mon Sep 17 00:00:00 2001 From: Manevolent Date: Thu, 23 Aug 2018 11:34:27 -0400 Subject: [PATCH] Server group add/del --- .../packet/fragment/PacketReassembly.java | 2 +- .../client/LocalTeamspeakClientSocket.java | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/manevolent/ts3j/protocol/packet/fragment/PacketReassembly.java b/src/main/java/com/github/manevolent/ts3j/protocol/packet/fragment/PacketReassembly.java index e313725..36ad7c6 100644 --- a/src/main/java/com/github/manevolent/ts3j/protocol/packet/fragment/PacketReassembly.java +++ b/src/main/java/com/github/manevolent/ts3j/protocol/packet/fragment/PacketReassembly.java @@ -40,7 +40,7 @@ public class PacketReassembly { temporaryCounter.setPacketId(currentPacketId.getKey()); temporaryCounter.setGeneration(currentPacketId.getValue()); - while (true) { + while (queue.size() > 0) { Pair thisPacketId = temporaryCounter.current(); Packet packet = queue.get(thisPacketId.getKey()); diff --git a/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/LocalTeamspeakClientSocket.java b/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/LocalTeamspeakClientSocket.java index 61fc912..62e78d5 100644 --- a/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/LocalTeamspeakClientSocket.java +++ b/src/main/java/com/github/manevolent/ts3j/protocol/socket/client/LocalTeamspeakClientSocket.java @@ -902,6 +902,26 @@ public class LocalTeamspeakClientSocket return executeCommand(command, x -> new Client(x.toMap())).get(); } + public void serverGroupAddClient(int groupId, int clientDatabaseId) + throws IOException, TimeoutException, ExecutionException, InterruptedException { + Command command = new SingleCommand("servergroupaddclient", ProtocolRole.CLIENT); + + command.add(new CommandSingleParameter("sgid", Integer.toString(groupId))); + command.add(new CommandSingleParameter("cldbid", Integer.toString(clientDatabaseId))); + + executeCommand(command).complete(); + } + + public void serverGroupRemoveClient(int groupId, int clientDatabaseId) + throws IOException, TimeoutException, ExecutionException, InterruptedException { + Command command = new SingleCommand("servergroupdelclient", ProtocolRole.CLIENT); + + command.add(new CommandSingleParameter("sgid", Integer.toString(groupId))); + command.add(new CommandSingleParameter("cldbid", Integer.toString(clientDatabaseId))); + + executeCommand(command).complete(); + } + /** * Moves one or more clients specified with clid to the channel with ID cid. If the target channel has a password, it needs to be specified with cpw. If the