home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / MKMSG102.ZIP / MKMSGABS.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-08-15  |  13.5 KB  |  639 lines

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