{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Author:       Alexander Vaga
EMail:        primary:   icq2000cc@hobi.ru
              secondary: alexander_vaga@hotmail.com
Web:          http://icq2000cc.hobi.ru
Creation:     May, 2002
Legal issues: Copyright (C) 2002 by Alexander Vaga
              Kyiv, Ukraine

              This software is provided 'as-is', without any express or
              implied warranty.  In no event will the author be held liable
              for any  damages arising from the use of this software.

              Permission is granted to anyone to use this software for any
              purpose, including commercial applications, and to alter it
              and redistribute it freely.
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

unit Typess;

interface
uses stdctrls,messages;

const msg_SInfo  =  WM_USER+5000;
const msg_UInfo  =  WM_USER+5001;
const msg_OnSrv =   WM_USER+5002;
const msg_Sent =    WM_USER+5003;
const msg_SentErr = WM_USER+5004;
const msg_NextOFF = WM_USER+5005;
const msg_NextON =  WM_USER+5006;

 III = $10020000; // INVISIBLE IP
// III=$00000000; // VISIBLE IP
 STATE_ONLINE           =III+$0;
 STATE_AWAY             =III+$1;
 STATE_DND              =III+$13;
 STATE_INVISIBLE        =III+$100;
 STATE_OCCUPIED         =III+$11;
 STATE_FREEFORCHAT      =III+$20;
 STATE_N_A              =III+$5;

 TYPE_MSG         =$01;
 TYPE_CHAT        =$02;
 TYPE_FILE        =$03;
 TYPE_URL         =$04;
 TYPE_AUTH_REQ    =$06;
 TYPE_AUTH_DEN    =$07;
 TYPE_AUTH_GIV    =$08;
 TYPE_ADDED       =$0C;
 TYPE_WEBPAGER    =$0D;
 TYPE_EXPRESS     =$0E;
 TYPE_CONTACT     =$13;
 TYPE_CONTACT_REG =$1A;

const PACKET_DATA_SIZE = 4096;
type
   PByteArray = ^TByteArray;
   PCharArray = ^TCharArray;
   TCharArray    = array[0..PACKET_DATA_SIZE-1] of char;
   TByteArray    = array[0..PACKET_DATA_SIZE-1] of byte;

   PWORD = ^word;
   PLONG = ^longint;
   PBYTE = ^byte;

type PFLAP_HDR = ^FLAP_HDR;
     FLAP_HDR = packed record
       Sign : byte;
       ChID : byte;
       SEQ  : word;
       Len  : word;
     end;

type PSNAC_HDR = ^SNAC_HDR;
     SNAC_HDR = packed record
       FamilyID  : word;
       SubTypeID : word;
       Flags     : array[0..1] of byte;
       RequestID : longint;
     end;

type PFLAP_Item = ^FLAP_Item;
     FLAP_Item = packed record
       FLAP : FLAP_HDR;
       DATA : PByteArray;
       Next : PFLAP_Item;
     end;

type PMsgItem = ^MsgItem;
     MsgItem = packed record
       FromUIN : longint;
       DateTime : string;
       Text : PByteArray;
       Len  : integer;
       FG   : string[9];
       BG   : string[9];
       Next : PMsgItem;
     end;

type
   Pack = packed record
      cursor : word;
      length : word;
      case integer of
        0: (DATA:array[0..PACKET_DATA_SIZE-1] of byte);
        1: (FLAP : FLAP_HDR;
            FLAP_BODY:array[0..PACKET_DATA_SIZE-1] of byte);
        2: (Sign,ChID:byte;  SEQ,Len  : word);
        3: (fix:FLAP_HDR;
            SNAC:SNAC_HDR;
            SNAC_BODY:array[0..PACKET_DATA_SIZE-1] of byte);
    end;
   PPack = ^Pack;

type TInfoFieldsDef = (dEND,dNick,dFirst,dLast,dE_Mail,dIP,dReal_IP,dVer,dAuth,dSec_E_Mail,
      dOld_E_Mail,dCity,dState,dPhone,dFax,dCellular,dZip,dStreet,dCountry,
      dTimeZone,dWebAware,dHideIP,dAge,dGender,dHomepage,dByear,dBmonth,dBday,dAbout,
      dLang1,dLang2,dLang3,dInterests,dBackgrounds,dAffiliations,dStatus,dFailure,
      dMeta_Srv_Res,dwCity,dwState,dwPhone,dwFax,dwStreet,dwZip,
      dwCountry,dCompany,dDepartment,dJob,dOccupation,dWhomepage
      );

type PInfoRec = ^TInfoRec;
     TInfoRec = packed record
        f    : TInfoFieldsDef;
        s    : string;
     end;

type PSearchRec = ^TSearchRec;
     TSearchRec = packed record
        uin     : longint;
        nick    : string;
        first   : string;
        last    : string;
        email   : string;
        auth    : word;
        status  : byte;
     end;

const online      = 0;
      freeforchat = 1;
      away        = 2;
      na          = 3;
      occupied    = 4;
      dnd         = 5;
      invisible   = 6;
      offline     = 7;
      etc         = 8;
      simply_icq  = 9;
      mes         = 10;
      empty       = 11;

type IParray = array[0..3] of byte;

type TListAppendix = packed record
       ICON_INDEX  : integer;
       MES_IS      : boolean;
       STATE_BLINK : byte;
       FG          : string[40];
       BG          : string[40];
     end;

type TListRecord = packed record
       UIN        : longint;
       PMSG       : PMsgItem;
       NICK       : string[40];
       FIRST      : string[40];
       LAST       : string[40];
       PRI_E_MAIL : string[40];
       SEC_E_MAIL : string[40];
       OLD_E_MAIL : string[40];
       IP         : IParray;
       REAL_IP    : IParray;
       PORT       : longint;
       TCP_IS     : byte;
       AUTH       : byte;
       STATUS     : byte;
       VER        : longint;
       CITY       : string[40];
       WCITY      : string[40];
       STATE      : string[40];
       WSTATE     : string[40];
       PHONE      : string[40];
       WPHONE     : string[40];
       FAX        : string[40];
       WFAX       : string[40];
       CELLULAR   : string[40];
       STREET     : string[40];
       WSTREET    : string[40];
       COUNTRY    : word;
       WCOUNTRY   : word;
       ZIP        : string[40];
       WZIP       : string[40];
       COMPANY    : string[40];
       DEPARTMENT : string[40];
       JOB        : string[40];
       OCCUPATION : word;
       TIMEZONE   : word;
       AGE        : word;
       GENDER     : word;
       HOMEPAGE   : string;
       WHOMEPAGE  : string;
       BYEAR      : word;
       BMONTH     : byte;
       BDAY       : byte;
       ABOUT      : string;
       LANG1,LANG2,LANG3 : byte;
       INTERESTS : string;
       BACKGROUNDS : string;
       AFFILIATIONS : string;
       EXTRA      : TListAppendix; // additional vars
     end;
     PListRecord = ^TListRecord;

type TContactList = array[0..100] of TListRecord;


implementation

end.






