summaryrefslogtreecommitdiff
path: root/plugins/Import/docs/import-ICQ_Db_Specs.txt
blob: 7308d85f9b5eae7adae4451c76928057a2fefad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004

The latest version of this document is always at:
http://cvs.sourceforge.net/viewcvs.py/miranda-icq/Plugins/import/docs/import-ICQ_Db_Specs.txt

============================================================================
= ICQ_Db_Specs.txt -- Updated 2002-07-08
=
= This document describes parts of the fileformat used by the databases in
= ICQ 99a - 2002a and is based on the 99a & 99b database specifications as
= described in "ICQNEWDB.TXT" by Derek Soeder.
= 
= Current maintainer: Strickz (strickz at miranda-im.org)
=
=
=
= To understand the file format as a whole it is also necessary to read
= icqnewdb.txt and icqprop.txt. I have tried to use the same syntax in
= this document to make it easier to understand and compare the different
= parts.
=
= The information in this document is in no way guaranteed to be correct, use
= at own your own risk and feel free to send me any corrections you may have.
=
============================================================================



***
*** File Headers
***


    ================================================================
    == Format of IDX main header (20 BYTES):
    ================================================================
     00000000   3 LONGS     Unknown, but always 4, 20, 8.
                                (04,00,00,00,14h,00,00,00,08,00,00,00)
     0000000C   LONG        IDX pointer to root entry
     00000010   LONG        ICQ database version
                                10      = ICQ 99a
                                14      = ICQ 99b
                                17      = ICQ 2000a
                                18      = ICQ 2000b
                                19      = ICQ 2001a,2001b,2002a,2003a
     00000014   ---         Start of first IDX page header


    ================================================================
    == Format of IDX page header (205 BYTES):
    ================================================================
     00000000   5 LONGS     Unknown, but always 201, 0, 0, 0, 0.
     00000014   LONG        Pointer to next page header. -1 if this is the
                            last page.
     00000018   LONG        Unknown, always 1?
     0000001C   LONG        Number of bytes in each slot (20)
     00000020   LONG        Number of fragments in the page with one
                            or more consecutive free slots.
     00000024   LONG        Number of empty slots in this page.
     00000028   10 LONGS    Unknown, always 0?
     00000050   125 BYTES   Allocation bitmap
     000000CD   ---         1000 list entries (slots)


    Notes by Derek:
    --------------
    Apparently, if you start at the root entry and walk the chain via
    the LONG at offset +8 in each following IDX entry, you'll eventually
    arrive at a complete chain of valid entries (entry status = -2).

    Notes by Strickz:
    ----------------
    Initially an IDX file is 20225 bytes large: 20 bytes main header + 205 bytes
    (first page header) + 20000 bytes (first IDX page). The file is always resized
    in blocks of 20205 bytes (one page with header), I'm guessing this isn't done
    until some data wants to be written and there is no fragment large enough to
    hold it.

    Offset 0c64: This is a bitmap that shows the status of all slots in the
    page. Each page is divided into 1000 slots which requires a bitmap of
    1000/8 = 225 bytes. It would probably be possible to go through all entries in
    the database by using the bitmap directly, page by page, instead of traversing
    the chain.

    Offset 0x20: I don't really see what practical use this value has. It can be
    used as a measurement of the degree of fragmentation of the page, but keeping this
    updated each write should slow things down... And it offers no speed-up
    either, to write something to a page you still have to scan for a fragment large
    enough for your data.


    ================================================================
    == Format of IDX linked list entry (20 BYTES each):
    ================================================================

     00000000   LONG        entry status? :
                                -2          = valid IDX entry
                                else        = ?
     00000004   LONG        DAT entry number:
                                1..15       = ???a
                                1005        = My Details
                                1006        = Address Book?
                                1007        = Sound themes
                                1009          Unknown, about 222 bytes of binary data. I don't
                                              recognize the data yet but there is a pattern.
                                1014        = Chats event folder?
                                1015        = A list of nicks with some data
                                1025        = Looks related to Message archive. Contains several lists,
                                              System, Sent & Received, From Web, Messages, etc... Lists
                                              contains nicks or UINs with some data attached.
                                1050        = Unknown
                                1051        = Unknown
                                1052        = Unknown
                                1100        = Unknown
                                1101        = Looks likes external app info
                                1102        = Objectionable Words List?
                                1110        = ICQ Servers List
                                2001+       = user events/contact info
     00000008   LONG        IDX pointer to next entry (-1 = none)
     0000000C   LONG        IDX pointer to previous entry (-1 = none)
     00000010   LONG        DAT pointer to corresponding DAT entry (-1 = none)


    Notes by Strickz:
    ----------------
    The chain is not a simple double linked list, there are several smaller chains that
    merge into the main chain at different points.
    The root entry has a DAT-ptr that doesn't point into the DAT file, if you use it
    with the IDX file you arrive at a chain fragment that end up in the main chain.

    All entries with status -2 points to a entry in the DAT file.


    ===============================================================
    == Format of DAT main header (8 BYTES):
    ================================================================
     00000000   2 LONG      Unknown, but always 4, 8.
                                (04,00,00,00,08,00,00,00)
     00000008   ---         Start of first DAT page header


    ================================================================
    == Format of DAT page header (205 BYTES):
    ================================================================
     00000000   6 LONGS     Unknown, but always 201, 0, 0, 0, 0, 0.
     00000014   LONG        Pointer to next page header. -1 if this is the
                            last page.
     00000018   LONG        Unknown, always 0?
     0000001C   LONG        Number of bytes in each slot (64)
     00000020   LONG        Number of fragments in the page with one
                            or more consecutive free slots.
     00000024   LONG        Number of empty slots in this page
     00000028   10 LONGS    Unknown, always 0?
     00000050   125 BYTES   Allocation bitmap
     000000CD   ---         One page of DAT entries



***
*** My details
***


    ================================================================
    == Format of My Details v99a (ICQ 99a) data:
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        Where entry is filed? (-1 = MyDetails)
     00000008   LONG        DAT entry number        = 1005
     0000000C   BYTE        First byte of signature = E4h
     0000000D   UNKNOWN 15  Rest of signature
                            23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        Label   = 55534552h ('USER')
     00000022   LONG        User entry status: 6 = "My Details"
     00000026   44 BYTEs    Unused??? (0)
     00000052   WORD        // Separator value
     00000054   LONG        Number of default event WAV entries
     00000058    ---        List of consecutive default event WAV entries
   $+00000000   38 BYTEs    Unused??? (0)
    +00000026   WORD        // Separator value
    +00000028   LONG        Number of user properties
     0000002C    ---        List of consecutive user properties
   $+00000000    ---        99a user information for owner of this DAT file

   $+00000000   WORD        length of password
    +00000002   ASCIIZ      user's ICQ password
   $+00000000   LONG        ??? (1)
    +00000004   14 BYTEs    ??? (03 00 00 00 00 01 00 00 00 00 00 00 00 00)
    +00000012   WORD        length of POP3 account user name
    +00000014   ASCIIZ      POP3 account user name
   $+00000000   WORD        length of POP3 account password
    +00000002   ASCIIZ      POP3 account password
   $+00000000   WORD        length of POP3 server name
    +00000002   ASCIIZ      POP3 server name
   $+00000000   1 BYTE      ??? (10/0Ah)
    +00000001   20 BYTEs    ??? (0)
    +00000015   LONG        Number of contact groups
    +00000019    ---        List of consecutive contact group entries
   $+00000000   LONG        unused??? (0)
    +00000004   BYTE        ??? (1)
    +00000005   WORD        // Separator value
    +00000007   LONG        Number of additional user properties
    +0000000B    ---        List of consecutive user properties


    >> Format of 99a user information:
   $+00000000   WORD        length of user name
    +00000002   ASCIIZ      user name (what user is called; usually nickname)
   $+00000000   WORD        length of nickname
    +00000002   ASCIIZ      nickname
   $+00000000   WORD        length of First Name
    +00000002   ASCIIZ      First Name
   $+00000000   WORD        length of Last Name
    +00000002   ASCIIZ      Last Name
   $+00000000   WORD        length of primary e-mail address
    +00000002   ASCIIZ      primary e-mail address
   $+00000000   LONG        UIN of this user
    +00000004   BYTE        authorization -- 0:required to add user, 1:none
    +00000005   CHAR        GMT offset (negative count of half-hours):
    +00000006   DWORD       current/last IP address (network byte order)
    +0000000A   BYTE        gender -- 0:Not Specified, 1:Female, 2:Male
    +0000000B   LONG        Home Country
    +0000000F   LONG        age of user (-1 = not entered)
    +00000013   WORD        length of Home City text
    +00000015   ASCIIZ      Home City text
   $+00000000   WORD        length of Home State text
    +00000002   ASCIIZ      Home State text
   $+00000000   WORD        length of additional details text
    +00000002   ASCIIZ      additional details text (info specified by user)
   $+00000000   WORD        length of user's Homepage URL
    +00000002   ASCIIZ      user's Homepage URL
   $+00000000   WORD        length of Home Phone number
    +00000002   ASCIIZ      Home Phone number
   $+00000000   WORD        length of notes text
    +00000002   ASCIIZ      notes text (empty in My Details)

   $+00000000   LONG        Home Zip Code (0 = not entered)
    +00000004   LONG        timestamp of last Phonebook update
    +00000008   LONG        unused??? (0)
    +0000000C   LONG        number of Phonebook entries
    +00000010    ---        list of consecutive Phonebook entries

// verkar vara tom i mydetails
   $+00000000   WORD        length of picture file name
    +00000002   ASCIIZ      local path and file name of user's saved picture
   $+00000000   8 BYTEs     unused??? (0) 6??
    +00000008   WORD        //separator value <-- redan här är det 2 bytes fel
    +0000000A   LONG        timestamp of last My Details update
    +0000000E   WORD        length of secondary e-mail address
    +00000010   ASCIIZ      secondary e-mail address
   $+00000000   WORD        length of old e-mail address
    +00000002   ASCIIZ      old e-mail address
   $+00000000   LONG        ??? (0)
    +00000004   BYTE        day of birthdate
    +00000005   BYTE        month of birthdate (1..12 = January..December)
    +00000006   BYTE        year of birthday (0..99 = 1900..1999)   //Y2K!!!
    +00000007   LONG        ??? 2
    +0000000B   LONG        ??? 1
    +0000000F   3 BYTEs     languages spoken
    +00000012   WORD        length of Home Street Address
    +00000014   ASCIIZ      Home Street Address
   $+00000000   WORD        length of Home Fax number
    +00000002   ASCIIZ      Home Fax number
   $+00000000   WORD        length of Home Cellular number
    +00000002   ASCIIZ      Home Cellular number
   $+00000000   LONG        ??? (0)
    +00000004   WORD        length of Company Div/Dept
    +00000006   ASCIIZ      Company Div/Dept
   $+00000000   BYTE        Occupation
    +00000001   LONG        ??? (0)
    +00000005   WORD        length of Company Position
    +00000007   ASCIIZ      Company Position
   $+00000000   WORD        length of Company Name
    +00000002   ASCIIZ      Company Name
   $+00000000   WORD        length of Work Street Address
    +00000002   ASCIIZ      Work Street Address
   $+00000000   WORD        length of Work State text
    +00000002   ASCIIZ      Work State text
   $+00000000   WORD        length of Work City text
    +00000002   ASCIIZ      Work City text
   $+00000000   LONG        Work Zip Code (0 = not entered)
    +00000004   LONG        Work Country (see "Home Country" for values)
    +00000008   WORD        length of Work Phone number
    +0000000A   ASCIIZ      Work Phone number
   $+00000000   WORD        length of Work Fax number
    +00000002   ASCIIZ      Work Fax number
   $+00000000   WORD        length of Work Homepage URL
    +00000002   ASCIIZ      Work Homepage URL
   $+00000000   WORD        length of Past Background #1 keywords
    +00000002   ASCIIZ      Past Background #1 keywords
   $+00000000   WORD        Past Bkg. #1 category
    +00000002   WORD        length of Past Background #2 keywords
    +00000004   ASCIIZ      Past Background #2 keywords
   $+00000000   WORD        Past Bkg. #2 category (see list for Past Bkg. #1)
    +00000002   WORD        length of Past Background #3 keywords
    +00000004   ASCIIZ      Past Background #3 keywords
   $+00000000   WORD        Past Bkg. #3 category (see list for Past Bkg. #1)
    +00000002   WORD        length of Affiliation #1 keywords
    +00000004   ASCIIZ      Affiliation #1 keywords
   $+00000000   WORD        Affiliation #1 category
    +00000002   WORD        length of Affiliation #2 keywords
    +00000004   ASCIIZ      Affiliation #2 keywords
   $+00000000   WORD        Affiliation #2 category (see list for Affil. #1)
    +00000002   WORD        length of Affiliation #3 keywords
    +00000004   ASCIIZ      Affiliation #3 keywords
   $+00000000   WORD        Affiliation #3 category (see list for Affil. #1)
    +00000002   20 BYTEs    unused??? (0)
    +00000016   WORD        length of Interest #1 keywords
    +00000018   ASCIIZ      Interest #1 keywords
   $+00000000   WORD        Interest #1 category
    +00000002   WORD        length of Interest #2 keywords
    +00000004   ASCIIZ      Interest #2 keywords
   $+00000000   WORD        Interest #2 category (see list for Interest #1)
    +00000002   WORD        length of Interest #3 keywords
    +00000004   ASCIIZ      Interest #3 keywords
   $+00000000   WORD        Interest #3 category (see list for Interest #1)
    +00000002   WORD        length of Interest #4 keywords
    +00000004   ASCIIZ      Interest #4 keywords
   $+00000000   WORD        Interest #4 category (see list for Interest #1)
    +00000002   40 BYTES    unused??? (0)



    ================================================================
    == Format of My Details v99b (ICQ 99b) data:
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        -1 (Entry is not filed)
     00000008   LONG        DAT entry number        = 1005
     0000000C   BYTE        first byte of signature = E4h
     0000000D   UNKNOWN 15  Rest of signature
                            23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        label   = 55534552h ('USER')
     00000022   LONG        user entry status: 6 = "My Details"
     00000026   LONG        0 (Unknown, most likely an unused group entry)
     0000002A   WORD        // Separator value
     0000002C   LONG        Number of user event WAV entries
     00000030    ---        List of consecutive user event WAV entries
   $+00000000   WORD        // Separator value
    +00000002   LONG        Number of property blocks
    +00000006    ---        List of consecutive property blocks
    +00000000   DWORD       Timestamp
     00000004   LONG        Unknown (0)
    +00000008   LONG        Number of Phonebook entries
    +0000000C    ---        List of consecutive Phonebook entries
   $+00000000   WORD        // Separator value
    +00000002   DWORD       Timestamp
   $+00000006   LONG        Number of contact groups
    +0000000A    ---        List of consecutive contact groups



    ================================================================
    == Format of My Details v2000/2 (ICQ 2000a/2000b/2002a) data:
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        -1 (Entry is not filed)
     00000008   LONG        DAT entry number        = 1005
     0000000C   BYTE        first byte of signature = E4h
     0000000D   UNKNOWN 15  Rest of signature
                            23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        label   = 55534552h ('USER')
     00000022   LONG        user entry status: 6 = "My Details"
     00000026   LONG        0 (Unknown, most likely an unused group entry)
     0000002A   WORD        // Separator value
     0000002C   LONG        Number of user event WAV entries
     00000030    ---        List of consecutive user event WAV entries
   $+00000000   WORD        // Separator value
    +00000002   LONG        Number of property blocks
    +00000006    ---        List of consecutive property blocks
   $+00000000   WORD        // Separator value
    +00000002   LONG        Timestamp, time of last update?
    +00000006   LONG        Number of contact groups
    +0000000A    ---        List of consecutive contact groups



    ================================================================
    == Format of My Details v2001a (ICQ 2001a/2001b) data:
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        -1 (Entry is not filed)
     00000008   LONG        DAT entry number        = 1005
     0000000C   BYTE        first byte of signature = E4h
     0000000D   UNKNOWN 15  Rest of signature
                            23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        label   = 55534552h ('USER')
     00000022   LONG        User entry status: 6 = "My Details"
     00000026   LONG        0 (Unknown, most likely an unused group entry)
     0000002A   WORD        // Separator value
     0000002C   LONG        Number of property blocks
     00000030               List of consecutive property blocks
   $+00000000   WORD        // Separator value
    +00000002   LONG        Time of last information update? (local time)
	                    Example: 7D,FE,56,3C (32bit date+time, with seconds)
                                     = 01-29-2002, 19:56:45
    +00000006   LONG        Number of contact groups
    +0000000A    ---        List of consecutive contact groups




***
*** Messages
***
   

    ================================================================
    == URL Message format (ICQ 99a-2002a)
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        Entry type?
                                0 = Message
     00000008   LONG        DAT entry number
     0000000C   UNKNOWN 16  Signature
                                E0,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
                               or:
                                A0,C0,0C,2F,5C,95,D3,11,8D,D7,00,10,4B,06,46,2E
     0000001C   WORD        // Separator value
     0000001E   LONG        Filing flags
                                bit  0  = filed in 0:Outgoing, 1:Incoming
                                bit  1  = filed in 'Deleted Items', 0:No, 1:Yes
                                bit  2  = filed in 'MessageDialog', 0:No, 1:Yes
     00000022   WORD        Entry sub type
                                4 = URL
     00000024   LONG        UIN of sender/receiver
     00000028   WORD        Length of description and url (incl. NULL)
     0000002C   ASCIIZ      Description and URL. This is a single string but with
                            two parts. They are separated with one FEh BYTE (-2).
   $+00000000   LONG        Status of receiving user:
                                 0: Online, FFC, Invisible, Offline
                                 4: Away
                                14: N/A
                                -1: Occupied, DND,
     00000004   LONG        Sent or received
                                 0: Received
                                 1: Sent
     00000008   WORD        // Separator value
     0000000A   LONG        Timestamp
     0000000D   UNKNOWN 27  Zeroes


    Notes by Strickz:
       1. When a URL message is received it is first stored in a longer format, when it
          has been read it is rewritten with the smaller format described above.
       2. I haven't seen any syntax difference between the two signatures, so I treat them
          exactly the same for now.


    ================================================================
    == Short Message Format (ICQ 99a-2002a)
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        Entry type?
                                0       = Message
                                5       = Unread message
     00000008   LONG        DAT entry number
     0000000C   UNKNOWN 16  Signature
                                E0,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        Filing flags
                                bit  0  = filed in 0:Outgoing, 1:Incoming
                                bit  1  = filed in 'Deleted Items', 0:No, 1:Yes
                                bit  2  = filed in 'MessageDialog', 0:No, 1:Yes
                            Unread messages = 0
     00000022   WORD        Entry sub type
                                1 = Message
     00000024   LONG        UIN of sender/receiver
     00000028   WORD        Length of message text
     0000002C   ASCIIZ      Message text
   $+00000000   LONG        Status of receiving user:
                                 0: Online, FFC, Invisible, Offline
                                 4: Away
                                14: N/A
                                -1: Occupied, DND,
     00000004   LONG        Sent or received
                                 0: Received
                                 1: Sent
    +00000008   WORD        // Separator value
    +0000000A   LONG        Timestamp
    +0000000E   UNKNOWN 27  27 zeroes



    ================================================================
    == Long Message Format
    ================================================================

     00000000   LONG        The following number of bytes in data
     00000004   LONG        Entry type?
                                0       = Message
                                5       = Unread message
     00000008   LONG        DAT entry number
     0000000C   UNKNOWN 16  Signature
                                50,3B,C1,5C,5C,95,D3,11,8D,D7,00,10,4B,06,46,2E
     0000001C   WORD        // Separator value
     0000001E   LONG        Filing flags
                                bit  0  = filed in 0:Outgoing, 1:Incoming
                                bit  1  = filed in 'Deleted Items', 0:No, 1:Yes
                                bit  2  = filed in 'MessageDialog', 0:No, 1:Yes
                            Unread messages = 0
     00000022   WORD        Entry sub type
                                1 = Message
     00000024   LONG        UIN of sender/receiver
     00000028   WORD        Length of text
                                When received from 2002a this is 1 and text is only a
                                NULL character
     0000002A   ASCIIZ      ANSI text
   $+00000000   LONG        Status of receiving user:
                                 0: Online, FFC, Invisible, Offline, DND, Occupied
                                 4: Away
                                14: N/A
                                Value is always 0 when receiving client was Miranda
     00000004   LONG        Sent or received
                                 0: Received
                                 1: Sent
     00000008   WORD        // Separator value
     0000000A   LONG        Timestamp
     0000000E   UNKNOWN 19  Zeroes
     00000021   WORD        Length of Rich text
                            When message was sent to online 2002a user, this is 0 and the rich
                            text is missing.
     00000023	ASCIIZ      Rich Text
   $+00000000   WORD        Length of UTF8 text
    +00000002   ASCIIZ      UTF8 Text
   $+00000000   LONG        Unknown, always 0
    +00000004   LONG        Unknown, always 0
    +00000009   LONG        Unknown, received: 00800080h
                                     sent    : 00FFFFFFh


     Notes: The long format can keep up to three copies of the message text,
            two versions in plain text format and one in rich text format. The reason
            for this is unknown but it looks pretty stupid. The rich text version is never
            used once a message has been sent/received. Yet it is stored in the database making
            each message entry 2-3 times larger.





    ================================================================
    == URL format Miranda (unread event)
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        Where entry is filed?
                                5       = Unread?
     00000008   LONG        DAT entry number?
     0000000C   UNKNOWN 16  Signature
                                EA,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        Filing status?
                                bit  0  = filed as 0:Sent, 1:Received
                                bit  1  = in Deleted Items -- 0:no, 1:yes
                                bit  2  = in Messages -- 0:no, 1:yes
                            0 = Unread
     00000022   WORD        1Ah (26)
     00000024   LONG        UIN of sender/receiver
     00000028   LONg        Length of description and url (incl. NULL)
     0000002C   ASCIIZ      Description and URL
*  $+00000000   LONG        4
*    00000004   LONG        0
     00000008   WORD        // Separator value
     0000000A   LONG        Timestamp
     0000000D   UNKNOWN 27  Zeroes

     00000028   WORD        Length of signature and the textstring+zeroes      ++ START OF BLOCK
     0000002A   UNKNOWN 16  Another signature?
                            37,1C,58,72,E9,87,D4,11,A4,C1,00,D0,B7,59,B1,D9
     0000003C   WORD        0
     0000003E   LONG        Length of textstring (no terminating zero)
*    00000042   ASCIIZ      String: "Send URL"
   $+00000000   LONG        0
    +00000005   LONG        1
    +00000009   UNKNOWN 11  Zeroes                                             ++ ENDS BLOCK

    +0000000F   LONG        Looks like length of url+4 bytes.
    +00000013   LONG        Length of URL message content
    +00000017   ASCIIZ      Description+URL, the two parts are separated with
                            one FEh BYTE (-2). Not NULL terminated.


    ================================================================
    == URL format 2002a (unread)
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        Where entry is filed?
                                5       = Unread?
     00000008   LONG        DAT entry number?
     0000000C   UNKNOWN 16  Signature
                                EA,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        Filing status?
                                bit  0  = filed as 0:Sent, 1:Received
                                bit  1  = in Deleted Items -- 0:no, 1:yes
                                bit  2  = in Messages -- 0:no, 1:yes
                            0 = Unread
     00000022   WORD        1Ah (26)
     00000024   LONG        UIN of sender/receiver
     00000028   LONG        1 (length?)
     0000002C   UNKNOWN 1   0, Terminating zero of an empty string?
*    0000002D   UNKNOWN 6   Zeroes
     00000033   WORD        // Separator value
     00000035   LONG        Timestamp
     00000039   UNKNOWN 27  Zeroes

     00000054   WORD        Length of signature and the textstring+zeroes      ++ START OF BLOCK
     00000056   UNKNOWN 16  Another signature?
                            37,1C,58,72,E9,87,D4,11,A4,C1,00,D0,B7,59,B1,D9
     00000066   WORD        0
     0000006C   LONG        Length of textstring (no terminating zero)
     0000005F   ASCIIZ      String: "Send Web Page Address (URL)"
   $+00000000   BYTE        0 (terminating null?)
    +00000001   LONG        0
    +00000005   LONG        1
    +00000009   UNKNOWN 6   Zeroes                                             ++ ENDS BLOCK

    +0000000F   LONG        Looks like length of url+4 bytes. I have seen entries where  ++ START OF BLOCK
                            this value overflows the total event size at offset 0 by
                            2 bytes. Bug in ICQ?
    +00000013   LONG        Length of URL message content (excl. NULL)
    +00000017   ASCIIZ      Description+URL, the two parts are separated with
                            one FEh BYTE (-2).                                           ++ ENDS BLOCK

   $+00000000   WORD        0



***
*** Contact
***


    ================================================================
    == Format of Contact v99a (ICQ 99a) data:
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        Where entry is filed?
                                -1      = not filed? (Ex. MyDetails)
                                0       = Messages?
                                1       = Contact list?
                                2       = Ignore list?
                                9       = System Messages?
     00000008   LONG        DAT entry number = 1005
     0000000C   UNKNOWN 16  Signature
                                E5,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        Label   = 55534552h ('USER')
     00000022   LONG        User entry status:
                                2       = active
                                3       = Awaiting authorization
                                5       = removed from contact list
                                12      = deleted from address book?
                                13      = outdated/defunct???
                                14      = outdated/defunct???
     00000026   LONG        GroupID of contact group containing user
     0000002A   40 BYTEs    Unknown
     00000052   WORD        // Separator value
     00000054   LONG        Number of user event WAV entries
     00000058    ---        List of consecutive user event WAV entries
   $+00000000   38 BYTEs    Unknown
    +00000026   WORD        // Separator value
    +00000028    ---        99a user information for this contact
	                        See 'My Details v99a' for syntax



    ================================================================
    == Format of Contact (Db99b) data:
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        Where entry is filed?
                                -1      = not filed? (Ex. MyDetails)
                                0       = Messages?
                                1       = Contact list?
                                2       = Ignore list?
                                9       = System Messages?
     00000008   LONG        DAT entry number = 1005
     0000000C   UNKNOWN 16  Signature
                                E5,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        Label   = 55534552h ('USER')
     00000022   LONG        User entry status:
                                2       = active
                                3       = Awaiting authorization
                                5       = removed from contact list
                                12      = deleted from address book?
                                13      = outdated/defunct???
                                14      = outdated/defunct???
     00000026   LONG        GroupID of contact group containing user
     0000002A   WORD        // Separator value
     0000002C   LONG        Number of user event WAV entries
     00000030    ---        List of consecutive user event WAV entries
   $+00000000   WORD        // Separator value
    +00000002   LONG        Number of property blocks
    +00000006    ---        List of consecutive property blocks
    +00000000   DWORD       Timestamp
     00000004   LONG        Unknown (0)
    +00000008   LONG        Number of Phonebook entries
    +0000000C    ---        List of consecutive Phonebook entries
   $+00000000   WORD        // Separator value
    +00000002   DWORD       Timestamp



    ================================================================
    == Format of Contact v2000a & v2000b (ICQ 2000a/2000b) data:
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        Where entry is filed?
                                -1      = not filed? (Ex. MyDetails)
                                0       = Messages?
                                1       = Contact list?
                                2       = Ignore list?
                                9       = System Messages?
     00000008   LONG        DAT entry number = 1005
     0000000C   UNKNOWN 16  Signature
                                E5,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        Label   = 55534552h ('USER')
     00000022   LONG        User entry status:
                                2       = active
                                3       = Awaiting authorization
                                5       = removed from contact list
                                12      = deleted from address book?
                                13      = outdated/defunct???
                                14      = outdated/defunct???
     00000026   LONG        GroupID of contact group containing user
     0000002A   WORD        // Separator value
     0000002C   LONG        Number of user event WAV entries
     00000030    ---        List of consecutive user event WAV entries
   $+00000000   WORD        // Separator value
    +00000002   LONG        Number of property blocks
    +00000006    ---        List of consecutive property blocks
   $+00000000   WORD        // Separator value
    +00000002   LONG        Timestamp, time of last update?



    ================================================================
    == Format of Contact v2001a (ICQ 2001a/2001b) data:
    ================================================================
     00000000   LONG        The following number of bytes in data
     00000004   LONG        Where entry is filed?
                                -1      = not filed? (Ex. MyDetails)
                                0       = Messages?
                                1       = Contact list?
                                2       = Ignore list?
                                9       = System Messages?
     00000008   LONG        DAT entry number = 1005
     0000000C   UNKNOWN 16  Signature
                                E5,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        Label   = 55534552h ('USER')
     00000022   LONG        User entry status:
                                2       = active
                                3       = Awaiting authorization
                                5       = removed from contact list
                                12      = deleted from address book?
                                13      = outdated/defunct???
                                14      = outdated/defunct???
     00000026   LONG        GroupID of contact group containing user
     0000002A   WORD        // Separator value
     0000002C   LONG        Number of property blocks
     00000030    ---        List of consecutive property blocks
   $+00000000   WORD        // Separator value
    +00000002   LONG        Timestamp, time of last update



    ================================================================
    == Format of Contact v2002a (ICQ 2002a) data:
    ================================================================

     00000000   LONG        The following number of bytes in data
     00000004   LONG        Where entry is filed?
                                -1      = not filed? (Ex. MyDetails)
                                0       = Messages?
                                1       = Contact list?
                                2       = Ignore list?
                                9       = System Messages?
     00000008   LONG        DAT entry number = 1005
     0000000C   UNKNOWN 16  Signature
                                E5,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     0000001C   WORD        // Separator value
     0000001E   LONG        label   = 55534552h ('USER')
     00000022   LONG        User entry status:
                                2       = active
                                3       = Awaiting authorization
                                5       = removed from contact list
                                12      = deleted from address book?
                                13      = outdated/defunct???
                                14      = outdated/defunct???
     00000026   LONG        GroupID of contact group containing user
     0000002A   WORD        // Separator value
     0000002C   LONG        Unknown, 0
     00000030   WORD        // Separator value
     00000032   LONG        Number of property blocks
     00000036               List of consecutive property blocks
   $+00000000   WORD        // Separator value
    +00000002   LONG        Timestamp, time of last update


     >> Contact properties that sounds interesting
     Property                            Data type   Description
     ----------------------------------- ----------- -----------------------------
     UserCategory                        LONG        Unknown (Entry status?)
     RealGroupID                         LONG        Same as GroupID above?
     ----------------------------------- ----------- -----------------------------
     Comment: The question here is, if the same information appears both in header
              and in properties, which one should we use? Can they be different?



***
*** General
***


     >> Separator values
     The separator value appears in many places. It is a 2-byte value and
     reflects the version of ICQ that the database was used with. Exactly
     when and how the values get updated is still a bit unclear. Not all
     entries get updated when the ICQ version is updated, there are always
     a couple of entries that are left with the old value but they still appear
     correctly in the history.


     Version           Separator value     ICQ release date
     ----------------- ------------------- ----------------
	 ICQ 2003a v5.45   21,02
     ICQ 2002a         16,02 (534)         19/04 2002
     ICQ 2002a         15,02 (533)         25/03 2002
     ICQ 2001b v5.18   06,02 (518)         28/11 2001
     ICQ 2001b v5.17   05,02 (517)         12/11 2001
     ICQ 2001b v5.16   04,02 (516)         08/11 2001
     ICQ 2001b v5.15   03,02 (515)         30/10 2001
     ICQ 2001  v4.70                       15/10 2001
     ICQ 2001  v4.65   01,D1 (465)         04/09 2001
     ICQ 200   v4.63                       07/02 2001
     ICQ 200   v4.60                       25/10 2000
     ICQ 200   v4.56                       26/09 2000
     ICQ 2000b v4.55                       21/09 2000
     ICQ 2000a v4.31                       31/05 2000
     ICQ 2000a v4.30                       11/05 2000
     ICQ 2000a v4.29                       24/04 2000
     ICQ 99b   v3.19                       31/08 2000
     ICQ 99b   v3.18                       29/08 1999
     ICQ 99b   v3.17                       16/08 1999
     ICQ 99b   v3.01                       ?
     ICQ 99a   v2.24                       01/08 1999
     ICQ 99a   v2.22                       15/06 1999
     ICQ 99a   v2.21                       18/05 1999
     ICQ 99a   v2.20                       03/05 1999
     ICQ 99a   v2.15                       13/04 1999
     ICQ 99a   v2.05   CD,00 (205)         ?
     ICQ 98    v1.52   98,00 (152)         ? 1998



     >> Format of property block:
     00000000   WORD        // Separator value
     00000004   LONG        Number of user properties
     00000008    ---        List of consecutive user properties


     >> Format of each property:
     00000000   WORD        Length of property name
     00000002   ASCIIZ      Property name
   $+00000000   BYTE        Property value type:
                                100 / 64h  = CHAR
                                101 / 65h  = BYTE
                                102 / 66h  = WORD
                                103 / 67h  = INTEGER
                                104 / 68h  = DWORD
                                105 / 69h  = LONG
                                107 / 6bh  = ASCIIZ (1 WORD + String)
                                109 / 6dh  = Sublist (see below)
                                111 / 6fh  = DWORD (length) + BYTE array
    +00000001  <var>        Property value


     >> Format of 6D sub list
     00000000  LONG         Number of properties in sub list
     00000004  BYTE         Sublist type? (6B or 6E)
     00000005   ---         List of consecutive 6D6B or 6D6E properties

     Comment:  There appears to exist two variations, the 6B- & the 6E-variation.
               6B is just a list of strings, 6E is a complete property list which
               means that it can be recursive.

     >> Format of the 6D6B property
     00000000  WORD         Length of string
     00000002  ASCIZZ       String

     >> Format of the 6D6E property
     00000000  WORD         // Separator value
     00000002  LONG         Number of properties
     00000006   ---         List of consecutive properties

     Comment:  This is the same as a standard property block.


     >> Format of Wav entry:
     00000000   WORD        //separator value
     00000002   LONG        user event for which Wav will be played:
                                1       = Message
                                2       = Chat
                                3       = File
                                4       = URL
                                10      = Externals
                                19      = Contact
                                20      = Phone
                                2007    = User ID       // Not in My Details
                                2010    = Online Alert
     00000006   LONG        0:play default WAV, 1:play the user-specified WAV
     0000000A   WORD        length of file name
     0000000C   ASCIIZ      full path and file name of WAV


     >> Format of contact group (2000a and later):
     00000000  WORD         // Separator value
     00000002  LONG         Number of group properties
     00000006               List of group properties

     Comment:  This is the same as a standard property block.

     >> Known group properties
     Property                            Data type   Description
     ----------------------------------- ----------- -----------------------------
     FirstState                          LONG        Unknown (Visual state?)
     GroupID                             LONG        3 = Awaiting authorization, 1000 and over
                                                     means a user defined group
     GroupName                           ASCIIZ      Name of the group
     ParentID                            LONG        Unknown (always 0 in my test DBs)
     ----------------------------------- ----------- -----------------------------
     Comment:  Only GroupID and GroupName seems to be required


     >> Format of contact group (99a & 99b):
     00000000   LONG        Group ID:
                                3 = Awaiting authorization, 1000 and over
                                means a user defined group
     00000004   WORD        Length of group name
     00000006   ASCIIZ      Group name
   $+00000000   LONG        Unknown, usually -1
    +00000004   WORD        Group visual status, 0 = Closed, 1 = Open


     >> Format of Event WAV entry (99a):
     00000000   WORD        // Separator value
     00000002   LONG        User event for which WAV will be played:
                                1       = Message
                                2       = Chat
                                3       = File
                                4       = URL
                                10      = Externals
                                19      = Contact
                                20      = Phone
                                2007    = User ID       //not in My Details
                                2010    = Online Alert
     00000006   LONG        0 = Play default WAV, 1 = play the user-specified WAV
     0000000A   WORD        length of file name
     0000000C   ASCIIZ      full path and file name of WAV


     >> Format of Phonebook entry (99a & 99b):
     00000000   WORD        length of phone number entry name
     00000002   ASCIIZ      phone number entry name
   $+00000000   WORD        length of area code text
    +00000002   ASCIIZ      area code text
   $+00000000   WORD        length of prefix text
    +00000002   ASCIIZ      prefix text
   $+00000000   WORD        length of country name
    +00000002   ASCIIZ      country name
   $+00000000   WORD        ??? (0) 1
    +00000002   WORD        length of number (last 4 digits) text
    +00000004   ASCIIZ      number text


     >> Timestamps

     >> Entry types

	00h     - Message
        09h	- System message
        0Bh	- Chat log?

     >> DAT Signatures

     DAT signatures are sequences of 16 bytes that appear in the beginning of most
     database entry types. They could be useful if you want to scan a DAT file for
     certain types of data without using the IDX file.

     Various messages:      E0,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     Chat request:          E1,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     File request:          E2,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     My Details:            E4,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     Contact:               E5,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     Reminder:              E6,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91
     Note:                  EE,23,A3,DB,DF,B8,D1,11,8A,65,00,60,08,71,A3,91