home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / JAMAPI.ZIP / TPAPI.ZIP / JAM.PAS next >
Encoding:
Pascal/Delphi Source File  |  1993-07-01  |  5.9 KB  |  186 lines

  1. (*
  2. **    JAM(mbp) - The Joaquim-Andrew-Mats Message Base Proposal
  3. **
  4. **    Turbo Pascal API
  5. **
  6. **    Written by Joaquim Homrighausen.
  7. **
  8. **    ----------------------------------------------------------------------
  9. **
  10. **    jam.pas (JAMmb)
  11. **
  12. **    Prototypes and definitions for the JAM message base format
  13. **
  14. **    Copyright 1993 Joaquim Homrighausen, Andrew Milner, Mats Birch, and
  15. **    Mats Wallin. ALL RIGHTS RESERVED.
  16. **
  17. **    93-06-28    JoHo
  18. **    Initial coding
  19. *)
  20. UNIT JAM;
  21.  
  22. {$IFNDEF VER55}
  23.     {$A-,B-,E-,D+,L+,F-,I-,N-,O-,R-,S-,V-,X+}
  24. {$ELSE}
  25.     {$A-,B-,E-,D+,L+,F-,I-,N-,O-,R-,S-,V-}
  26. {$ENDIF}
  27.  
  28. INTERFACE
  29.  
  30. {-Some generic types}
  31.  
  32. TYPE
  33.     JAMBUFPTR            =    ^JAMBUF;
  34.     JAMBUF                =    array[1..$fffe] of char;
  35.     FILENAMETYPE    =    string[200];
  36.     ASCIIZ                =    array[1..255] of char;
  37.     ARRAY4                =    array[1..4] of char;
  38.  
  39. {-File extensions}
  40.  
  41. CONST
  42.     EXT_HDRFILE        =    '.JHR';
  43.     EXT_TXTFILE        =    '.JDT';
  44.     EXT_IDXFILE        =    '.JDX';
  45.     EXT_LRDFILE        =    '.JLR';
  46.     HEADERSIG            : ARRAY4 = ('J','A','M',#0);
  47.  
  48. {-Current revision level}
  49.  
  50.     CurrentRevLev    =    1;
  51.  
  52. {-Header file information block, stored first in all .JHR files}
  53.  
  54. TYPE
  55.     JAMHDRINFO        =    RECORD
  56.         Signature        :    ARRAY4;      {<J><A><M> followed by <NUL>}
  57.         DateCreated    :    LONGINT;     {Creation date}
  58.         ModCounter    :    LONGINT;     {Last processed counter}
  59.         ActiveMsgs    :    LONGINT;     {Number of active (not deleted) messages}
  60.         PasswordCRC    :    LONGINT;     {CRC-32 of password to access, or -1 if none}
  61.         BaseMsgNum    :    LONGINT;     {Lowest message number in index file}
  62.         Reserved        :    ARRAY[1..1000] of CHAR;
  63.     END;{JAMHDRINFO}
  64.  
  65. {-Message status bits}
  66.  
  67. CONST
  68.     MSG_LOCAL                =    $00000001; {Msg created locally}
  69.     MSG_INTRANSIT        =    $00000002; {Msg is in-transit}
  70.     MSG_PRIVATE            =    $00000004; {Private}
  71.     MSG_READ        =    $00000008; {Read by addressee}
  72.     MSG_SENT        =    $00000010; {Sent to remote}
  73.     MSG_KILLSENT    =    $00000020; {Kill when sent}
  74.     MSG_ARCHIVESENT =    $00000040; {Archive when sent}
  75.     MSG_HOLD        =    $00000080; {Hold for pick-up}
  76.     MSG_CRASH       =    $00000100; {Crash}
  77.     MSG_IMMEDIATE   =    $00000200; {Send Msg now, ignore restrictions}
  78.     MSG_DIRECT      =    $00000400; {Send directly to destination}
  79.     MSG_GATE        =    $00000800; {Send via gateway}
  80.     MSG_FILEREQUEST =    $00001000; {File request}
  81.     MSG_FILEATTACH  =    $00002000; {File(s) attached to Msg}
  82.     MSG_TRUNCFILE   =    $00004000; {Truncate file(s) when sent}
  83.     MSG_KILLFILE    =    $00008000; {Delete file(s) when sent}
  84.   MSG_RECEIPTREQ  = $00010000; {Return receipt requested}
  85.   MSG_CONFIRMREQ  = $00020000; {Confirmation receipt requested}
  86.   MSG_ORPHAN      = $00040000; {Unknown destination}
  87.   MSG_ENCRYPT     = $00080000; {Msg text is encrypted}
  88.   MSG_COMPRESS    = $00100000; {Msg text is compressed}
  89.   MSG_ESCAPED     = $00200000; {Msg text is seven bit ASCII}
  90.   MSG_FPU         = $00400000; {Force pickup}
  91.   MSG_TYPELOCAL   = $00800000; {Msg is for local use only (not for export)}
  92.   MSG_TYPEECHO    = $01000000; {Msg is for conference distribution}
  93.   MSG_TYPENET     = $02000000; {Msg is direct network mail}
  94.     MSG_NODISP      =    $20000000; {Msg may not be displayed to user}
  95.     MSG_LOCKED      =    $40000000; {Msg is locked, no editing possible}
  96.     MSG_DELETED     =    $80000000; {Msg is deleted}
  97.  
  98. {-Message header}
  99.  
  100. TYPE
  101.     JAMHDR                    =    RECORD
  102.         Signature            :    ARRAY4;    {<J><A><M> followed by <NUL>}
  103.         Revision            :    WORD;      {CurrentRevLev}
  104.         ReservedWord    :    WORD;      {Reserved for future use}
  105.         SubfieldLen        :    LONGINT;   {Length of subfields}
  106.         TimesRead            :    LONGINT;   {Number of times message read}
  107.         MsgIdCRC            :    LONGINT;   {CRC-32 of MSGID line}
  108.         ReplyCRC            :    LONGINT;   {CRC-32 of REPLY line}
  109.         ReplyTo                :    LONGINT;   {This msg is a reply to..}
  110.         Reply1st            :    LONGINT;   {First reply to this msg}
  111.         ReplyNext            :    LONGINT;   {Next msg in reply chain}
  112.         DateWritten        :    LONGINT;   {When msg was written}
  113.         DateReceived    :    LONGINT;   {When msg was received/read}
  114.         DateProcessed    :    LONGINT;   {When msg was processed by packer}
  115.         MsgNum                :    LONGINT;   {Message number (1-based)}
  116.         Attribute            :    LONGINT;   {Msg attribute, see "Status bits"}
  117.         Attribute2        :    LONGINT;   {Reserved for future use}
  118.         TxtOffset            :    LONGINT;   {Offset of text in text file}
  119.         TxtLen                :    LONGINT;   {Length of message text}
  120.         PasswordCRC        :    LONGINT;   {CRC-32 of password to access msg}
  121.         Cost                    :    LONGINT;   {Cost of message}
  122.     END;{JAMHDR}
  123.  
  124. {-Message header subfield types}
  125.  
  126. CONST
  127.     JAMSFLD_OADDRESS        =    0;
  128.     JAMSFLD_DADDRESS        =    1;
  129.     JAMSFLD_SENDERNAME    =    2;
  130.     JAMSFLD_RECVRNAME        =    3;
  131.     JAMSFLD_MSGID                =    4;
  132.     JAMSFLD_REPLYID            =    5;
  133.     JAMSFLD_SUBJECT            =    6;
  134.     JAMSFLD_PID                    =    7;
  135.     JAMSFLD_TRACE                =    8;
  136.     JAMSFLD_ENCLFILE        =    9;
  137.     JAMSFLD_ENCLFWALIAS    =    10;
  138.     JAMSFLD_ENCLFREQ        =    11;
  139.     JAMSFLD_ENCLFILEWC    =    12;
  140.     JAMSFLD_ENCLINDFILE    =    13;
  141.     JAMSFLD_EMBINDAT        =    1000;
  142.     JAMSFLD_FTSKLUDGE        =    2000;
  143.     JAMSFLD_SEENBY2D        =    2001;
  144.     JAMSFLD_PATH2D            =    2002;
  145.     JAMSFLD_FLAGS                =    2003;
  146.     JAMSFLD_TZUTCINFO        =    2004;
  147.     JAMSFLD_UNKNOWN            =    $ffff;
  148.  
  149. {-Message header subfield}
  150.  
  151. TYPE
  152.     JAMSUBFIELDPTR    =    ^JAMSUBFIELD;
  153.     JAMSUBFIELD            =    RECORD
  154.         LoID                    :    WORD;      {Field ID, 0 - $ffff}
  155.         HiID                    :    WORD;      {Reserved for future use}
  156.         DatLen                :    LONGINT;   {Length of buffer that follows}
  157.         Buffer                :    JAMBUFPTR; {Data buffer}
  158.     END;{JAMSUBFIELD}
  159.     JAMBINSUBFIELDPTR    =    ^JAMSUBFIELD;
  160.     JAMBINSUBFIELD    =    RECORD
  161.         LoID                    :    WORD;      {Field ID, 0 - $ffff}
  162.         HiID                    :    WORD;      {Reserved for future use}
  163.         DatLen                :    LONGINT;   {Length of buffer that follows}
  164.     END;{JAMSUBFIELD}
  165.  
  166. {-Message index record}
  167.  
  168.     JAMIDXREC                =    RECORD
  169.         UserCRC                :    LONGINT;   {CRC-32 of destination username (lowercase)}
  170.         HdrOffset            :    LONGINT;   {Offset of header in .JHR file}
  171.     END;{JAMIDXREC}
  172.  
  173. {-Lastread structure, one per user}
  174.  
  175.     JAMLREAD                =    RECORD
  176.         UserCRC                :    LONGINT;   {CRC-32 of username (lowercase)}
  177.         UserID                :    LONGINT;   {Unique UserID}
  178.         LastReadMsg        :    LONGINT;   {Last read message number}
  179.         HighReadMsg        :    LONGINT;   {Highest read message number}
  180.     END;{JAMLREAD}
  181.  
  182. IMPLEMENTATION
  183. END.
  184.  
  185. (* end of file "jam.pas" *)
  186.