home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mksmvp10.zip / MKMSGABS.PAS < prev    next >
Pascal/Delphi Source File  |  1997-09-24  |  15KB  |  695 lines

  1. Unit MKMsgAbs;       {Abstract Msg Object}
  2.  
  3. {$I MKB.Def}
  4.  
  5. {
  6.      MKMsgAbs - Copyright 1993 by Mark May - MK Software
  7.      You are free to use this code in your programs, however
  8.      it may not be included in Source/TPU function libraries
  9.      without my permission.
  10.  
  11.      Mythical Kingom Tech BBS (513)237-7737 HST/v32
  12.      FidoNet: 1:110/290
  13.      Rime: ->MYTHKING
  14.      You may also reach me at maym@dmapub.dma.org
  15. }
  16.  
  17.  
  18. Interface
  19.  
  20. Uses MKGlobT, Use32,
  21. {$IFDEF WINDOWS}
  22.   WinDos;
  23. {$ELSE}
  24.   Dos;
  25. {$ENDIF}
  26.  
  27.  
  28. Type MsgMailType = (mmtNormal, mmtEchoMail, mmtNetMail);
  29.  
  30. Type AbsMsgObj = Object
  31.   LastSoft: Boolean;
  32.   Constructor Init; {Initialize}
  33.   Destructor Done; Virtual; {Done}
  34.   Procedure SetMsgPath(MP: String); Virtual; {Set msg path/other info}
  35.   Function  OpenMsgBase: Word; Virtual; {Open the message base}
  36.   Function  CloseMsgBase: Word; Virtual; {Close the message base}
  37.   Function  CreateMsgBase(MaxMsg: Word; MaxDays: Word): Word; Virtual;
  38.     {Create new message base}
  39.   Function  MsgBaseExists: Boolean; Virtual; {Does msg base exist}
  40.   Function  LockMsgBase: Boolean; Virtual; {Lock the message base}
  41.   Function  UnLockMsgBase: Boolean; Virtual; {Unlock the message base}
  42.   Procedure SetDest(Var Addr: AddrType); Virtual; {Set Zone/Net/Node/Point for Dest}
  43.   Procedure SetOrig(Var Addr: AddrType); Virtual; {Set Zone/Net/Node/Point for Orig}
  44.   Procedure SetFrom(Name: String); Virtual; {Set message from}
  45.   Procedure SetTo(Name: String); Virtual; {Set message to}
  46.   Procedure SetSubj(Str: String); Virtual; {Set message subject}
  47.   Procedure SetCost(SCost: Word); Virtual; {Set message cost}
  48.   Procedure SetRefer(SRefer: LongInt); Virtual; {Set message reference}
  49.   Procedure SetSeeAlso(SAlso: LongInt); Virtual; {Set message see also}
  50.   Procedure SetDate(SDate: String); Virtual; {Set message date}
  51.   Procedure SetTime(STime: String); Virtual; {Set message time}
  52.   Procedure SetLocal(LS: Boolean); Virtual; {Set local status}
  53.   Procedure SetRcvd(RS: Boolean); Virtual; {Set received status}
  54.   Procedure SetPriv(PS: Boolean); Virtual; {Set priveledge vs public status}
  55.   Procedure SetCrash(SS: Boolean); Virtual; {Set crash netmail status}
  56.   Procedure SetKillSent(SS: Boolean); Virtual; {Set kill/sent netmail status}
  57.   Procedure SetSent(SS: Boolean); Virtual; {Set sent netmail status}
  58.   Procedure SetFAttach(SS: Boolean); Virtual; {Set file attach status}
  59.   Procedure SetReqRct(SS: Boolean); Virtual; {Set request receipt status}
  60.   Procedure SetReqAud(SS: Boolean); Virtual; {Set request audit status}
  61.   Procedure SetRetRct(SS: Boolean); Virtual; {Set return receipt status}
  62.   Procedure SetFileReq(SS: Boolean); Virtual; {Set file request status}
  63.   Procedure DoString(Str: String); Virtual; {Add string to message text}
  64.   Procedure DoChar(Ch: Char); Virtual; {Add character to message text}
  65.   Procedure DoStringLn(Str: String); Virtual; {Add string and newline to msg text}
  66.   Procedure DoKludgeLn(Str: String); Virtual; {Add ^A kludge line to msg}
  67.   Function  WriteMsg: Word; Virtual; {Write msg to msg base}
  68.   Function  GetChar: Char; Virtual; {Get msg text character}
  69.   Function  EOM: Boolean; Virtual; {No more msg text}
  70.   Function  GetString(MaxLen: Word): String; Virtual; {Get wordwrapped string}
  71.   Function  GetNoKludgeStr(MaxLen: Word): String; Virtual; {Get ww str no ^A lines}
  72.   Function  WasWrap: Boolean; Virtual; {Last line was soft wrapped no CR}
  73.   Function  GetFrom: String; Virtual; {Get from name on current msg}
  74.   Function  GetTo: String; Virtual; {Get to name on current msg}
  75.   Function  GetSubj: String; Virtual; {Get subject on current msg}
  76.   Function  GetCost: Word; Virtual; {Get cost of current msg}
  77.   Function  GetDate: String; Virtual; {Get date of current msg}
  78.   Function  GetTime: String; Virtual; {Get time of current msg}
  79.   Function  GetRefer: LongInt; Virtual; {Get reply to of current msg}
  80.   Function  GetSeeAlso: LongInt; Virtual; {Get see also of current msg}
  81.   Function  GetNextSeeAlso: LongInt; Virtual;
  82.   Procedure SetNextSeeAlso(SAlso: LongInt); Virtual;
  83.   Function  GetMsgNum: LongInt; Virtual; {Get message number}
  84.   Procedure GetOrig(Var Addr: AddrType); Virtual; {Get origin address}
  85.   Procedure GetDest(Var Addr: AddrType); Virtual; {Get destination address}
  86.   Function  IsLocal: Boolean; Virtual; {Is current msg local}
  87.   Function  IsCrash: Boolean; Virtual; {Is current msg crash}
  88.   Function  IsKillSent: Boolean; Virtual; {Is current msg kill sent}
  89.   Function  IsSent: Boolean; Virtual; {Is current msg sent}
  90.   Function  IsFAttach: Boolean; Virtual; {Is current msg file attach}
  91.   Function  IsReqRct: Boolean; Virtual; {Is current msg request receipt}
  92.   Function  IsReqAud: Boolean; Virtual; {Is current msg request audit}
  93.   Function  IsRetRct: Boolean; Virtual; {Is current msg a return receipt}
  94.   Function  IsFileReq: Boolean; Virtual; {Is current msg a file request}
  95.   Function  IsRcvd: Boolean; Virtual; {Is current msg received}
  96.   Function  IsPriv: Boolean; Virtual; {Is current msg priviledged/private}
  97.   Function  IsDeleted: Boolean; Virtual; {Is current msg deleted}
  98.   Function  IsEchoed: Boolean; Virtual; {Is current msg unmoved echomail msg}
  99.   Function  GetMsgLoc: LongInt; Virtual; {To allow reseeking to message}
  100.   Procedure SetMsgLoc(ML: LongInt); Virtual; {Reseek to message}
  101.   Procedure MsgStartUp; Virtual; {Do message set-up tasks}
  102.   Procedure MsgTxtStartUp; Virtual; {Do message text start up tasks}
  103.   Procedure StartNewMsg; Virtual; {Initialize for adding message}
  104.   Procedure SeekFirst(MsgNum: LongInt); Virtual; {Start msg seek}
  105.   Procedure SeekNext; Virtual; {Find next matching msg}
  106.   Procedure SeekPrior; Virtual; {Prior msg}
  107.   Function  SeekFound: Boolean; Virtual; {Msg was found}
  108.   Procedure YoursFirst(Name: String; Handle: String); Virtual; {Seek your mail}
  109.   Procedure YoursNext; Virtual; {Seek next your mail}
  110.   Function  YoursFound: Boolean; Virtual; {Message found}
  111.   Function  GetHighMsgNum: LongInt; Virtual; {Get highest msg number}
  112.   Procedure SetMailType(MT: MsgMailType); Virtual; {Set message base type}
  113.   Function  GetSubArea: Word; Virtual; {Get sub area number}
  114.   Procedure ReWriteHdr; Virtual; {Rewrite msg header after changes}
  115.   Procedure DeleteMsg; Virtual; {Delete current message}
  116.   Procedure SetEcho(ES: Boolean); Virtual; {Set echo status}
  117.   Function  NumberOfMsgs: LongInt; Virtual; {Number of messages}
  118.   Function  GetLastRead(UNum: LongInt): LongInt; Virtual; {Get last read for user num}
  119.   Procedure SetLastRead(UNum: LongInt; LR: LongInt); Virtual; {Set last read}
  120.   Function  GetMsgDisplayNum: LongInt; Virtual; {Get msg number to display}
  121.   Function  GetTxtPos: LongInt; Virtual; {Get indicator of msg text position}
  122.   Procedure SetTxtPos(TP: LongInt); Virtual; {Set text position}
  123.   Function  GetHighActiveMsgNum: LongInt; Virtual; {Get highest active msg num}
  124.   End;
  125.  
  126.  
  127. Type AbsMsgPtr = ^AbsMsgObj;
  128.  
  129.  
  130. Implementation
  131.  
  132.  
  133. Constructor AbsMsgObj.Init;
  134.   Begin
  135.   End;
  136.  
  137.  
  138. Destructor AbsMsgObj.Done;
  139.   Begin
  140.   End;
  141.  
  142.  
  143. Procedure AbsMsgObj.SetMsgPath(MP: String);
  144.   Begin
  145.   End;
  146.  
  147.  
  148. Function AbsMsgObj.OpenMsgBase: Word;
  149.   Begin
  150.   End;
  151.  
  152.  
  153. Function AbsMsgObj.CloseMsgBase: Word;
  154.   Begin
  155.   End;
  156.  
  157.  
  158. Function AbsMsgObj.LockMsgBase: Boolean;
  159.   Begin
  160.   End;
  161.  
  162.  
  163. Function AbsMsgObj.UnLockMsgBase: Boolean;
  164.   Begin
  165.   End;
  166.  
  167.  
  168. Procedure AbsMsgObj.SetDest(Var Addr: AddrType);
  169.   Begin
  170.   End;
  171.  
  172.  
  173. Procedure AbsMsgObj.SetOrig(Var Addr: AddrType);
  174.   Begin
  175.   End;
  176.  
  177.  
  178. Procedure AbsMsgObj.SetFrom(Name: String);
  179.   Begin
  180.   End;
  181.  
  182.  
  183. Procedure AbsMsgObj.SetTo(Name: String);
  184.   Begin
  185.   End;
  186.  
  187.  
  188. Procedure AbsMsgObj.SetSubj(Str: String);
  189.   Begin
  190.   End;
  191.  
  192.  
  193. Procedure AbsMsgObj.SetCost(SCost: Word);
  194.   Begin
  195.   End;
  196.  
  197.  
  198. Procedure AbsMsgObj.SetRefer(SRefer: LongInt);
  199.   Begin
  200.   End;
  201.  
  202.  
  203. Procedure AbsMsgObj.SetSeeAlso(SAlso: LongInt);
  204.   Begin
  205.   End;
  206.  
  207.  
  208. Procedure AbsMsgObj.SetDate(SDate: String);
  209.   Begin
  210.   End;
  211.  
  212.  
  213. Procedure AbsMsgObj.SetTime(STime: String);
  214.   Begin
  215.   End;
  216.  
  217.  
  218. Procedure AbsMsgObj.SetLocal(LS: Boolean);
  219.   Begin
  220.   End;
  221.  
  222.  
  223. Procedure AbsMsgObj.SetRcvd(RS: Boolean);
  224.   Begin
  225.   End;
  226.  
  227.  
  228. Procedure AbsMsgObj.SetPriv(PS: Boolean);
  229.   Begin
  230.   End;
  231.  
  232.  
  233. Procedure AbsMsgObj.SetCrash(SS: Boolean);
  234.   Begin
  235.   End;
  236.  
  237.  
  238. Procedure AbsMsgObj.SetKillSent(SS: Boolean);
  239.   Begin
  240.   End;
  241.  
  242.  
  243. Procedure AbsMsgObj.SetSent(SS: Boolean);
  244.   Begin
  245.   End;
  246.  
  247.  
  248. Procedure AbsMsgObj.SetFAttach(SS: Boolean);
  249.   Begin
  250.   End;
  251.  
  252.  
  253. Procedure AbsMsgObj.SetReqRct(SS: Boolean);
  254.   Begin
  255.   End;
  256.  
  257.  
  258. Procedure AbsMsgObj.SetReqAud(SS: Boolean);
  259.   Begin
  260.   End;
  261.  
  262.  
  263. Procedure AbsMsgObj.SetRetRct(SS: Boolean);
  264.   Begin
  265.   End;
  266.  
  267.  
  268. Procedure AbsMsgObj.SetFileReq(SS: Boolean);
  269.   Begin
  270.   End;
  271.  
  272.  
  273. Procedure AbsMsgObj.DoString(Str: String);
  274.   Var
  275.     i: Word;
  276.  
  277.   Begin
  278.   For i := 1 to Length(Str) Do
  279.     DoChar(Str[i]);
  280.   End;
  281.  
  282.  
  283. Procedure AbsMsgObj.DoChar(Ch: Char);
  284.   Begin
  285.   End;
  286.  
  287.  
  288. Procedure AbsMsgObj.DoStringLn(Str: String);
  289.   Begin
  290.   DoString(Str);
  291.   DoChar(#13);
  292.   End;
  293.  
  294. Procedure AbsMsgObj.DoKludgeLn(Str: String);
  295.   Begin
  296.   DoStringLn(Str);
  297.   End;
  298.  
  299.  
  300. Function AbsMsgObj.WriteMsg: Word;
  301.   Begin
  302.   End;
  303.  
  304.  
  305. Function AbsMsgObj.GetChar: Char;
  306.   Begin
  307.   End;
  308.  
  309.  
  310. Function AbsMsgObj.EOM: Boolean;
  311.   Begin
  312.   End;
  313.  
  314.  
  315. Function AbsMsgObj.GetString(MaxLen: Word): String;
  316.   Var
  317.     WPos: LongInt;
  318.     WLen: Byte;
  319.     StrDone: Boolean;
  320.     TxtOver: Boolean;
  321.     StartSoft: Boolean;
  322.     CurrLen: Word;
  323.     PPos: LongInt;
  324.     TmpCh: Char;
  325.     OldPos: LongInt;
  326.  
  327.   Begin
  328.   If EOM Then
  329.     GetString := ''
  330.   Else
  331.     Begin
  332.     StrDone := False;
  333.     CurrLen := 0;
  334.     PPos := GetTxtPos;
  335.     WPos := GetTxtPos;
  336.     WLen := 0;
  337.     StartSoft := LastSoft;
  338.     LastSoft := True;
  339.     OldPos := GetTxtPos;
  340.     TmpCh := GetChar;
  341.     While ((Not StrDone) And (CurrLen < MaxLen) And (Not EOM)) Do
  342.       Begin
  343.       Case TmpCh of
  344.         #$00:;
  345.         #$0d: Begin
  346.               StrDone := True;
  347.               LastSoft := False;
  348.               End;
  349.         #$8d:;
  350.         #$0a:;
  351.         #$20: Begin
  352.               If ((CurrLen <> 0) or (Not StartSoft)) Then
  353.                 Begin
  354.                 Inc(CurrLen);
  355.                 WLen := CurrLen;
  356.                 GetString[CurrLen] := TmpCh;
  357.                 WPos := GetTxtPos;
  358.                 End
  359.               Else
  360.                 StartSoft := False;
  361.               End;
  362.         Else
  363.           Begin
  364.           Inc(CurrLen);
  365.           GetString[CurrLen] := TmpCh;
  366.           End;
  367.         End;
  368.       If Not StrDone Then
  369.         Begin
  370.         OldPos := GetTxtPos;
  371.         TmpCh := GetChar;
  372.         End;
  373.       End;
  374.     If StrDone Then
  375.       Begin
  376.       GetString[0] := Chr(CurrLen);
  377.       End
  378.     Else
  379.       If EOM Then
  380.         Begin
  381.         GetString[0] := Chr(CurrLen);
  382.         End
  383.       Else
  384.         Begin
  385.         If WLen = 0 Then
  386.           Begin
  387.           GetString[0] := Chr(CurrLen);
  388.           SetTxtPos(OldPos);
  389.           End
  390.         Else
  391.           Begin
  392.           GetString[0] := Chr(WLen);
  393.           SetTxtPos(WPos);
  394.           End;
  395.         End;
  396.     End;
  397.   End;
  398.  
  399.  
  400.  
  401. Function AbsMsgObj.WasWrap: Boolean;
  402.   Begin
  403.   WasWrap := LastSoft;
  404.   End;
  405.  
  406.  
  407. Procedure AbsMsgObj.SeekFirst(MsgNum: LongInt);
  408.   Begin
  409.   End;
  410.  
  411.  
  412. Procedure AbsMsgObj.SeekNext;
  413.   Begin
  414.   End;
  415.  
  416.  
  417. Function AbsMsgObj.GetFrom: String;
  418.   Begin
  419.   End;
  420.  
  421.  
  422. Function AbsMsgObj.GetTo: String;
  423.   Begin
  424.   End;
  425.  
  426.  
  427. Function AbsMsgObj.GetSubj: String;
  428.   Begin
  429.   End;
  430.  
  431.  
  432. Function AbsMsgObj.GetCost: Word;
  433.   Begin
  434.   End;
  435.  
  436.  
  437. Function AbsMsgObj.GetDate: String;
  438.   Begin
  439.   End;
  440.  
  441.  
  442. Function AbsMsgObj.GetTime: String;
  443.   Begin
  444.   End;
  445.  
  446.  
  447. Function AbsMsgObj.GetRefer: LongInt;
  448.   Begin
  449.   End;
  450.  
  451.  
  452. Function AbsMsgObj.GetSeeAlso: LongInt;
  453.   Begin
  454.   End;
  455.  
  456.  
  457. Function AbsMsgObj.GetMsgNum: LongInt;
  458.   Begin
  459.   End;
  460.  
  461.  
  462. Procedure AbsMsgObj.GetOrig(Var Addr: AddrType);
  463.   Begin
  464.   End;
  465.  
  466.  
  467. Procedure AbsMsgObj.GetDest(Var Addr: AddrType);
  468.   Begin
  469.   End;
  470.  
  471.  
  472. Function AbsMsgObj.IsLocal: Boolean;
  473.   Begin
  474.   End;
  475.  
  476.  
  477. Function AbsMsgObj.IsCrash: Boolean;
  478.   Begin
  479.   End;
  480.  
  481.  
  482. Function AbsMsgObj.IsKillSent: Boolean;
  483.   Begin
  484.   End;
  485.  
  486.  
  487. Function AbsMsgObj.IsSent: Boolean;
  488.   Begin
  489.   End;
  490.  
  491.  
  492. Function AbsMsgObj.IsFAttach: Boolean;
  493.   Begin
  494.   End;
  495.  
  496.  
  497. Function AbsMsgObj.IsReqRct: Boolean;
  498.   Begin
  499.   End;
  500.  
  501.  
  502. Function AbsMsgObj.IsReqAud: Boolean;
  503.   Begin
  504.   End;
  505.  
  506.  
  507. Function AbsMsgObj.IsRetRct: Boolean;
  508.   Begin
  509.   End;
  510.  
  511.  
  512. Function AbsMsgObj.IsFileReq: Boolean;
  513.   Begin
  514.   End;
  515.  
  516.  
  517. Function AbsMsgObj.IsRcvd: Boolean;
  518.   Begin
  519.   End;
  520.  
  521.  
  522. Function AbsMsgObj.IsPriv: Boolean;
  523.   Begin
  524.   End;
  525.  
  526.  
  527. Function AbsMsgObj.IsDeleted: Boolean;
  528.   Begin
  529.   End;
  530.  
  531.  
  532. Function AbsMsgObj.IsEchoed: Boolean;
  533.   Begin
  534.   End;
  535.  
  536.  
  537. Function AbsMsgObj.GetMsgLoc: LongInt;
  538.   Begin
  539.   End;
  540.  
  541.  
  542. Procedure AbsMsgObj.SetMsgLoc(ML: LongInt);
  543.   Begin
  544.   End;
  545.  
  546.  
  547. Procedure AbsMsgObj.MsgStartUp;
  548.   Begin
  549.   End;
  550.  
  551.  
  552. Procedure AbsMsgObj.MsgTxtStartUp;
  553.   Begin
  554.   End;
  555.  
  556.  
  557. Procedure AbsMsgObj.YoursFirst(Name: String; Handle: String);
  558.   Begin
  559.   End;
  560.  
  561.  
  562. Procedure AbsMsgObj.YoursNext;
  563.   Begin
  564.   End;
  565.  
  566.  
  567. Function AbsMsgObj.YoursFound: Boolean;
  568.   Begin
  569.   End;
  570.  
  571.  
  572. Function AbsMsgObj.CreateMsgBase(MaxMsg: Word; MaxDays: Word): Word;
  573.   Begin
  574.   End;
  575.  
  576.  
  577. Function AbsMsgObj.MsgBaseExists: Boolean;
  578.   Begin
  579.   End;
  580.  
  581.  
  582. Procedure AbsMsgObj.StartNewMsg;
  583.   Begin
  584.   End;
  585.  
  586.  
  587. Function AbsMsgObj.GetHighMsgNum: LongInt;
  588.   Begin
  589.   End;
  590.  
  591.  
  592. Function AbsMsgObj.SeekFound: Boolean;
  593.   Begin
  594.   End;
  595.  
  596.  
  597. Procedure AbsMsgObj.SetMailType(MT: MsgMailType);
  598.   Begin
  599.   End;
  600.  
  601.  
  602. Function AbsMsgObj.GetSubArea: Word;
  603.   Begin
  604.   GetSubArea := 0;
  605.   End;
  606.  
  607.  
  608. Procedure AbsMsgObj.ReWriteHdr;
  609.   Begin
  610.   End;
  611.  
  612.  
  613. Procedure AbsMsgObj.DeleteMsg;
  614.   Begin
  615.   End;
  616.  
  617.  
  618. Procedure AbsMsgObj.SetEcho(ES: Boolean);
  619.   Begin
  620.   End;
  621.  
  622.  
  623. Procedure AbsMsgObj.SeekPrior;
  624.   Begin
  625.   End;
  626.  
  627.  
  628. Function AbsMsgObj.NumberOfMsgs: LongInt;
  629.   Begin
  630.   End;
  631.  
  632.  
  633. Function AbsMsgObj.GetLastRead(UNum: LongInt): LongInt;
  634.   Begin
  635.   End;
  636.  
  637. Procedure AbsMsgObj.SetLastRead(UNum: LongInt; LR: LongInt);
  638.   Begin
  639.   End;
  640.  
  641. Function AbsMsgObj.GetMsgDisplayNum: LongInt;
  642.   Begin
  643.   GetMsgDisplayNum := GetMsgNum;
  644.   End;
  645.  
  646. Function AbsMsgObj.GetTxtPos: LongInt;
  647.   Begin
  648.   GetTxtPos := 0;
  649.   End;
  650.  
  651. Procedure AbsMsgObj.SetTxtPos(TP: LongInt);
  652.   Begin
  653.   End;
  654.  
  655.  
  656.  {SetNextSeeAlso provided by 2:201/623@FidoNet Jonas@iis.bbs.bad.se}
  657.  
  658.  
  659. Procedure AbsMsgObj.SetNextSeeAlso(SAlso: LongInt);
  660.   Begin
  661.   End;
  662.  
  663. Function AbsMsgObj.GetNextSeeAlso: LongInt;
  664.   Begin
  665.   GetNextSeeAlso:=0;
  666.   End;
  667.  
  668.  
  669. Function  AbsMsgObj.GetNoKludgeStr(MaxLen: Word): String;
  670. {From a suggestion by Johan Corstjens 2:281/610}
  671.   Var
  672.     TmpStr: String;
  673.  
  674.   Begin
  675.   TmpStr := GetString(MaxLen);
  676.   While ((Length(TmpStr) > 0) and (TmpStr[1] = #1) and (Not EOM)) Do
  677.     TmpStr := GetString(MaxLen);
  678.   GetNoKludgeStr := TmpStr;
  679.   End;
  680.  
  681.  
  682. Function AbsMsgObj.GetHighActiveMsgNum: LongInt;
  683.   Begin
  684.   SeekFirst(GetHighMsgNum);
  685.   If Not SeekFound Then
  686.     SeekPrior;
  687.   If SeekFound Then
  688.     GetHighActiveMsgNum := GetMsgNum
  689.   Else
  690.     GetHighActiveMsgNum := 0;
  691.   End;
  692.  
  693.  
  694. End.
  695.