Source code: plugins/IcqEngine/protocol/LoginMessage.java
1 package plugins.IcqEngine.protocol;
2
3 public class LoginMessage extends OutgoingMessage {
4
5 static final int CMD_LOGIN = 0x03e8;
6 static final int CLIENT_PORT = 1212;
7 String password;
8
9 LoginMessage(String password) {
10 this.password = password;
11 }
12
13 public ByteMessage getMessage(int uin, int sid, int seq1, int seg2) {
14
15 ByteMessage msg = createHeader(uin, sid, seq1, seg2, CMD_LOGIN);
16
17 msg.concat(CLIENT_PORT,4);
18
19 // ISO Latin-1
20 msg.concat(password.length()+1,2);
21 msg.concat(password);
22 /* msg.concatHex(LOGIN_X1);
23
24 // local ip
25 String ipString = null;
26 try {
27 ipString = java.net.InetAddress.getLocalHost().getHostAddress().toString();
28 }
29 catch (java.net.UnknownHostException exception) {
30 System.err.println("Unable to determine local host address.");
31 return null;
32 }
33 msg.concatIp(ipString);
34
35 msg.concatHex(LOGIN_X2);
36
37 msg.concatHex(ONLINE);
38 msg.concatHex(LOGIN_X3);
39 msg.concatHex(LOGIN_SEQ_NUM);
40 msg.concatHex(LOGIN_X4);
41 msg.concatHex(LOGIN_X5);
42 */
43 return msg;
44 }
45
46 }
47