Merge pull request #5 from Phyrone/master
made clientversion changeable
This commit is contained in:
+17
-6
@@ -24,7 +24,7 @@ import java.util.Random;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class LocalClientHandlerConnecting extends LocalClientHandler {
|
||||
private static final byte[] INIT1_VERSION = new byte[] { 0x09, (byte)0x83, (byte)0x8C, (byte)0xCF };
|
||||
private static final byte[] INIT1_VERSION = new byte[]{0x09, (byte) 0x83, (byte) 0x8C, (byte) 0xCF};
|
||||
|
||||
private byte[] randomBytes;
|
||||
private byte[] alphaBytes;
|
||||
@@ -66,10 +66,10 @@ public class LocalClientHandlerConnecting extends LocalClientHandler {
|
||||
|
||||
switch (init1.getStep().getNumber()) {
|
||||
case 1:
|
||||
PacketBody8Init1.Step1 serverReplyStep1 = (PacketBody8Init1.Step1)init1.getStep();
|
||||
PacketBody8Init1.Step1 serverReplyStep1 = (PacketBody8Init1.Step1) init1.getStep();
|
||||
|
||||
// Check nonce. It's received backwards, so walk backwards over the array received
|
||||
for (int i = 0; i < 4; i ++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (randomBytes[3 - i] != serverReplyStep1.getA0reversed()[i]) {
|
||||
Ts3Debugging.debug("[WARNING] random byte mismatch!");
|
||||
break;
|
||||
@@ -84,7 +84,7 @@ public class LocalClientHandlerConnecting extends LocalClientHandler {
|
||||
step = step2;
|
||||
break;
|
||||
case 3:
|
||||
PacketBody8Init1.Step3 serverReplyStep3 = (PacketBody8Init1.Step3)init1.getStep();
|
||||
PacketBody8Init1.Step3 serverReplyStep3 = (PacketBody8Init1.Step3) init1.getStep();
|
||||
|
||||
// Calculate 'y'
|
||||
// which is the result of x ^ (2 ^ level) % n as an unsigned
|
||||
@@ -228,10 +228,21 @@ public class LocalClientHandlerConnecting extends LocalClientHandler {
|
||||
"clientinit",
|
||||
ProtocolRole.CLIENT,
|
||||
new CommandSingleParameter("client_nickname", getClient().getNickname()),
|
||||
new CommandSingleParameter("client_version", "3.?.? [Build: 5680278000]"),
|
||||
new CommandSingleParameter("client_platform", "Windows"),
|
||||
new CommandSingleParameter(
|
||||
"client_version",
|
||||
getClient().getOption("client.version_string", String.class) != null ?
|
||||
getClient().getOption("client.version_string", String.class) :
|
||||
"3.?.? [Build: 5680278000]"
|
||||
),
|
||||
new CommandSingleParameter("client_platform",
|
||||
getClient().getOption("client.version_platform", String.class) != null ?
|
||||
getClient().getOption("client.version_platform", String.class) :
|
||||
"Windows"
|
||||
),
|
||||
new CommandSingleParameter(
|
||||
"client_version_sign",
|
||||
getClient().getOption("client.version_sign", String.class) != null ?
|
||||
getClient().getOption("client.version_sign", String.class) :
|
||||
"DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg=="
|
||||
),
|
||||
new CommandSingleParameter("client_input_hardware", "1"),
|
||||
|
||||
+38
-27
@@ -60,9 +60,9 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* The internal command buffer
|
||||
*
|
||||
* <p>
|
||||
* This buffer ascends through specific command codes, which are calculated using:
|
||||
*
|
||||
* <p>
|
||||
* get
|
||||
*/
|
||||
private Map<Integer, ClientCommandResponse> awaitingCommands = new ConcurrentHashMap<>();
|
||||
@@ -159,7 +159,7 @@ public class LocalTeamspeakClientSocket
|
||||
* Enables or disables event callback multi-threading. This is dangerous. If this is enabled, events can be
|
||||
* processed out-of-order. It is suggested you use your own threading system for particular events you feel safe
|
||||
* parallelling, such as chat messages.
|
||||
*
|
||||
* <p>
|
||||
* This is not enabled by default.
|
||||
*
|
||||
* @param enabled Event simultaneous (parallel) processing enabled
|
||||
@@ -307,6 +307,7 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* Initiates a connection to a server
|
||||
*
|
||||
* @param hostname Hostname to contact
|
||||
* @param timeout timeout, in milliseconds, to complete a connection.
|
||||
*/
|
||||
@@ -316,6 +317,7 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* Initiates a connection to a server
|
||||
*
|
||||
* @param hostname Hostname to contact
|
||||
* @param password server password (may be null)
|
||||
* @param timeout timeout, in milliseconds, to complete a connection.
|
||||
@@ -338,6 +340,7 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* Initiates a connection to a server
|
||||
*
|
||||
* @param remote remote sever to contact
|
||||
* @param password server password (may be null)
|
||||
* @param timeout timeout, in milliseconds, to complete a connection.
|
||||
@@ -457,6 +460,7 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* Executes a command.
|
||||
*
|
||||
* @param command Command to execute.
|
||||
* @return Future, command response object.
|
||||
* @throws IOException if there is a connectivity-level exception.
|
||||
@@ -596,7 +600,7 @@ public class LocalTeamspeakClientSocket
|
||||
try {
|
||||
writePacket(voice);
|
||||
|
||||
flaggedPackets --;
|
||||
flaggedPackets--;
|
||||
wasSendingAudio = true;
|
||||
} catch (Exception e) {
|
||||
// All we are really concerned about here is a disconnection event, in which case the loop
|
||||
@@ -614,7 +618,7 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
// reset decoder flag
|
||||
flaggedPackets = 5;
|
||||
sessionId ++;
|
||||
sessionId++;
|
||||
|
||||
if (sessionId >= 8)
|
||||
sessionId = 1;
|
||||
@@ -1016,14 +1020,14 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* Displays a list of clients that are in the channel specified by the cid
|
||||
parameter. Included information is the clientID, client database id, nickname,
|
||||
channelID and client type.
|
||||
Please take note that you can only view clients in channels that you are
|
||||
currently subscribed to.
|
||||
|
||||
Here is a list of the additional display paramters you will receive for
|
||||
each of the possible modifier parameters.
|
||||
|
||||
* parameter. Included information is the clientID, client database id, nickname,
|
||||
* channelID and client type.
|
||||
* Please take note that you can only view clients in channels that you are
|
||||
* currently subscribed to.
|
||||
* <p>
|
||||
* Here is a list of the additional display paramters you will receive for
|
||||
* each of the possible modifier parameters.
|
||||
*
|
||||
* @param channelId channel ID to look at
|
||||
* @return list of channel clients
|
||||
* @throws IOException
|
||||
@@ -1041,7 +1045,7 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* Sends a text message a specified target. The type of the target is determined by targetmode while target
|
||||
specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
|
||||
* specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
|
||||
*/
|
||||
public void sendServerMessage(String message)
|
||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||
@@ -1056,7 +1060,7 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* Sends a text message a specified target. The type of the target is determined by targetmode while target
|
||||
specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
|
||||
* specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
|
||||
*/
|
||||
public void sendChannelMessage(int channelId, String message)
|
||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||
@@ -1071,7 +1075,7 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* Sends a text message a specified target. The type of the target is determined by targetmode while target
|
||||
specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
|
||||
* specifies the ID of the recipient, whether it be a virtual server, a channel or a client.
|
||||
*/
|
||||
public void sendPrivateMessage(int clientId, String message)
|
||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||
@@ -1086,8 +1090,8 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* 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
|
||||
channel has no password, the parameter can be omitted.
|
||||
* the target channel has a password, it needs to be specified with cpw. If the
|
||||
* channel has no password, the parameter can be omitted.
|
||||
*/
|
||||
public void clientMove(int clientId, int channelId, String password)
|
||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||
@@ -1107,8 +1111,8 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* 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
|
||||
channel has no password, the parameter can be omitted.
|
||||
* the target channel has a password, it needs to be specified with cpw. If the
|
||||
* channel has no password, the parameter can be omitted.
|
||||
*/
|
||||
public Iterable<Channel> listChannels()
|
||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||
@@ -1119,8 +1123,8 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* 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
|
||||
channel has no password, the parameter can be omitted.
|
||||
* the target channel has a password, it needs to be specified with cpw. If the
|
||||
* channel has no password, the parameter can be omitted.
|
||||
*/
|
||||
public Iterable<Client> listClients()
|
||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||
@@ -1151,8 +1155,8 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* 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
|
||||
channel has no password, the parameter can be omitted.
|
||||
* the target channel has a password, it needs to be specified with cpw. If the
|
||||
* channel has no password, the parameter can be omitted.
|
||||
*/
|
||||
public void clientPoke(int clientId, String message)
|
||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||
@@ -1166,9 +1170,9 @@ public class LocalTeamspeakClientSocket
|
||||
|
||||
/**
|
||||
* Kicks one or more clients specified with clid from their currently joined
|
||||
channel or from the server, depending on reasonid. The reasonmsg parameter
|
||||
specifies a text message sent to the kicked clients. This parameter is optional
|
||||
and may only have a maximum of 40 characters.
|
||||
* channel or from the server, depending on reasonid. The reasonmsg parameter
|
||||
* specifies a text message sent to the kicked clients. This parameter is optional
|
||||
* and may only have a maximum of 40 characters.
|
||||
*/
|
||||
public void kick(Collection<Integer> clientIds, String message)
|
||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||
@@ -1192,6 +1196,13 @@ public class LocalTeamspeakClientSocket
|
||||
executeCommand(command).get();
|
||||
}
|
||||
|
||||
public void setClientVersion(String platform, String version, String sign) {
|
||||
setOption("client.version_platform", platform);
|
||||
setOption("client.version_string", version);
|
||||
setOption("client.version_sign", sign);
|
||||
}
|
||||
|
||||
|
||||
public Client getClientInfo(int clientId)
|
||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||
Command command = new SingleCommand(
|
||||
|
||||
Reference in New Issue
Block a user