made clientversion changeable
This commit is contained in:
+20
-9
@@ -24,7 +24,7 @@ import java.util.Random;
|
|||||||
import java.util.concurrent.TimeoutException;
|
import java.util.concurrent.TimeoutException;
|
||||||
|
|
||||||
public class LocalClientHandlerConnecting extends LocalClientHandler {
|
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[] randomBytes;
|
||||||
private byte[] alphaBytes;
|
private byte[] alphaBytes;
|
||||||
@@ -66,10 +66,10 @@ public class LocalClientHandlerConnecting extends LocalClientHandler {
|
|||||||
|
|
||||||
switch (init1.getStep().getNumber()) {
|
switch (init1.getStep().getNumber()) {
|
||||||
case 1:
|
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
|
// 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]) {
|
if (randomBytes[3 - i] != serverReplyStep1.getA0reversed()[i]) {
|
||||||
Ts3Debugging.debug("[WARNING] random byte mismatch!");
|
Ts3Debugging.debug("[WARNING] random byte mismatch!");
|
||||||
break;
|
break;
|
||||||
@@ -84,7 +84,7 @@ public class LocalClientHandlerConnecting extends LocalClientHandler {
|
|||||||
step = step2;
|
step = step2;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
PacketBody8Init1.Step3 serverReplyStep3 = (PacketBody8Init1.Step3)init1.getStep();
|
PacketBody8Init1.Step3 serverReplyStep3 = (PacketBody8Init1.Step3) init1.getStep();
|
||||||
|
|
||||||
// Calculate 'y'
|
// Calculate 'y'
|
||||||
// which is the result of x ^ (2 ^ level) % n as an unsigned
|
// which is the result of x ^ (2 ^ level) % n as an unsigned
|
||||||
@@ -131,8 +131,8 @@ public class LocalClientHandlerConnecting extends LocalClientHandler {
|
|||||||
|
|
||||||
initiv.add(
|
initiv.add(
|
||||||
new CommandSingleParameter(
|
new CommandSingleParameter(
|
||||||
"ip",
|
"ip",
|
||||||
getClient().getOption("client.hostname", String.class)
|
getClient().getOption("client.hostname", String.class)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -228,11 +228,22 @@ public class LocalClientHandlerConnecting extends LocalClientHandler {
|
|||||||
"clientinit",
|
"clientinit",
|
||||||
ProtocolRole.CLIENT,
|
ProtocolRole.CLIENT,
|
||||||
new CommandSingleParameter("client_nickname", getClient().getNickname()),
|
new CommandSingleParameter("client_nickname", getClient().getNickname()),
|
||||||
new CommandSingleParameter("client_version", "3.?.? [Build: 5680278000]"),
|
new CommandSingleParameter(
|
||||||
new CommandSingleParameter("client_platform", "Windows"),
|
"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(
|
new CommandSingleParameter(
|
||||||
"client_version_sign",
|
"client_version_sign",
|
||||||
"DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg=="
|
getClient().getOption("client.version_sign", String.class) != null ?
|
||||||
|
getClient().getOption("client.version_sign", String.class) :
|
||||||
|
"DX5NIYLvfJEUjuIbCidnoeozxIDRRkpq3I9vVMBmE9L2qnekOoBzSenkzsg2lC9CMv8K5hkEzhr2TYUYSwUXCg=="
|
||||||
),
|
),
|
||||||
new CommandSingleParameter("client_input_hardware", "1"),
|
new CommandSingleParameter("client_input_hardware", "1"),
|
||||||
new CommandSingleParameter("client_output_hardware", "1"),
|
new CommandSingleParameter("client_output_hardware", "1"),
|
||||||
|
|||||||
+44
-33
@@ -60,9 +60,9 @@ public class LocalTeamspeakClientSocket
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The internal command buffer
|
* The internal command buffer
|
||||||
*
|
* <p>
|
||||||
* This buffer ascends through specific command codes, which are calculated using:
|
* This buffer ascends through specific command codes, which are calculated using:
|
||||||
*
|
* <p>
|
||||||
* get
|
* get
|
||||||
*/
|
*/
|
||||||
private Map<Integer, ClientCommandResponse> awaitingCommands = new ConcurrentHashMap<>();
|
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
|
* 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
|
* processed out-of-order. It is suggested you use your own threading system for particular events you feel safe
|
||||||
* parallelling, such as chat messages.
|
* parallelling, such as chat messages.
|
||||||
*
|
* <p>
|
||||||
* This is not enabled by default.
|
* This is not enabled by default.
|
||||||
*
|
*
|
||||||
* @param enabled Event simultaneous (parallel) processing enabled
|
* @param enabled Event simultaneous (parallel) processing enabled
|
||||||
@@ -307,8 +307,9 @@ public class LocalTeamspeakClientSocket
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiates a connection to a server
|
* Initiates a connection to a server
|
||||||
|
*
|
||||||
* @param hostname Hostname to contact
|
* @param hostname Hostname to contact
|
||||||
* @param timeout timeout, in milliseconds, to complete a connection.
|
* @param timeout timeout, in milliseconds, to complete a connection.
|
||||||
*/
|
*/
|
||||||
public void connect(String hostname, long timeout) throws IOException, TimeoutException {
|
public void connect(String hostname, long timeout) throws IOException, TimeoutException {
|
||||||
connect(hostname, null, timeout);
|
connect(hostname, null, timeout);
|
||||||
@@ -316,9 +317,10 @@ public class LocalTeamspeakClientSocket
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiates a connection to a server
|
* Initiates a connection to a server
|
||||||
|
*
|
||||||
* @param hostname Hostname to contact
|
* @param hostname Hostname to contact
|
||||||
* @param password server password (may be null)
|
* @param password server password (may be null)
|
||||||
* @param timeout timeout, in milliseconds, to complete a connection.
|
* @param timeout timeout, in milliseconds, to complete a connection.
|
||||||
*/
|
*/
|
||||||
public void connect(String hostname, String password, long timeout) throws
|
public void connect(String hostname, String password, long timeout) throws
|
||||||
IOException,
|
IOException,
|
||||||
@@ -338,9 +340,10 @@ public class LocalTeamspeakClientSocket
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiates a connection to a server
|
* Initiates a connection to a server
|
||||||
* @param remote remote sever to contact
|
*
|
||||||
|
* @param remote remote sever to contact
|
||||||
* @param password server password (may be null)
|
* @param password server password (may be null)
|
||||||
* @param timeout timeout, in milliseconds, to complete a connection.
|
* @param timeout timeout, in milliseconds, to complete a connection.
|
||||||
*/
|
*/
|
||||||
public void connect(InetSocketAddress remote, String password, long timeout)
|
public void connect(InetSocketAddress remote, String password, long timeout)
|
||||||
throws IOException, TimeoutException {
|
throws IOException, TimeoutException {
|
||||||
@@ -457,9 +460,10 @@ public class LocalTeamspeakClientSocket
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes a command.
|
* Executes a command.
|
||||||
|
*
|
||||||
* @param command Command to execute.
|
* @param command Command to execute.
|
||||||
* @return Future, command response object.
|
* @return Future, command response object.
|
||||||
* @throws IOException if there is a connectivity-level exception.
|
* @throws IOException if there is a connectivity-level exception.
|
||||||
* @throws TimeoutException if command send times out.
|
* @throws TimeoutException if command send times out.
|
||||||
*/
|
*/
|
||||||
public CommandResponse<Iterable<SingleCommand>> executeCommand(Command command)
|
public CommandResponse<Iterable<SingleCommand>> executeCommand(Command command)
|
||||||
@@ -596,7 +600,7 @@ public class LocalTeamspeakClientSocket
|
|||||||
try {
|
try {
|
||||||
writePacket(voice);
|
writePacket(voice);
|
||||||
|
|
||||||
flaggedPackets --;
|
flaggedPackets--;
|
||||||
wasSendingAudio = true;
|
wasSendingAudio = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// All we are really concerned about here is a disconnection event, in which case the loop
|
// 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
|
// reset decoder flag
|
||||||
flaggedPackets = 5;
|
flaggedPackets = 5;
|
||||||
sessionId ++;
|
sessionId++;
|
||||||
|
|
||||||
if (sessionId >= 8)
|
if (sessionId >= 8)
|
||||||
sessionId = 1;
|
sessionId = 1;
|
||||||
@@ -649,7 +653,7 @@ public class LocalTeamspeakClientSocket
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void process(AbstractTeamspeakClientSocket client,
|
public void process(AbstractTeamspeakClientSocket client,
|
||||||
MultiCommand multiCommand)
|
MultiCommand multiCommand)
|
||||||
throws CommandProcessException {
|
throws CommandProcessException {
|
||||||
if (multiCommand.getName().equalsIgnoreCase("error"))
|
if (multiCommand.getName().equalsIgnoreCase("error"))
|
||||||
try {
|
try {
|
||||||
@@ -1016,14 +1020,14 @@ public class LocalTeamspeakClientSocket
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Displays a list of clients that are in the channel specified by the cid
|
* Displays a list of clients that are in the channel specified by the cid
|
||||||
parameter. Included information is the clientID, client database id, nickname,
|
* parameter. Included information is the clientID, client database id, nickname,
|
||||||
channelID and client type.
|
* channelID and client type.
|
||||||
Please take note that you can only view clients in channels that you are
|
* Please take note that you can only view clients in channels that you are
|
||||||
currently subscribed to.
|
* currently subscribed to.
|
||||||
|
* <p>
|
||||||
Here is a list of the additional display paramters you will receive for
|
* Here is a list of the additional display paramters you will receive for
|
||||||
each of the possible modifier parameters.
|
* each of the possible modifier parameters.
|
||||||
|
*
|
||||||
* @param channelId channel ID to look at
|
* @param channelId channel ID to look at
|
||||||
* @return list of channel clients
|
* @return list of channel clients
|
||||||
* @throws IOException
|
* @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
|
* 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)
|
public void sendServerMessage(String message)
|
||||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
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
|
* 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)
|
public void sendChannelMessage(int channelId, String message)
|
||||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
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
|
* 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)
|
public void sendPrivateMessage(int clientId, String message)
|
||||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
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
|
* 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
|
* the target channel has a password, it needs to be specified with cpw. If the
|
||||||
channel has no password, the parameter can be omitted.
|
* channel has no password, the parameter can be omitted.
|
||||||
*/
|
*/
|
||||||
public void clientMove(int clientId, int channelId, String password)
|
public void clientMove(int clientId, int channelId, String password)
|
||||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
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
|
* 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
|
* the target channel has a password, it needs to be specified with cpw. If the
|
||||||
channel has no password, the parameter can be omitted.
|
* channel has no password, the parameter can be omitted.
|
||||||
*/
|
*/
|
||||||
public Iterable<Channel> listChannels()
|
public Iterable<Channel> listChannels()
|
||||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
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
|
* 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
|
* the target channel has a password, it needs to be specified with cpw. If the
|
||||||
channel has no password, the parameter can be omitted.
|
* channel has no password, the parameter can be omitted.
|
||||||
*/
|
*/
|
||||||
public Iterable<Client> listClients()
|
public Iterable<Client> listClients()
|
||||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
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
|
* 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
|
* the target channel has a password, it needs to be specified with cpw. If the
|
||||||
channel has no password, the parameter can be omitted.
|
* channel has no password, the parameter can be omitted.
|
||||||
*/
|
*/
|
||||||
public void clientPoke(int clientId, String message)
|
public void clientPoke(int clientId, String message)
|
||||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||||
@@ -1166,9 +1170,9 @@ public class LocalTeamspeakClientSocket
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Kicks one or more clients specified with clid from their currently joined
|
* Kicks one or more clients specified with clid from their currently joined
|
||||||
channel or from the server, depending on reasonid. The reasonmsg parameter
|
* channel or from the server, depending on reasonid. The reasonmsg parameter
|
||||||
specifies a text message sent to the kicked clients. This parameter is optional
|
* specifies a text message sent to the kicked clients. This parameter is optional
|
||||||
and may only have a maximum of 40 characters.
|
* and may only have a maximum of 40 characters.
|
||||||
*/
|
*/
|
||||||
public void kick(Collection<Integer> clientIds, String message)
|
public void kick(Collection<Integer> clientIds, String message)
|
||||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||||
@@ -1192,6 +1196,13 @@ public class LocalTeamspeakClientSocket
|
|||||||
executeCommand(command).get();
|
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)
|
public Client getClientInfo(int clientId)
|
||||||
throws IOException, TimeoutException, InterruptedException, CommandException {
|
throws IOException, TimeoutException, InterruptedException, CommandException {
|
||||||
Command command = new SingleCommand(
|
Command command = new SingleCommand(
|
||||||
|
|||||||
Reference in New Issue
Block a user