home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / lora299s.zip / MSGBASE.H < prev    next >
C/C++ Source or Header  |  1998-05-12  |  23KB  |  834 lines

  1.  
  2. // LoraBBS Version 2.99 Free Edition
  3. // Copyright (C) 1987-98 Marco Maccaferri
  4. //
  5. // This program is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation; either version 2 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. #ifndef _MSGBASE_H
  20. #define _MSGBASE_H
  21.  
  22. #include "collect.h"
  23. #include "combase.h"
  24. #include "jam.h"
  25.  
  26. #define MAX_LINE_LENGTH       512
  27.  
  28. #define ST_JAM                0
  29. #define ST_SQUISH             1
  30. #define ST_USENET             2
  31. #define ST_FIDO               3
  32. #define ST_ADEPT              4
  33. #define ST_HUDSON             5
  34. #define ST_GOLDBASE           6
  35. #define ST_PASSTHROUGH        7
  36.  
  37. typedef struct {
  38.    UCHAR  Day;
  39.    UCHAR  Month;
  40.    USHORT Year;
  41.    UCHAR  Hour;
  42.    UCHAR  Minute;
  43.    UCHAR  Second;
  44. } MDATE;
  45.  
  46. class DLL_EXPORT TMsgBase
  47. {
  48. public:
  49.    TMsgBase (void) {};
  50.    virtual ~TMsgBase (void) {};
  51.  
  52.    ULONG   Id, Current;
  53.    CHAR    From[64];
  54.    CHAR    To[64];
  55.    CHAR    Subject[72];
  56.    UCHAR   Crash, Direct, FileAttach, FileRequest, Hold, Immediate;
  57.    UCHAR   Intransit, KillSent, Local, Private, ReceiptRequest, Received;
  58.    UCHAR   Sent;
  59.    MDATE   Written;
  60.    MDATE   Arrived;
  61.    CHAR    FromAddress[64];
  62.    CHAR    ToAddress[64];
  63.    ULONG   Reply, Original;
  64.    class   TCollection Text;
  65.  
  66.    virtual USHORT Add (VOID) = 0;
  67.    virtual USHORT Add (class TMsgBase *MsgBase) = 0;
  68.    virtual USHORT Add (class TCollection &MsgText) = 0;
  69.    virtual VOID   Close (VOID) = 0;
  70.    virtual USHORT Delete (ULONG ulMsg) = 0;
  71.    virtual ULONG  Highest (VOID) = 0;
  72.    virtual USHORT GetHWM (ULONG &ulMsg) = 0;
  73.    virtual USHORT Lock (ULONG ulTimeout = 0) = 0;
  74.    virtual ULONG  Lowest (VOID) = 0;
  75.    virtual ULONG  MsgnToUid (ULONG ulMsg) = 0;
  76.    virtual VOID   New (VOID) = 0;
  77.    virtual USHORT Next (ULONG &ulMsg) = 0;
  78.    virtual ULONG  Number (VOID) = 0;
  79.    virtual VOID   Pack (VOID) = 0;
  80.    virtual USHORT Previous (ULONG &ulMsg) = 0;
  81.    virtual USHORT ReadHeader (ULONG ulMsg) = 0;
  82.    virtual USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79) = 0;
  83.    virtual USHORT Read (ULONG ulMsg, SHORT nWidth = 79) = 0;
  84.    virtual VOID   SetHWM (ULONG ulMsg) = 0;
  85.    virtual ULONG  UidToMsgn (ULONG ulMsg) = 0;
  86.    virtual VOID   UnLock (VOID) = 0;
  87.    virtual USHORT WriteHeader (ULONG ulMsg) = 0;
  88.  
  89. protected:
  90.    CHAR   szBuff[MAX_LINE_LENGTH + 1];
  91.    CHAR   szLine[MAX_LINE_LENGTH + 1];
  92.    CHAR   szWrp[MAX_LINE_LENGTH + 1];
  93.    CHAR   *pLine, *pBuff;
  94. };
  95.  
  96. class DLL_EXPORT JAM : public TMsgBase
  97. {
  98. public:
  99.    JAM (void);
  100.    JAM (PSZ pszName);
  101.    ~JAM (void);
  102.  
  103.    USHORT Add (VOID);
  104.    USHORT Add (class TMsgBase *MsgBase);
  105.    USHORT Add (class TCollection &MsgText);
  106.    VOID   Close (VOID);
  107.    USHORT Delete (ULONG ulMsg);
  108.    USHORT GetHWM (ULONG &ulMsg);
  109.    ULONG  Highest (VOID);
  110.    USHORT Lock (ULONG ulTimeout = 0);
  111.    ULONG  Lowest (VOID);
  112.    ULONG  MsgnToUid (ULONG ulMsg);
  113.    VOID   New (VOID);
  114.    USHORT Next (ULONG &ulMsg);
  115.    ULONG  Number (VOID);
  116.    USHORT Open (PSZ pszName);
  117.    VOID   Pack (VOID);
  118.    USHORT Previous (ULONG &ulMsg);
  119.    USHORT ReadHeader (ULONG ulMsg);
  120.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  121.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  122.    VOID   SetHWM (ULONG ulMsg);
  123.    ULONG  UidToMsgn (ULONG ulMsg);
  124.    VOID   UnLock (VOID);
  125.    USHORT WriteHeader (ULONG ulMsg);
  126.  
  127. private:
  128.    INT    fdHdr;
  129.    INT    fdJdt;
  130.    INT    fdJdx;
  131.    UCHAR *pSubfield;
  132.    CHAR   BaseName[128];
  133.    JAMHDRINFO jamHdrInfo;
  134.    JAMHDR     jamHdr;
  135. };
  136.  
  137. // --------------------------------------------------------------------------
  138.  
  139. typedef struct {
  140.    USHORT Len;                // LENGTH OF THIS STRUCTURE!
  141.    USHORT Rsvd1;              // reserved
  142.    ULONG  NumMsg;             // Number of messages in area
  143.    ULONG  HighMsg;            // Highest msg in area. Same as num_msg
  144.    ULONG  SkipMsg;            // Skip killing first x msgs in area
  145.    ULONG  HighWater;          // Msg# (not umsgid) of HWM
  146.    ULONG  Uid;                // Number of the next UMSGID to use
  147.    CHAR   Base[80];           // Base name of SquishFile
  148.    ULONG  BeginFrame;         // Offset of first frame in file
  149.    ULONG  LastFrame;          // Offset to last frame in file
  150.    ULONG  FreeFrame;          // Offset of first FREE frame in file
  151.    ULONG  LastFreeFrame;      // Offset of last free frame in file
  152.    ULONG  EndFrame;           // Pointer to end of file
  153.    ULONG  MaxMsg;             // Max # of msgs to keep in area
  154.    USHORT KeepDays;           // Max age of msgs in area (SQPack)
  155.    USHORT SzSqhdr;            // sizeof (SQHDR)
  156.    UCHAR  Rsvd2[124];         // Reserved by Squish for future use
  157. } SQBASE;
  158.  
  159. #define SQHDRID         0xAFAE4453L
  160.  
  161. #define FRAME_NORMAL    0x00
  162. #define FRAME_FREE      0x01
  163. #define FRAME_RLE       0x02  // not implemented
  164. #define FRAME_LZW       0x03  // not implemented
  165.  
  166. typedef struct {
  167.    ULONG  Id;                 // sqhdr.id must always equal SQHDRID
  168.    ULONG  NextFrame;
  169.    ULONG  PrevFrame;
  170.    ULONG  FrameLength;
  171.    ULONG  MsgLength;
  172.    ULONG  CLen;
  173.    USHORT FrameType;
  174.    USHORT Rsvd;
  175. } SQHDR;
  176.  
  177. typedef struct {
  178.    USHORT Zone;
  179.    USHORT Net;
  180.    USHORT Node;
  181.    USHORT Point;
  182. } NADDR;
  183.  
  184. #define MSGPRIVATE      0x0001
  185. #define MSGCRASH        0x0002
  186. #define MSGREAD         0x0004
  187. #define MSGSENT         0x0008
  188. #define MSGFILE         0x0010
  189. #define MSGFWD          0x0020
  190. #define MSGORPHAN       0x0040
  191. #define MSGKILL         0x0080
  192. #define MSGLOCAL        0x0100
  193. #define MSGHOLD         0x0200
  194. #define MSGXX2          0x0400
  195. #define MSGFRQ          0x0800
  196. #define MSGRRQ          0x1000
  197. #define MSGCPT          0x2000
  198. #define MSGARQ          0x4000
  199. #define MSGURQ          0x8000
  200.  
  201. #define MSGSCANNED      0x00010000L
  202. #define MSGUID          0x00020000L
  203.  
  204. #define XMSG_FROM_SIZE  36
  205. #define XMSG_TO_SIZE    36
  206. #define XMSG_SUBJ_SIZE  72
  207.  
  208. #define MAX_REPLY       9     // Max number of stored replies to one msg
  209.  
  210. typedef struct {
  211.    ULONG  Attr;
  212.    CHAR   From[XMSG_FROM_SIZE];
  213.    CHAR   To[XMSG_TO_SIZE];
  214.    CHAR   Subject[XMSG_SUBJ_SIZE];
  215.    NADDR  Orig;               // Origination and destination addresses             */
  216.    NADDR  Dest;
  217.    ULONG  DateWritten;        // When user wrote the msg (UTC)
  218.    ULONG  DateArrived;        // When msg arrived on-line (UTC)
  219.    SHORT  UtcOfs;             // Offset from UTC of message writer, in minutes.
  220.    ULONG  ReplyTo;
  221.    ULONG  Replies[MAX_REPLY];
  222.    ULONG  MsgId;
  223.    CHAR   FtscDate[20];       // Obsolete date information
  224. } XMSG;
  225.  
  226. typedef struct {
  227.    ULONG  Ofs;
  228.    ULONG  MsgId;
  229.    ULONG  Hash;
  230. } SQIDX;
  231.  
  232. class SQUISH : public TMsgBase
  233. {
  234. public:
  235.    SQUISH (void);
  236.    SQUISH (PSZ pszName);
  237.    ~SQUISH (void);
  238.  
  239.    USHORT Add (VOID);
  240.    USHORT Add (class TMsgBase *MsgBase);
  241.    USHORT Add (class TCollection &MsgText);
  242.    VOID   Close (VOID);
  243.    USHORT Delete (ULONG ulMsg);
  244.    USHORT GetHWM (ULONG &ulMsg);
  245.    ULONG  Hash (PSZ f);
  246.    ULONG  Highest (VOID);
  247.    USHORT Lock (ULONG ulTimeout = 0);
  248.    ULONG  Lowest (VOID);
  249.    ULONG  MsgnToUid (ULONG ulMsg);
  250.    VOID   New (VOID);
  251.    USHORT Next (ULONG &ulMsg);
  252.    ULONG  Number (VOID);
  253.    USHORT Open (PSZ pszName);
  254.    VOID   Pack (VOID);
  255.    USHORT Previous (ULONG &ulMsg);
  256.    USHORT ReadHeader (ULONG ulMsg);
  257.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  258.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  259.    VOID   SetHWM (ULONG ulMsg);
  260.    ULONG  UidToMsgn (ULONG ulMsg);
  261.    VOID   UnLock (VOID);
  262.    USHORT WriteHeader (ULONG ulMsg);
  263.  
  264. private:
  265.    FILE   *fpDat, *fpIdx;
  266.    USHORT Locked;
  267.    SQBASE SqBase;
  268.    SQIDX  SqIdx, *pSqIdx;
  269.    SQHDR  SqHdr;
  270.    XMSG   XMsg;
  271. };
  272.  
  273. // --------------------------------------------------------------------------
  274.  
  275. class DLL_EXPORT USENET : public TMsgBase
  276. {
  277. public:
  278.    USENET (void);
  279.    USENET (PSZ pszServer, PSZ pszGroup);
  280.    ~USENET (void);
  281.  
  282.    CHAR   HostName[32], Organization[64];
  283.    CHAR   NewsGroup[64], User[32];
  284.    CHAR   ProgramID[32];
  285.    CHAR   Error[128];
  286.  
  287.    USHORT Add (VOID);
  288.    USHORT Add (class TMsgBase *MsgBase);
  289.    USHORT Add (class TCollection &MsgText);
  290.    VOID   Close (VOID);
  291.    USHORT Delete (ULONG ulMsg);
  292.    ULONG  Highest (VOID);
  293.    USHORT GetHWM (ULONG &ulMsg);
  294.    USHORT Lock (ULONG ulTimeout = 0);
  295.    ULONG  Lowest (VOID);
  296.    ULONG  MsgnToUid (ULONG ulMsg);
  297.    VOID   New (VOID);
  298.    USHORT Next (ULONG &ulMsg);
  299.    ULONG  Number (VOID);
  300.    USHORT Open (PSZ pszServer, PSZ pszGroup);
  301.    VOID   Pack (VOID);
  302.    USHORT Previous (ULONG &ulMsg);
  303.    USHORT ReadHeader (ULONG ulMsg);
  304.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  305.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  306.    VOID   SetHWM (ULONG ulMsg);
  307.    ULONG  UidToMsgn (ULONG ulMsg);
  308.    VOID   UnLock (VOID);
  309.    USHORT WriteHeader (ULONG ulMsg);
  310.  
  311. private:
  312.    CHAR   szBuffer[1024];
  313.    ULONG  ulHighest;
  314.    ULONG  ulFirst;
  315.    ULONG  ulTotal;
  316.    ULONG  LastReaded;
  317.    class  TTcpip *Tcp;
  318.  
  319.    USHORT GetResponse (PSZ pszResponse, USHORT usMaxLen);
  320. };
  321.  
  322. // --------------------------------------------------------------------------
  323.  
  324. typedef struct {
  325.    USHORT OrigNode;
  326.    USHORT DestNode;
  327.    USHORT Year;
  328.    USHORT Month;
  329.    USHORT Day;
  330.    USHORT Hour;
  331.    USHORT Minute;
  332.    USHORT Second;
  333.    USHORT Rate;
  334.    USHORT Version;
  335.    USHORT OrigNet;
  336.    USHORT DestNet;
  337.    UCHAR  ProductL;
  338.    UCHAR  Serial;
  339.    CHAR   Password[8];
  340.    USHORT OrigZone;
  341.    USHORT DestZone;
  342.    USHORT Auxnet;
  343.    USHORT CWValidation;
  344.    UCHAR  ProductH;
  345.    UCHAR  Revision;
  346.    USHORT Capability;
  347.    USHORT OrigZone2;
  348.    USHORT DestZone2;
  349.    USHORT OrigPoint;
  350.    USHORT DestPoint;
  351.    UCHAR  Filler[4];
  352. } PKT2HDR;
  353.  
  354. typedef struct {
  355.    USHORT OrigNode;
  356.    USHORT DestNode;
  357.    USHORT OrigPoint;
  358.    USHORT DestPoint;
  359.    CHAR   Reserved[8];
  360.    USHORT SubVersion;
  361.    USHORT Version;
  362.    USHORT OrigNet;
  363.    USHORT DestNet;
  364.    UCHAR  Product;
  365.    UCHAR  Serial;
  366.    CHAR   Password[8];
  367.    USHORT OrigZone;
  368.    USHORT DestZone;
  369.    CHAR   OrigDomain[8];
  370.    CHAR   DestDomain[8];
  371.    UCHAR  Filler[4];
  372. } PKT22HDR;
  373.  
  374. typedef struct {
  375.    USHORT Version;
  376.    USHORT OrigNode;
  377.    USHORT DestNode;
  378.    USHORT OrigNet;
  379.    USHORT DestNet;
  380.    USHORT Attrib;
  381.    USHORT Cost;
  382. } MSGHDR;
  383.  
  384. class PACKET : public TMsgBase
  385. {
  386. public:
  387.    PACKET (void);
  388.    PACKET (PSZ pszName);
  389.    ~PACKET (void);
  390.  
  391.    CHAR   Password[16];
  392.    MDATE  Date;
  393.  
  394.    USHORT Add (VOID);
  395.    USHORT Add (class TMsgBase *MsgBase);
  396.    USHORT Add (class TCollection &MsgText);
  397.    VOID   Close (VOID);
  398.    USHORT Delete (ULONG ulMsg);
  399.    USHORT GetHWM (ULONG &ulMsg);
  400.    ULONG  Highest (VOID);
  401.    VOID   Kill (VOID);
  402.    USHORT Lock (ULONG ulTimeout = 0);
  403.    ULONG  Lowest (VOID);
  404.    ULONG  MsgnToUid (ULONG ulMsg);
  405.    VOID   New (VOID);
  406.    USHORT Next (ULONG &ulMsg);
  407.    ULONG  Number (VOID);
  408.    USHORT Open (PSZ pszName, USHORT doScan = TRUE);
  409.    VOID   Pack (VOID);
  410.    USHORT Previous (ULONG &ulMsg);
  411.    USHORT ReadHeader (ULONG ulMsg);
  412.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  413.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  414.    VOID   SetHWM (ULONG ulMsg);
  415.    ULONG  UidToMsgn (ULONG ulMsg);
  416.    VOID   UnLock (VOID);
  417.    USHORT WriteHeader (ULONG ulMsg);
  418.  
  419. private:
  420.    PKT2HDR  pkt2Hdr;
  421.    PKT22HDR pkt22Hdr;
  422.    MSGHDR   msgHdr;
  423.    FILE   *fp;
  424.    CHAR   LastRead, Line[256];
  425.    CHAR   FileName[128], WasScanned;
  426.    ULONG  TotalMsgs;
  427.    class  TCollection Index;
  428.  
  429.    USHORT GetLine (VOID);
  430. };
  431.  
  432. // --------------------------------------------------------------------------
  433.  
  434. typedef struct {
  435.    CHAR   From[36];
  436.    CHAR   To[36];
  437.    CHAR   Subject[72];
  438.    CHAR   Date[20];
  439.    USHORT TimesRead;
  440.    USHORT DestNode;
  441.    USHORT OrigNode;
  442.    USHORT Cost;
  443.    USHORT OrigNet;
  444.    USHORT DestNet;
  445.    USHORT BinDate[4];
  446.    USHORT Reply;
  447.    USHORT Attrib;
  448.    USHORT Up;
  449. } FIDOMSG;
  450.  
  451. class FIDOSDM : public TMsgBase
  452. {
  453. public:
  454.    FIDOSDM (void);
  455.    FIDOSDM (PSZ pszName);
  456.    ~FIDOSDM (void);
  457.  
  458.    USHORT Add (VOID);
  459.    USHORT Add (class TMsgBase *MsgBase);
  460.    USHORT Add (class TCollection &MsgText);
  461.    VOID   Close (VOID);
  462.    USHORT Delete (ULONG ulMsg);
  463.    USHORT GetHWM (ULONG &ulMsg);
  464.    ULONG  Highest (VOID);
  465.    USHORT Lock (ULONG ulTimeout = 0);
  466.    ULONG  Lowest (VOID);
  467.    ULONG  MsgnToUid (ULONG ulMsg);
  468.    VOID   New (VOID);
  469.    USHORT Next (ULONG &ulMsg);
  470.    ULONG  Number (VOID);
  471.    USHORT Open (PSZ pszName);
  472.    VOID   Pack (VOID);
  473.    USHORT Previous (ULONG &ulMsg);
  474.    USHORT ReadHeader (ULONG ulMsg);
  475.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  476.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  477.    VOID   SetHWM (ULONG ulMsg);
  478.    ULONG  UidToMsgn (ULONG ulMsg);
  479.    VOID   UnLock (VOID);
  480.    USHORT WriteHeader (ULONG ulMsg);
  481.  
  482. private:
  483.    FILE   *fp;
  484.    CHAR   BasePath[128];
  485.    CHAR   LastFile[128];
  486.    ULONG  TotalMsgs;
  487.    FIDOMSG msgHdr;
  488.    class  TCollection Index;
  489. };
  490.  
  491. // --------------------------------------------------------------------------
  492.  
  493. #define MSGDELETED  0x0001  /* deleted message,         */
  494.  
  495. typedef struct {
  496.    CHAR    MajorVersion; /* Minor revision number of this message style */
  497.    CHAR    MinorVersion; /* Minor revision number of this message style */
  498.    USHORT  StructLen;    /* The length of this data structure */
  499.    CHAR    from[60];     /* Who the message is from */
  500.    CHAR    to[60];       /* Who the message is to */
  501.    CHAR    subj[70];     /* The subject of the message */
  502.    CHAR    date[35];     /* Date the message was written */
  503.    CHAR    indate[4];    /* Import date */
  504.    ULONG   msgnum;       /* Current message number */
  505.    ULONG   timesread;    /* Number of times the message has been read */
  506.    time_t  timerecv;     /* Time user received this message */
  507.    ULONG   length;       /* Length of message stored in .Text Data file */
  508.    LONG    start;        /* Pointer to starting byte in .Text Data file */
  509.    ULONG   Extra1;       /* Extra space  Was going to be for reply */
  510.    ULONG   Extra2;       /* Extra space  linking instead came up with */
  511.    ULONG   Extra3;       /* Extra space  a better method */
  512.    USHORT  o_zone;       /* Messages origin zone */
  513.    USHORT  o_net;        /* Messages origin net */
  514.    USHORT  o_node;       /* Messages origin node */
  515.    USHORT  o_point;      /* Messages origin point */
  516.    USHORT  d_zone;       /* Messages destination zone */
  517.    USHORT  d_net;        /* Messages destination net */
  518.    USHORT  d_node;       /* Messages destination node  */
  519.    USHORT  d_point;      /* Messages destination point */
  520.    USHORT  cost;         /* Cost to send this message */
  521.    USHORT  fflags;       /* FidoNet related flags */
  522.    USHORT  xflags;       /* XBBS related flags */
  523.    ULONG   iflags;       /* Internet related flags */
  524.    ULONG   oflags;       /* Other network related flags */
  525. } ADEPTDATA, *PADEPTDATA;
  526.  
  527. typedef struct {
  528.    SHORT to;                /* Checksum of the to field */
  529.    SHORT from;              /* Checksum of the from field */
  530.    SHORT subj;              /* Checksum of the subject field */
  531.    LONG  msgidcrc;          /* 32-bit CRC of the MSGID */
  532.    LONG  msgidserialno;     /* MSGID Serial Number */
  533.    LONG  replycrc;          /* REPLYID 32-bit CRC */
  534.    LONG  replyserialno;     /* REPLYID Serial Numver */
  535. } ADEPTINDEXES, *PADEPTINDEXES;
  536.  
  537. class ADEPT : public TMsgBase
  538. {
  539. public:
  540.    ADEPT (void);
  541.    ADEPT (PSZ pszName);
  542.    ~ADEPT (void);
  543.  
  544.    USHORT Add (VOID);
  545.    USHORT Add (class TMsgBase *MsgBase);
  546.    USHORT Add (class TCollection &MsgText);
  547.    VOID   Close (VOID);
  548.    USHORT Delete (ULONG ulMsg);
  549.    USHORT GetHWM (ULONG &ulMsg);
  550.    ULONG  Highest (VOID);
  551.    USHORT Lock (ULONG ulTimeout = 0);
  552.    ULONG  Lowest (VOID);
  553.    ULONG  MsgnToUid (ULONG ulMsg);
  554.    VOID   New (VOID);
  555.    USHORT Next (ULONG &ulMsg);
  556.    ULONG  Number (VOID);
  557.    USHORT Open (PSZ pszName);
  558.    VOID   Pack (VOID);
  559.    USHORT Previous (ULONG &ulMsg);
  560.    USHORT ReadHeader (ULONG ulMsg);
  561.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  562.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  563.    VOID   SetHWM (ULONG ulMsg);
  564.    ULONG  UidToMsgn (ULONG ulMsg);
  565.    VOID   UnLock (VOID);
  566.    USHORT WriteHeader (ULONG ulMsg);
  567.  
  568. private:
  569.    int    fdHdr;
  570.    int    fdIdx;
  571.    int    fdTxt;
  572.    CHAR   BaseName[128];
  573.    ULONG  TotalMsgs;
  574.    ADEPTDATA Data;
  575. };
  576.  
  577. // --------------------------------------------------------------------------
  578.  
  579. class PASSTHR : public TMsgBase
  580. {
  581. public:
  582.    PASSTHR (void);
  583.    ~PASSTHR (void);
  584.  
  585.    USHORT Add (VOID);
  586.    USHORT Add (class TMsgBase *MsgBase);
  587.    USHORT Add (class TCollection &MsgText);
  588.    VOID   Close (VOID);
  589.    USHORT Delete (ULONG ulMsg);
  590.    USHORT GetHWM (ULONG &ulMsg);
  591.    ULONG  Highest (VOID);
  592.    USHORT Lock (ULONG ulTimeout = 0);
  593.    ULONG  Lowest (VOID);
  594.    ULONG  MsgnToUid (ULONG ulMsg);
  595.    VOID   New (VOID);
  596.    USHORT Next (ULONG &ulMsg);
  597.    ULONG  Number (VOID);
  598.    VOID   Pack (VOID);
  599.    USHORT Previous (ULONG &ulMsg);
  600.    USHORT ReadHeader (ULONG ulMsg);
  601.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  602.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  603.    VOID   SetHWM (ULONG ulMsg);
  604.    ULONG  UidToMsgn (ULONG ulMsg);
  605.    VOID   UnLock (VOID);
  606.    USHORT WriteHeader (ULONG ulMsg);
  607. };
  608.  
  609. // --------------------------------------------------------------------------
  610.  
  611. class DLL_EXPORT COMBO : public TMsgBase
  612. {
  613. public:
  614.    COMBO (void);
  615.    ~COMBO (void);
  616.  
  617.    USHORT Add (VOID);
  618.    USHORT Add (class TMsgBase *MsgBase);
  619.    USHORT Add (class TCollection &MsgText);
  620.    USHORT Add (PSZ pszPath, USHORT usStorage, ULONG ulNumber);
  621.    VOID   Close (VOID);
  622.    USHORT Delete (ULONG ulMsg);
  623.    USHORT GetHWM (ULONG &ulMsg);
  624.    ULONG  Highest (VOID);
  625.    USHORT Lock (ULONG ulTimeout = 0);
  626.    ULONG  Lowest (VOID);
  627.    ULONG  MsgnToUid (ULONG ulMsg);
  628.    VOID   New (VOID);
  629.    USHORT Next (ULONG &ulMsg);
  630.    ULONG  Number (VOID);
  631.    VOID   Pack (VOID);
  632.    USHORT Previous (ULONG &ulMsg);
  633.    USHORT ReadHeader (ULONG ulMsg);
  634.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  635.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  636.    VOID   SetHWM (ULONG ulMsg);
  637.    ULONG  UidToMsgn (ULONG ulMsg);
  638.    VOID   UnLock (VOID);
  639.    USHORT WriteHeader (ULONG ulMsg);
  640.  
  641. private:
  642.    CHAR   LastPath[64];
  643.    ULONG  TotalMsgs, NextNumber;
  644.    class  TMsgBase *Msg;
  645.    class  TCollection Index;
  646. };
  647.  
  648. // --------------------------------------------------------------------------
  649.  
  650. class DLL_EXPORT INETMAIL : public TMsgBase
  651. {
  652. public:
  653.    INETMAIL (void);
  654.    INETMAIL (PSZ pszServer, PSZ pszUser, PSZ pszPwd);
  655.    ~INETMAIL (void);
  656.  
  657.    CHAR   HostName[64], SMTPHostName[64];
  658.    CHAR   Error[128];
  659.  
  660.    USHORT Add (VOID);
  661.    USHORT Add (class TMsgBase *MsgBase);
  662.    USHORT Add (class TCollection &MsgText);
  663.    VOID   Close (VOID);
  664.    USHORT Delete (ULONG ulMsg);
  665.    ULONG  Highest (VOID);
  666.    USHORT GetHWM (ULONG &ulMsg);
  667.    USHORT Lock (ULONG ulTimeout = 0);
  668.    ULONG  Lowest (VOID);
  669.    ULONG  MsgnToUid (ULONG ulMsg);
  670.    VOID   New (VOID);
  671.    USHORT Next (ULONG &ulMsg);
  672.    ULONG  Number (VOID);
  673.    USHORT Open (PSZ pszServer, PSZ pszUser, PSZ pszPwd);
  674.    VOID   Pack (VOID);
  675.    USHORT Previous (ULONG &ulMsg);
  676.    USHORT ReadHeader (ULONG ulMsg);
  677.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  678.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  679.    VOID   SetHWM (ULONG ulMsg);
  680.    ULONG  UidToMsgn (ULONG ulMsg);
  681.    VOID   UnLock (VOID);
  682.    USHORT WriteHeader (ULONG ulMsg);
  683.  
  684. private:
  685.    CHAR   szBuffer[1024];
  686.    ULONG  TotalMsgs;
  687.    ULONG  LastReaded;
  688.    class  TTcpip *Tcp;
  689.  
  690.    USHORT GetResponse (PSZ pszResponse, USHORT usMaxLen);
  691.    USHORT GetLine (PSZ pszResponse, USHORT usMaxLen);
  692. };
  693.  
  694. // --------------------------------------------------------------------------
  695.  
  696. #define HUD_RECKILL     1
  697. #define HUD_NETMAIL     4
  698. #define HUD_PRIVATE     8
  699. #define HUD_RECEIVED    16
  700. #define HUD_LOCAL       32+64
  701.  
  702. #define HUD_KILL        1
  703. #define HUD_SENT        2
  704. #define HUD_FILE        4
  705. #define HUD_CRASH       8
  706. #define HUD_FRQ         16
  707. #define HUD_ARQ         32
  708. #define HUD_CPT         64
  709.  
  710. typedef struct {
  711.    USHORT LowMsg;
  712.    USHORT HighMsg;
  713.    USHORT TotalMsgs;
  714.    USHORT TotalOnBoard[200];
  715. } HMSGINFO;
  716.  
  717. typedef struct {
  718.    USHORT MsgNum;
  719.    UCHAR  Board;
  720. } HMSGIDX;
  721.  
  722. typedef struct {
  723.    CHAR   String[36];
  724. } HMSGTOIDX;
  725.  
  726. typedef struct {
  727.    USHORT MsgNum;
  728.    USHORT PrevReply;
  729.    USHORT NextReply;
  730.    USHORT TimesRead;
  731.    USHORT StartBlock;
  732.    USHORT NumBlocks;
  733.    USHORT DestNet;
  734.    USHORT DestNode;
  735.    USHORT OrigNet;
  736.    USHORT OrigNode;
  737.    UCHAR  DestZone;
  738.    UCHAR  OrigZone;
  739.    USHORT Cost;
  740.    UCHAR  MsgAttr;
  741.    UCHAR  NetAttr;
  742.    UCHAR  Board;
  743.    CHAR   Time[6];
  744.    CHAR   Date[9];
  745.    CHAR   WhoTo[36];
  746.    CHAR   WhoFrom[36];
  747.    CHAR   Subject[73];
  748. } HMSGHDR;
  749.  
  750. class HUDSON : public TMsgBase
  751. {
  752. public:
  753.    HUDSON (void);
  754.    HUDSON (PSZ pszName, UCHAR board);
  755.    ~HUDSON (void);
  756.  
  757.    USHORT Add (VOID);
  758.    USHORT Add (class TMsgBase *MsgBase);
  759.    USHORT Add (class TCollection &MsgText);
  760.    VOID   Close (VOID);
  761.    USHORT Delete (ULONG ulMsg);
  762.    USHORT GetHWM (ULONG &ulMsg);
  763.    ULONG  Highest (VOID);
  764.    USHORT Lock (ULONG ulTimeout = 0);
  765.    ULONG  Lowest (VOID);
  766.    ULONG  MsgnToUid (ULONG ulMsg);
  767.    VOID   New (VOID);
  768.    USHORT Next (ULONG &ulMsg);
  769.    ULONG  Number (VOID);
  770.    USHORT Open (PSZ pszName, UCHAR board);
  771.    VOID   Pack (VOID);
  772.    USHORT Previous (ULONG &ulMsg);
  773.    USHORT ReadHeader (ULONG ulMsg);
  774.    USHORT Read (ULONG ulMsg, class TCollection &MsgText, SHORT nWidth = 79);
  775.    USHORT Read (ULONG ulMsg, SHORT nWidth = 79);
  776.    VOID   SetHWM (ULONG ulMsg);
  777.    ULONG  UidToMsgn (ULONG ulMsg);
  778.    VOID   UnLock (VOID);
  779.    USHORT WriteHeader (ULONG ulMsg);
  780.  
  781. private:
  782.    int    fdHdr;
  783.    int    fdTxt;
  784.    int    fdToIdx;
  785.    USHORT Locked;
  786.    CHAR   BaseName[128];
  787.    UCHAR  BoardNum;
  788.    ULONG  TotalMsgs;
  789.    HMSGINFO msgInfo;
  790.    HMSGIDX *msgIdx;
  791.    HMSGHDR  msgHdr;
  792.  
  793.    VOID   Pascal2C (PSZ strp, PSZ strc);
  794.    VOID   C2Pascal (PSZ strp, PSZ strc);
  795. };
  796.  
  797. // --------------------------------------------------------------------------
  798.  
  799. #define MAX_DUPES    1000
  800.  
  801. typedef struct {
  802.    CHAR   EchoTag[64];
  803.    USHORT Position;
  804.    ULONG  Dupes[MAX_DUPES];
  805. } DUPEDATA;
  806.  
  807. typedef struct {
  808.    CHAR   EchoTag[64];
  809.    ULONG  Position;
  810. } DUPEIDX;
  811.  
  812. class DLL_EXPORT TDupes
  813. {
  814. public:
  815.    TDupes (void);
  816.    TDupes (PSZ pszDataPath);
  817.    ~TDupes (void);
  818.  
  819.    VOID   Add (PSZ pszEchoTag, class TMsgBase *Msg);
  820.    USHORT Check (PSZ pszEchoTag, class TMsgBase *Msg);
  821.    VOID   Delete (VOID);
  822.    ULONG  GetEID (class TMsgBase *Msg);
  823.    USHORT Load (PSZ pszEchoTag);
  824.    VOID   Save (VOID);
  825.  
  826. private:
  827.    CHAR   DataFile[128];
  828.    CHAR   IndexFile[128];
  829.    DUPEDATA dd;
  830. };
  831.  
  832. #endif
  833.  
  834.