**************************************************************************
* (unofficial) specification of the ICQ protocol (V3)                    *
**************************************************************************

Version:	0.01
Compiled by:	Henrik Isaksson <hki@hem1.passagen.se>

All information in this document is based on discussions on the icq-devel
mailing list, and UDP packet monitoring, wich complies with Mirabilis'
lisence agreement.

DISCLAIMER and LICENSE AGREEMENT
================================

This document and the information present herein is provided by
Henrik Isaksson ("the Author") for your personal use only. You agree to
the full responsibility for the results of your use of this document or
the information present herein.

By using this document or the information present herein, you accept
the terms of this license agreement.

THIS INFORMATION IS PROVIDED ON AN "AS IS" BASIS. THE AUTHOR MAKES NO
WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THOSE OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THIS
DOCUMENT AND THE INFORMATION PRESENT HEREIN. THE AUTHOR DOES NOT WARRANT,
GUARANTEE OR MAKE ANY REPRESENTATIONS REGARDING THE USE OR THE RESULTS OF
THE USE OF THIS DOCUMENT OR THE INFORMATION PRESENT HEREIN, IN TERMS OF THE
ACCURACY, RELIABILITY, QUALITY, VALIDITY, STABILITY, COMPLETENESS,
CURRENTNESS, OR OTHERWISE. THE ENTIRE RISK OF USING THE INFORMATION PRESENT
IN THIS DOCUMENT IS ASSUMED BY THE USER.

IN NO EVENT WILL THE AUTHOR BE LIABLE TO ANY PARTY (i) FOR ANY DIRECT,
INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS
INTERRUPTION, LOSS OF PROGRAMS OR INFORMATION, AND THE LIKE), OR ANY OTHER
DAMAGES ARISING IN ANY WAY OUT OF THE AVAILABILITY, USE, RELIANCE ON, OR
INABILITY TO USE THIS DOCUMENT OR THE INFORMATION PRESENT HEREIN, EVEN IF
THE AUTHOR HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND
REGARDLESS OF THE FORM OF ACTION, WHETHER IN CONTRACT, TORT, OR OTHERWISE;
OR (ii) FOR ANY CLAIM ATTRIBUTABLE TO ERRORS, OMISSIONS, OR OTHER
INACCURACIES IN, OR DESTRUCTIVE PROPERTIES OF ANY INFORMATION.

===

V3 - messages sent to the client.

 V3 Message header:

 Length   Content (if fixed)    Name             Description
 ------   ------------------    ----             -----------
 2 bytes  03 00                 VERSION          ICQ protocol version
 2 bytes  xx xx                 COMMAND          Code for service the server should provide
 2 bytes  xx xx                 SEQ_NUM1         First sequence number
 2 bytes  xx xx                 SEQ_NUM2         Second sequence number
 4 bytes  xx xx xx xx		UIN		 UIN
 4 bytes  xx xx xx xx		CHECK		 Checksum

 variable                       PARAMETERS       0 or more parameters (depending on COMMAND)

----

 MULTIPLE_PACKET (12 02)
 -----------------------

 Length   Content (if fixed)  Name		Description
 ------   ------------------  ----		-----------

 1 byte   xx		      NUM_PACKETS	Number of packets
 2 bytes  xx xx		      LENGTH		Length of first packet
 variable 		      PKT_1		First packet
 2 bytes  xx xx		      LENGTH		Length of second packet
 variable		      PKT_2		Second packet
 ...
 2 bytes  xx xx		      LENGTH		Length of n:th packet
 variable		      PKT_N		N:th packet

 The server seems to use this method whenever it has more than one packet
 to deliver.
 The CHECK fields of the included packets are all set to NULL.


 USER_FOUND (8C 00)
 ------------------

 Length   Content (if fixed)  Name		Description
 ------   ------------------  ----		-----------

 4 bytes  xx xx xx xx	      FOUND_UIN		UIN of the found user
 2 bytes  xx xx		      NICK_LENGTH	Length of nickname
 variable		      NICK		Nickname, NULL terminated
 2 bytes  xx xx		      FIRST_LENGTH	Length of first name
 variable		      FIRST_NAME	First name, NULL terminated
 2 bytes  xx xx		      LAST_LENGTH	Length of last name
 variable		      LAST_NAME		Last name, NULL terminated
 2 bytes  xx xx		      EMAIL_LENGTH	Length of email adress
 variable		      EMAIL		EMail, NULL terminated
 1 byte   xx		      AUTHORIZE		User's auth status
						00 = Authorization required
						01 = No auth. required
 1 byte   00		      X1		*Unknown*

 One USER_FOUND packet is sent for every found user.

 END_OF_SEARCH (A0 00)
 ------------------

 Contains no additional data other than the packet header.
 This command is sent to the client when there are no more users to be
 found.


 NEW_USER_UIN (46 00)
 --------------------

 Contains no additional data other than the packet header.
 This packet reports the UIN after a succesful registration
 The UIN field in the header contains the new UIN.
 

 ACKNOWLEDGE (0A 00)
 -------------------

 Contains no additional data other than the packet header.
 This is sent back every time a packet is sent by the client to the
 server. The sequence numbers in the header of this are set to the same
 values as the corresponding fields in the packet being acknowledged.


 LOGIN_REPLY (5A 00)
 -------------------

 Contains no additional data other than the packet header.
 This packet is sent to the client when a valid login packet has been
 recieved by the server.


 -------------------------------------------------------------------------