Class Icq.ICQLib
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Icq.ICQLib

Object
   |
   +----Icq.ICQLib

public class ICQLib
extends Object
Forms V4/V3 ICQ UDP packets. Has some methods to analyze packets

Version:
1.0
Author:
Egidijus Neniskis - Lithuania

Constructor Index

 o Icq.ICQLib(byte[], byte[], int)

Method Index

 o calculateInsertCheckcode(byte[])
calculates and inserts check code into packet
 o cmdAckToSrv_X2(int)
forms and returns - safe to delete offline messages at server - packet
 o cmdAcknowledge(int, int, int)
 o cmdFinalLogin(int)
forms Login2 packet
 o cmdKeepAlive(int)
Send this packet every ~2 minutes, regardless of activity and CmdKeepAlive2 too
 o cmdKeepAlive2(int)
Send this packet every ~2 minutes (regardless of activity) and CmdKeepAlive too
 o cmdLogin(String, int)
forms Login packet
 o cmdLogout(int)
Send this packet if you want logout
 o cmdSendContactList(int, int[], int)
forms contact list packet
 o cmdSendInvisibleList(int, int[], int)
forms invisibleList packet
 o cmdSendTextMessage(String, int, int)
forms and returns - send text message - packet
 o cmdSendVisibleList(int, int[], int)
forms visibleList packet
 o decryptPacket(byte[], int, int)
decodes or encodes packet
 o getKey32(byte[], int)
 o getSeqFromPacketV3(byte[])
 o getSeqFromPacketV4(byte[])
 o getTextFromMessage(byte[])
Can be used with Cmd220 and Cmd260 otherwise will return ""
 o getTimeFromMessage(byte[])
Can be used only with Cmd220 and Cmd270, otherwise will return 0,0,0,0,0
 o getUinFromMessage(byte[])
Can be used with Cmd220 and Cmd260 otherwise will return 0
 o getV3MultiPacketAllCmds(byte[])
 o getV3MultiPacketInnerPacket(byte[], int)
returns inner packet; first packet's number=0
 o insertDWord(int, int, byte[])
inserts dword into packet
 o insertWord(int, int, byte[])
inserts word into packet
 o makePacket(byte[], int, int, int, int)
forms Icq packet
 o reverseInt32(int)

Constructors

 o ICQLib
public ICQLib(byte tarIP,
              byte locIP,
              int socketPort)
Parameters:
tarIP[] - servers IP
locIP[] - client IP (your computer)
socketPort - server socket number

Methods

 o calculateInsertCheckcode
protected byte[] calculateInsertCheckcode(byte pkt)
calculates and inserts check code into packet

Parameters:
pkt[] - packet without check code
Returns:
packet with check code
 o cmdAckToSrv_X2
public byte[] cmdAckToSrv_X2(int uin)
forms and returns - safe to delete offline messages at server - packet

Parameters:
uin - user uin
Returns:
Icq packet
 o cmdAcknowledge
public byte[] cmdAcknowledge(int number1,
                             int number2,
                             int uin)
Parameters:
number1 - packet number1
number2 - packet number2
uin - user uin
Returns:
ACK packet
 o cmdFinalLogin
public byte[] cmdFinalLogin(int uin)
forms Login2 packet

Parameters:
uin - user uin
Returns:
Icq packet
 o cmdKeepAlive
public byte[] cmdKeepAlive(int uin)
Send this packet every ~2 minutes, regardless of activity and CmdKeepAlive2 too

Parameters:
uin - client uin
Returns:
Icq packet
 o cmdKeepAlive2
public byte[] cmdKeepAlive2(int uin)
Send this packet every ~2 minutes (regardless of activity) and CmdKeepAlive too

Parameters:
uin - client uin
Returns:
Icq packet
 o cmdLogin
public byte[] cmdLogin(String password,
                       int uin)
forms Login packet

Parameters:
password - user login password
uin - user uin
Returns:
Icq packet
 o cmdLogout
public byte[] cmdLogout(int uin)
Send this packet if you want logout

Parameters:
uin - client uin
Returns:
Icq packet
 o cmdSendContactList
public byte[] cmdSendContactList(int number,
                                 int contacts,
                                 int uin)
forms contact list packet

Parameters:
number - size of contacts[]
contacts[] - array of user personal contacts
uin - user uin
Returns:
Icq packet
 o cmdSendInvisibleList
public byte[] cmdSendInvisibleList(int number,
                                   int contacts,
                                   int uin)
forms invisibleList packet

Parameters:
number - size of contacts[]
contacts[] - array of user personal contacts
uin - user uin
Returns:
Icq packet
 o cmdSendTextMessage
public byte[] cmdSendTextMessage(String text,
                                 int destuin,
                                 int uin)
forms and returns - send text message - packet

Parameters:
text - message text
destuin - destination uin
uin - senders uin
Returns:
Icq packet
 o cmdSendVisibleList
public byte[] cmdSendVisibleList(int number,
                                 int contacts,
                                 int uin)
forms visibleList packet

Parameters:
number - size of contacts[]
contacts[] - array of user personal contacts
uin - user uin
Returns:
Icq packet
 o decryptPacket
protected synchronized byte[] decryptPacket(byte pkt,
                                            int size,
                                            int key)
decodes or encodes packet

Parameters:
pkt[] - packet to encode, decode
size - packet size in bytes
key - key for encrypting or decrypting
Returns:
Icq packet
 o getKey32
protected synchronized int getKey32(byte bfr,
                                    int size)
Parameters:
bfr[] - packet with check code
size - packet size in bytes
Returns:
key for encoding
 o getSeqFromPacketV3
public int[] getSeqFromPacketV3(byte packet)
Parameters:
packet[] - Icq packet
Returns:
seq_numbers from V3 packet
 o getSeqFromPacketV4
public int[] getSeqFromPacketV4(byte packet)
Parameters:
packet[] - Icq V4 packet
Returns:
seq_numbers from coded V4 packet
 o getTextFromMessage
public java.lang.String getTextFromMessage(byte data)
Can be used with Cmd220 and Cmd260 otherwise will return ""

Parameters:
data[] - packet with message
Returns:
message text
 o getTimeFromMessage
public short[] getTimeFromMessage(byte data)
Can be used only with Cmd220 and Cmd270, otherwise will return 0,0,0,0,0

Parameters:
data[] - packet with message
Returns:
array {year,month,day,hour,minute} with time
 o getUinFromMessage
public int getUinFromMessage(byte data)
Can be used with Cmd220 and Cmd260 otherwise will return 0

Parameters:
data[] - message packet
Returns:
sender's uin
 o getV3MultiPacketAllCmds
public int[] getV3MultiPacketAllCmds(byte packet)
Parameters:
packet[] - Icq multipacket
Returns:
array of commands in multipacket
 o getV3MultiPacketInnerPacket
public byte[] getV3MultiPacketInnerPacket(byte packet,
                                          int number)
returns inner packet; first packet's number=0

Parameters:
packet - icq packet
number - inner packet number
Returns:
Icq packet with number 'number'
 o insertDWord
protected byte[] insertDWord(int position,
                             int dword,
                             byte packet)
inserts dword into packet

Parameters:
position - first byte position
dword - what to insert
packet[] - where to insert
Returns:
packet
 o insertWord
protected byte[] insertWord(int position,
                            int word,
                            byte packet)
inserts word into packet

Parameters:
position - first byte position
word - what to insert
packet[] - where to insert
Returns:
packet
 o makePacket
protected synchronized byte[] makePacket(byte data,
                                         int cmd,
                                         int uin,
                                         int seq_number1,
                                         int seq_number2)
forms Icq packet

Parameters:
data[] - packet data(not header)
cmd - packet command
uin - user uin
seq_number1 - packet first sequence number
seq_number2 - packet second sequence number
Returns:
formed and enscrypted packet
 o reverseInt32
protected int reverseInt32(int l)
Parameters:
dword - to operate with
Returns:
dword in reverse byte order

All Packages  Class Hierarchy  This Package  Previous  Next  Index