home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / PASCAL / MKMSG104 / MKMSGABS.PAS < prev    next >
Pascal/Delphi Source File  |  1994-01-09  |  15KB  |  668 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,
  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  WasWrap: Boolean; Virtual; {Last line was soft wrapped no CR}
  72.   Function  GetFrom: String; Virtual; {Get from name on current msg}
  73.   Function  GetTo: String; Virtual; {Get to name on current msg}
  74.   Function  GetSubj: String; Virtual; {Get subject on current msg}
  75.   Function  GetCost: Word; Virtual; {Get cost of current msg}
  76.   Function  GetDate: String; Virtual; {Get date of current msg}
  77.   Function  GetTime: String; Virtual; {Get time of current msg}
  78.   Function  GetRefer: LongInt; Virtual; {Get reply to of current msg}
  79.   Function  GetSeeAlso: LongInt; Virtual; {Get see also of current msg}
  80.   Function  GetNextSeeAlso: LongInt; Virtual;
  81.   Procedure SetNextSeeAlso(SAlso: LongInt); Virtual;
  82.   Function  GetMsgNum: LongInt; Virtual; {Get message number}
  83.   Procedure GetOrig(Var Addr: AddrType); Virtual; {Get origin address}
  84.   Procedure GetDest(Var Addr: AddrType); Virtual; {Get destination address}
  85.   Function  IsLocal: Boolean; Virtual; {Is current msg local}
  86.   Function  IsCrash: Boolean; Virtual; {Is current msg crash}
  87.   Function  IsKillSent: Boolean; Virtual; {Is current msg kill sent}
  88.   Function  IsSent: Boolean; Virtual; {Is current msg sent}
  89.   Function  IsFAttach: Boolean; Virtual; {Is current msg file attach}
  90.   Function  IsReqRct: Boolean; Virtual; {Is current msg request receipt}
  91.   Function  IsReqAud: Boolean; Virtual; {Is current msg request audit}
  92.   Function  IsRetRct: Boolean; Virtual; {Is current msg a return receipt}
  93.   Function  IsFileReq: Boolean; Virtual; {Is current msg a file request}
  94.   Function  IsRcvd: Boolean; Virtual; {Is current msg received}
  95.   Function  IsPriv: Boolean; Virtual; {Is current msg priviledged/private}
  96.   Function  IsDeleted: Boolean; Virtual; {Is current msg deleted}
  97.   Function  IsEchoed: Boolean; Virtual; {Is current msg unmoved echomail msg}
  98.   Function  GetMsgLoc: LongInt; Virtual; {To allow reseeking to message}
  99.   Procedure SetMsgLoc(ML: LongInt); Virtual; {Reseek to message}
  100.   Procedure MsgStartUp; Virtual; {Do message set-up tasks}
  101.   Procedure MsgTxtStartUp; Virtual; {Do message text start up tasks}
  102.   Procedure StartNewMsg; Virtual; {Initialize for adding message}
  103.   Procedure SeekFirst(MsgNum: LongInt); Virtual; {Start msg seek}
  104.   Procedure SeekNext; Virtual; {Find next matching msg}
  105.   Procedure SeekPrior; Virtual; {Prior msg}
  106.   Function  SeekFound: Boolean; Virtual; {Msg was found}
  107.   Procedure YoursFirst(Name: String; Handle: String); Virtual; {Seek your mail}
  108.   Procedure YoursNext; Virtual; {Seek next your mail}
  109.   Function  YoursFound: Boolean; Virtual; {Message found}
  110.   Function  GetHighMsgNum: LongInt; Virtual; {Get highest msg number}
  111.   Procedure SetMailType(MT: MsgMailType); Virtual; {Set message base type}
  112.   Function  GetSubArea: Word; Virtual; {Get sub area number}
  113.   Procedure ReWriteHdr; Virtual; {Rewrite msg header after changes}
  114.   Procedure DeleteMsg; Virtual; {Delete current message}
  115.   Procedure SetEcho(ES: Boolean); Virtual; {Set echo status}
  116.   Function  NumberOfMsgs: LongInt; Virtual; {Number of messages}
  117.   Function  GetLastRead(UNum: LongInt): LongInt; Virtual; {Get last read for user num}
  118.   Procedure SetLastRead(UNum: LongInt; LR: LongInt); Virtual; {Set last read}
  119.   Function  GetMsgDisplayNum: LongInt; Virtual; {Get msg number to display}
  120.   Function  GetTxtPos: LongInt; Virtual; {Get indicator of msg text position}
  121.   Procedure SetTxtPos(TP: LongInt); Virtual; {Set text position}
  122.   End;
  123.  
  124.  
  125. Type AbsMsgPtr = ^AbsMsgObj;
  126.  
  127.  
  128. Implementation
  129.  
  130.  
  131. Constructor AbsMsgObj.Init;
  132.   Begin
  133.   End;
  134.  
  135.  
  136. Destructor AbsMsgObj.Done;
  137.   Begin
  138.   End;
  139.  
  140.  
  141. Procedure AbsMsgObj.SetMsgPath(MP: String);
  142.   Begin
  143.   End;
  144.  
  145.  
  146. Function AbsMsgObj.OpenMsgBase: Word;
  147.   Begin
  148.   End;
  149.  
  150.  
  151. Function AbsMsgObj.CloseMsgBase: Word;
  152.   Begin
  153.   End;
  154.  
  155.  
  156. Function AbsMsgObj.LockMsgBase: Boolean;
  157.   Begin
  158.   End;
  159.  
  160.  
  161. Function AbsMsgObj.UnLockMsgBase: Boolean;
  162.   Begin
  163.   End;
  164.  
  165.  
  166. Procedure AbsMsgObj.SetDest(Var Addr: AddrType);
  167.   Begin
  168.   End;
  169.  
  170.  
  171. Procedure AbsMsgObj.SetOrig(Var Addr: AddrType);
  172.   Begin
  173.   End;
  174.  
  175.  
  176. Procedure AbsMsgObj.SetFrom(Name: String);
  177.   Begin
  178.   End;
  179.  
  180.  
  181. Procedure AbsMsgObj.SetTo(Name: String);
  182.   Begin
  183.   End;
  184.  
  185.  
  186. Procedure AbsMsgObj.SetSubj(Str: String);
  187.   Begin
  188.   End;
  189.  
  190.  
  191. Procedure AbsMsgObj.SetCost(SCost: Word);
  192.   Begin
  193.   End;
  194.  
  195.  
  196. Procedure AbsMsgObj.SetRefer(SRefer: LongInt);
  197.   Begin
  198.   End;
  199.  
  200.  
  201. Procedure AbsMsgObj.SetSeeAlso(SAlso: LongInt);
  202.   Begin
  203.   End;
  204.  
  205.  
  206. Procedure AbsMsgObj.SetDate(SDate: String);
  207.   Begin
  208.   End;
  209.  
  210.  
  211. Procedure AbsMsgObj.SetTime(STime: String);
  212.   Begin
  213.   End;
  214.  
  215.  
  216. Procedure AbsMsgObj.SetLocal(LS: Boolean);
  217.   Begin
  218.   End;
  219.  
  220.  
  221. Procedure AbsMsgObj.SetRcvd(RS: Boolean);
  222.   Begin
  223.   End;
  224.  
  225.  
  226. Procedure AbsMsgObj.SetPriv(PS: Boolean);
  227.   Begin
  228.   End;
  229.  
  230.  
  231. Procedure AbsMsgObj.SetCrash(SS: Boolean);
  232.   Begin
  233.   End;
  234.  
  235.  
  236. Procedure AbsMsgObj.SetKillSent(SS: Boolean);
  237.   Begin
  238.   End;
  239.  
  240.  
  241. Procedure AbsMsgObj.SetSent(SS: Boolean);
  242.   Begin
  243.   End;
  244.  
  245.  
  246. Procedure AbsMsgObj.SetFAttach(SS: Boolean);
  247.   Begin
  248.   End;
  249.  
  250.  
  251. Procedure AbsMsgObj.SetReqRct(SS: Boolean);
  252.   Begin
  253.   End;
  254.  
  255.  
  256. Procedure AbsMsgObj.SetReqAud(SS: Boolean);
  257.   Begin
  258.   End;
  259.  
  260.  
  261. Procedure AbsMsgObj.SetRetRct(SS: Boolean);
  262.   Begin
  263.   End;
  264.  
  265.  
  266. Procedure AbsMsgObj.SetFileReq(SS: Boolean);
  267.   Begin
  268.   End;
  269.  
  270.  
  271. Procedure AbsMsgObj.DoString(Str: String);
  272.   Var
  273.     i: Word;
  274.  
  275.   Begin
  276.   For i := 1 to Length(Str) Do
  277.     DoChar(Str[i]);
  278.   End;
  279.  
  280.  
  281. Procedure AbsMsgObj.DoChar(Ch: Char);
  282.   Begin
  283.   End;
  284.  
  285.  
  286. Procedure AbsMsgObj.DoStringLn(Str: String);
  287.   Begin
  288.   DoString(Str);
  289.   DoChar(#13);
  290.   End;
  291.  
  292. Procedure AbsMsgObj.DoKludgeLn(Str: String);
  293.   Begin
  294.   DoStringLn(Str);
  295.   End;
  296.  
  297.  
  298. Function AbsMsgObj.WriteMsg: Word;
  299.   Begin
  300.   End;
  301.  
  302.  
  303. Function AbsMsgObj.GetChar: Char;
  304.   Begin
  305.   End;
  306.  
  307.  
  308. Function AbsMsgObj.EOM: Boolean;
  309.   Begin
  310.   End;
  311.  
  312.  
  313. Function AbsMsgObj.GetString(MaxLen: Word): String;
  314.   Var
  315.     WPos: LongInt;
  316.     WLen: Byte;
  317.     StrDone: Boolean;
  318.     TxtOver: Boolean;
  319.     StartSoft: Boolean;
  320.     CurrLen: Word;
  321.     PPos: LongInt;
  322.     TmpCh: Char;
  323.     OldPos: LongInt;
  324.  
  325.   Begin
  326.   If EOM Then
  327.     GetString := ''
  328.   Else
  329.     Begin
  330.     StrDone := False;
  331.     CurrLen := 0;
  332.     PPos := GetTxtPos;
  333.     WPos := GetTxtPos;
  334.     WLen := 0;
  335.     StartSoft := LastSoft;
  336.     LastSoft := True;
  337.     OldPos := GetTxtPos;
  338.     TmpCh := GetChar;
  339.     While ((Not StrDone) And (CurrLen < MaxLen) And (Not EOM)) Do
  340.       Begin
  341.       Case TmpCh of
  342.         #$00:;
  343.         #$0d: Begin
  344.               StrDone := True;
  345.               LastSoft := False;
  346.               End;
  347.         #$8d:;
  348.         #$0a:;
  349.         #$20: Begin
  350.               If ((CurrLen <> 0) or (Not StartSoft)) Then
  351.                 Begin
  352.                 Inc(CurrLen);
  353.                 WLen := CurrLen;
  354.                 GetString[CurrLen] := TmpCh;
  355.                 WPos := GetTxtPos;
  356.                 End
  357.               Else
  358.                 StartSoft := False;
  359.               End;
  360.         Else
  361.           Begin
  362.           Inc(CurrLen);
  363.           GetString[CurrLen] := TmpCh;
  364.           End;
  365.         End;
  366.       If Not StrDone Then
  367.         Begin
  368.         OldPos := GetTxtPos;
  369.         TmpCh := GetChar;
  370.         End;
  371.       End;
  372.     If StrDone Then
  373.       Begin
  374.       GetString[0] := Chr(CurrLen);
  375.       End
  376.     Else
  377.       If EOM Then
  378.         Begin
  379.         GetString[0] := Chr(CurrLen);
  380.         End
  381.       Else
  382.         Begin
  383.         If WLen = 0 Then
  384.           Begin
  385.           GetString[0] := Chr(CurrLen);
  386.           SetTxtPos(OldPos);
  387.           End
  388.         Else
  389.           Begin
  390.           GetString[0] := Chr(WLen);
  391.           SetTxtPos(WPos);
  392.           End;
  393.         End;
  394.     End;
  395.   End;
  396.  
  397.  
  398.  
  399. Function AbsMsgObj.WasWrap: Boolean;
  400.   Begin
  401.   WasWrap := LastSoft;
  402.   End;
  403.  
  404.  
  405. Procedure AbsMsgObj.SeekFirst(MsgNum: LongInt);
  406.   Begin
  407.   End;
  408.  
  409.  
  410. Procedure AbsMsgObj.SeekNext;
  411.   Begin
  412.   End;
  413.  
  414.  
  415. Function AbsMsgObj.GetFrom: String;
  416.   Begin
  417.   End;
  418.  
  419.  
  420. Function AbsMsgObj.GetTo: String;
  421.   Begin
  422.   End;
  423.  
  424.  
  425. Function AbsMsgObj.GetSubj: String;
  426.   Begin
  427.   End;
  428.  
  429.  
  430. Function AbsMsgObj.GetCost: Word;
  431.   Begin
  432.   End;
  433.  
  434.  
  435. Function AbsMsgObj.GetDate: String;
  436.   Begin
  437.   End;
  438.  
  439.  
  440. Function AbsMsgObj.GetTime: String;
  441.   Begin
  442.   End;
  443.  
  444.  
  445. Function AbsMsgObj.GetRefer: LongInt;
  446.   Begin
  447.   End;
  448.  
  449.  
  450. Function AbsMsgObj.GetSeeAlso: LongInt;
  451.   Begin
  452.   End;
  453.  
  454.  
  455. Function AbsMsgObj.GetMsgNum: LongInt;
  456.   Begin
  457.   End;
  458.  
  459.  
  460. Procedure AbsMsgObj.GetOrig(Var Addr: AddrType);
  461.   Begin
  462.   End;
  463.  
  464.  
  465. Procedure AbsMsgObj.GetDest(Var Addr: AddrType);
  466.   Begin
  467.   End;
  468.  
  469.  
  470. Function AbsMsgObj.IsLocal: Boolean;
  471.   Begin
  472.   End;
  473.  
  474.  
  475. Function AbsMsgObj.IsCrash: Boolean;
  476.   Begin
  477.   End;
  478.  
  479.  
  480. Function AbsMsgObj.IsKillSent: Boolean;
  481.   Begin
  482.   End;
  483.  
  484.  
  485. Function AbsMsgObj.IsSent: Boolean;
  486.   Begin
  487.   End;
  488.  
  489.  
  490. Function AbsMsgObj.IsFAttach: Boolean;
  491.   Begin
  492.   End;
  493.  
  494.  
  495. Function AbsMsgObj.IsReqRct: Boolean;
  496.   Begin
  497.   End;
  498.  
  499.  
  500. Function AbsMsgObj.IsReqAud: Boolean;
  501.   Begin
  502.   End;
  503.  
  504.  
  505. Function AbsMsgObj.IsRetRct: Boolean;
  506.   Begin
  507.   End;
  508.  
  509.  
  510. Function AbsMsgObj.IsFileReq: Boolean;
  511.   Begin
  512.   End;
  513.  
  514.  
  515. Function AbsMsgObj.IsRcvd: Boolean;
  516.   Begin
  517.   End;
  518.  
  519.  
  520. Function AbsMsgObj.IsPriv: Boolean;
  521.   Begin
  522.   End;
  523.  
  524.  
  525. Function AbsMsgObj.IsDeleted: Boolean;
  526.   Begin
  527.   End;
  528.  
  529.  
  530. Function AbsMsgObj.IsEchoed: Boolean;
  531.   Begin
  532.   End;
  533.  
  534.  
  535. Function AbsMsgObj.GetMsgLoc: LongInt;
  536.   Begin
  537.   End;
  538.  
  539.  
  540. Procedure AbsMsgObj.SetMsgLoc(ML: LongInt);
  541.   Begin
  542.   End;
  543.  
  544.  
  545. Procedure AbsMsgObj.MsgStartUp;
  546.   Begin
  547.   End;
  548.  
  549.  
  550. Procedure AbsMsgObj.MsgTxtStartUp;
  551.   Begin
  552.   End;
  553.  
  554.  
  555. Procedure AbsMsgObj.YoursFirst(Name: String; Handle: String);
  556.   Begin
  557.   End;
  558.  
  559.  
  560. Procedure AbsMsgObj.YoursNext;
  561.   Begin
  562.   End;
  563.  
  564.  
  565. Function AbsMsgObj.YoursFound: Boolean;
  566.   Begin
  567.   End;
  568.  
  569.  
  570. Function AbsMsgObj.CreateMsgBase(MaxMsg: Word; MaxDays: Word): Word;
  571.   Begin
  572.   End;
  573.  
  574.  
  575. Function AbsMsgObj.MsgBaseExists: Boolean;
  576.   Begin
  577.   End;
  578.  
  579.  
  580. Procedure AbsMsgObj.StartNewMsg;
  581.   Begin
  582.   End;
  583.  
  584.  
  585. Function AbsMsgObj.GetHighMsgNum: LongInt;
  586.   Begin
  587.   End;
  588.  
  589.  
  590. Function AbsMsgObj.SeekFound: Boolean;
  591.   Begin
  592.   End;
  593.  
  594.  
  595. Procedure AbsMsgObj.SetMailType(MT: MsgMailType);
  596.   Begin
  597.   End;
  598.  
  599.  
  600. Function AbsMsgObj.GetSubArea: Word;
  601.   Begin
  602.   GetSubArea := 0;
  603.   End;
  604.  
  605.  
  606. Procedure AbsMsgObj.ReWriteHdr;
  607.   Begin
  608.   End;
  609.  
  610.  
  611. Procedure AbsMsgObj.DeleteMsg;
  612.   Begin
  613.   End;
  614.  
  615.  
  616. Procedure AbsMsgObj.SetEcho(ES: Boolean);
  617.   Begin
  618.   End;
  619.  
  620.  
  621. Procedure AbsMsgObj.SeekPrior;
  622.   Begin
  623.   End;
  624.  
  625.  
  626. Function AbsMsgObj.NumberOfMsgs: LongInt;
  627.   Begin
  628.   End;
  629.  
  630.  
  631. Function AbsMsgObj.GetLastRead(UNum: LongInt): LongInt;
  632.   Begin
  633.   End;
  634.  
  635. Procedure AbsMsgObj.SetLastRead(UNum: LongInt; LR: LongInt);
  636.   Begin
  637.   End;
  638.  
  639. Function AbsMsgObj.GetMsgDisplayNum: LongInt;
  640.   Begin
  641.   GetMsgDisplayNum := GetMsgNum;
  642.   End;
  643.  
  644. Function AbsMsgObj.GetTxtPos: LongInt;
  645.   Begin
  646.   GetTxtPos := 0;
  647.   End;
  648.  
  649. Procedure AbsMsgObj.SetTxtPos(TP: LongInt);
  650.   Begin
  651.   End;
  652.  
  653.  
  654.  {SetNextSeeAlso provided by 2:201/623@FidoNet Jonas@iis.bbs.bad.se}
  655.  
  656.  
  657. Procedure AbsMsgObj.SetNextSeeAlso(SAlso: LongInt);
  658.   Begin
  659.   End;
  660.  
  661. Function AbsMsgObj.GetNextSeeAlso: LongInt;
  662.   Begin
  663.   GetNextSeeAlso:=0;
  664.   End;
  665.  
  666.  
  667. End.
  668.