1 { $O+,F+,I-,S-,R-,V-}
2 Unit MKMsgAbs;       {Abstract Msg Object}
3 
4 {$IfDef FPC}
5  {$PackRecords 1}
6 {$EndIf}
7 
8 Interface
9 
10 Uses MKGlobT, Dos;
11 
12 const
13   msgUnkown  = 0;
14   msgSquish  = 1;
15   msgJAM     = 2;
16   msgFido    = 3;
17   msgHudson  = 4;
18   msgEzy     = 5;
19 
20   MaxLen : Byte = 80;
21 
22 Type MsgMailType = (mmtNormal, mmtEchoMail, mmtNetMail);
23 
24 Type AbsMsgObj = Object
25   Wrapped : Boolean;
26   EOM     : Boolean;
27   Constructor Init; {Initialize}
28   Destructor Done; Virtual; {Done}
GetIDnull29   function  GetID: Byte; Virtual;
30   Procedure SetMsgPath(MP: String); Virtual; {Set msg path/other info}
OpenMsgBasenull31   Function  OpenMsgBase: Word; Virtual; {Open the message base}
CloseMsgBasenull32   Function  CloseMsgBase: Word; Virtual; {Close the message base}
CreateMsgBasenull33   Function  CreateMsgBase(MaxMsg: Word; MaxDays: Word): Word; Virtual; {Create new message base}
MsgBaseExistsnull34   Function  MsgBaseExists: Boolean; Virtual; {Does msg base exist}
LockMsgBasenull35   Function  LockMsgBase: Boolean; Virtual; {Lock the message base}
UnLockMsgBasenull36   Function  UnLockMsgBase: Boolean; Virtual; {Unlock the message base}
37   Procedure SetDest(Var Addr: AddrType); Virtual; {Set Zone/Net/Node/Point for Dest}
38   Procedure SetOrig(Var Addr: AddrType); Virtual; {Set Zone/Net/Node/Point for Orig}
39   Procedure SetFrom(Name: String); Virtual; {Set message from}
40   Procedure SetTo(Name: String); Virtual; {Set message to}
41   Procedure SetSubj(Str: String); Virtual; {Set message subject}
42   Procedure SetCost(SCost: Word); Virtual; {Set message cost}
43   Procedure SetRefer(SRefer: LongInt); Virtual; {Set message reference}
44   Procedure SetSeeAlso(SAlso: LongInt); Virtual; {Set message see also}
45   Procedure SetDate(SDate: String); Virtual; {Set message date}
46   Procedure SetTime(STime: String); Virtual; {Set message time}
47   Procedure SetLocal(LS: Boolean); Virtual; {Set local status}
48   Procedure SetRcvd(RS: Boolean); Virtual; {Set received status}
SetReadnull49   function  SetRead(RS: Boolean): boolean; virtual;
50   Procedure SetPriv(PS: Boolean); Virtual; {Set priveledge vs public status}
51   Procedure SetCrash(SS: Boolean); Virtual; {Set crash netmail status}
52   Procedure SetKillSent(SS: Boolean); Virtual; {Set kill/sent netmail status}
53   Procedure SetSent(SS: Boolean); Virtual; {Set sent netmail status}
54   Procedure SetFAttach(SS: Boolean); Virtual; {Set file attach status}
55   Procedure SetReqRct(SS: Boolean); Virtual; {Set request receipt status}
56   Procedure SetReqAud(SS: Boolean); Virtual; {Set request audit status}
57   Procedure SetRetRct(SS: Boolean); Virtual; {Set return receipt status}
58   Procedure SetFileReq(SS: Boolean); Virtual; {Set file request status}
59   procedure SetHold(sh : Boolean); virtual; {Set hold status}
60   Procedure DoString(Str: String); Virtual; {Add string to message text}
61   Procedure DoChar(Ch: Char); Virtual; {Add character to message text}
62   Procedure DoStringLn(Str: String); Virtual; {Add string and newline to msg text}
63   Procedure DoKludgeLn(Str: String); Virtual; {Add ^A kludge line to msg}
WriteMsgnull64   Function  WriteMsg: Word; Virtual; {Write msg to msg base}
GetCharnull65   Function  GetChar: Char; Virtual; {Get msg text character}
GetStringnull66   Function  GetString: String; Virtual;
GetFromnull67   Function  GetFrom: String; Virtual; {Get from name on current msg}
GetTonull68   Function  GetTo: String; Virtual; {Get to name on current msg}
GetSubjnull69   Function  GetSubj: String; Virtual; {Get subject on current msg}
GetCostnull70   Function  GetCost: Word; Virtual; {Get cost of current msg}
GetDatenull71   Function  GetDate: String; Virtual; {Get date of current msg}
GetTimenull72   Function  GetTime: String; Virtual; {Get time of current msg}
GetRefernull73   Function  GetRefer: LongInt; Virtual; {Get reply to of current msg}
GetSeeAlsonull74   Function  GetSeeAlso: LongInt; Virtual; {Get see also of current msg}
GetNextSeeAlsonull75   Function  GetNextSeeAlso: LongInt; Virtual;
76   Procedure SetNextSeeAlso(SAlso: LongInt); Virtual;
GetMsgNumnull77   Function  GetMsgNum: LongInt; Virtual; {Get message number}
78   Procedure GetOrig(Var Addr: AddrType); Virtual; {Get origin address}
79   Procedure GetDest(Var Addr: AddrType); Virtual; {Get destination address}
IsLocalnull80   Function  IsLocal: Boolean; Virtual; {Is current msg local}
IsCrashnull81   Function  IsCrash: Boolean; Virtual; {Is current msg crash}
IsKillSentnull82   Function  IsKillSent: Boolean; Virtual; {Is current msg kill sent}
IsSentnull83   Function  IsSent: Boolean; Virtual; {Is current msg sent}
IsFAttachnull84   Function  IsFAttach: Boolean; Virtual; {Is current msg file attach}
IsReqRctnull85   Function  IsReqRct: Boolean; Virtual; {Is current msg request receipt}
IsReqAudnull86   Function  IsReqAud: Boolean; Virtual; {Is current msg request audit}
IsRetRctnull87   Function  IsRetRct: Boolean; Virtual; {Is current msg a return receipt}
IsFileReqnull88   Function  IsFileReq: Boolean; Virtual; {Is current msg a file request}
IsRcvdnull89   Function  IsRcvd: Boolean; Virtual; {Is current msg received}
IsReadnull90   Function  IsRead: Boolean; Virtual; {Is current msg received}
IsPrivnull91   Function  IsPriv: Boolean; Virtual; {Is current msg priviledged/private}
IsHoldnull92   Function  IsHold: Boolean; Virtual; {Is current msg hold}
IsDeletednull93   Function  IsDeleted: Boolean; Virtual; {Is current msg deleted}
94   Procedure SetDeleted(tr: boolean); virtual;
IsEchoednull95   Function  IsEchoed: Boolean; Virtual; {Is current msg unmoved echomail msg}
GetMsgLocnull96   Function  GetMsgLoc: LongInt; Virtual; {To allow reseeking to message}
97   Procedure SetMsgLoc(ML: LongInt); Virtual; {Reseek to message}
98   Procedure InitMsgHdr; Virtual; {Do message set-up tasks}
99   Procedure MsgTxtStartUp; Virtual; {Do message text start up tasks}
100   Procedure StartNewMsg; Virtual; {Initialize for adding message}
101   Procedure SeekFirst(MsgNum: LongInt); Virtual; {Start msg seek}
102   Procedure SeekNext; Virtual; {Find next matching msg}
103   Procedure SeekPrior; Virtual; {Prior msg}
SeekFoundnull104   Function  SeekFound: Boolean; Virtual; {Msg was found}
GetHighMsgNumnull105   Function  GetHighMsgNum: LongInt; Virtual; {Get highest msg number}
106   Procedure SetMailType(MT: MsgMailType); Virtual; {Set message base type}
GetSubAreanull107   Function  GetSubArea: Word; Virtual; {Get sub area number}
108   Procedure ReWriteHdr; Virtual; {Rewrite msg header after changes}
109   Procedure DeleteMsg; Virtual; {Delete current message}
110   Procedure SetEcho(ES: Boolean); Virtual; {Set echo status}
NumberOfMsgsnull111   Function  NumberOfMsgs: LongInt; Virtual; {Number of messages}
GetLastReadnull112   Function  GetLastRead: LongInt; Virtual; {Get last read for user num}
113   Procedure SetLastRead(LR: LongInt); Virtual; {Set last read}
GetMsgDisplayNumnull114   Function  GetMsgDisplayNum: LongInt; Virtual; {Get msg number to display}
GetTxtPosnull115   Function  GetTxtPos: LongInt; Virtual; {Get indicator of msg text position}
116   Procedure SetTxtPos(TP: LongInt); Virtual; {Set text position}
GetHighActiveMsgNumnull117   Function  GetHighActiveMsgNum: LongInt; Virtual; {Get highest active msg num}
GetLowActiveMsgNumnull118   Function  GetLowActiveMsgNum: LongInt; Virtual; {Get lowest active msg num}
GetRealMsgNumnull119   Function  GetRealMsgNum: LongInt; Virtual;
120   End;
121 
122 
123 Type AbsMsgPtr = ^AbsMsgObj;
124 
125 
126 Implementation
127 
128 
129 Constructor AbsMsgObj.Init;
130   Begin
131   End;
132 
133 
134 Destructor AbsMsgObj.Done;
135   Begin
136   End;
137 
138 
AbsMsgObj.GetIDnull139 function  AbsMsgObj.GetID: Byte;
140 begin
141   GetID:=msgUnkown;
142 end;
143 
144 Procedure AbsMsgObj.SetMsgPath(MP: String);
145   Begin
146   End;
147 
148 
AbsMsgObj.OpenMsgBasenull149 Function AbsMsgObj.OpenMsgBase: Word;
150   Begin
151   End;
152 
153 
AbsMsgObj.CloseMsgBasenull154 Function AbsMsgObj.CloseMsgBase: Word;
155   Begin
156   End;
157 
158 
AbsMsgObj.LockMsgBasenull159 Function AbsMsgObj.LockMsgBase: Boolean;
160   Begin
161   End;
162 
163 
AbsMsgObj.UnLockMsgBasenull164 Function AbsMsgObj.UnLockMsgBase: Boolean;
165   Begin
166   End;
167 
168 
169 Procedure AbsMsgObj.SetDest(Var Addr: AddrType);
170   Begin
171   End;
172 
173 
174 Procedure AbsMsgObj.SetOrig(Var Addr: AddrType);
175   Begin
176   End;
177 
178 
179 Procedure AbsMsgObj.SetFrom(Name: String);
180   Begin
181   End;
182 
183 
184 Procedure AbsMsgObj.SetTo(Name: String);
185   Begin
186   End;
187 
188 
189 Procedure AbsMsgObj.SetSubj(Str: String);
190   Begin
191   End;
192 
193 
194 Procedure AbsMsgObj.SetCost(SCost: Word);
195   Begin
196   End;
197 
198 
199 Procedure AbsMsgObj.SetRefer(SRefer: LongInt);
200   Begin
201   End;
202 
203 
204 Procedure AbsMsgObj.SetSeeAlso(SAlso: LongInt);
205   Begin
206   End;
207 
208 
209 Procedure AbsMsgObj.SetDate(SDate: String);
210   Begin
211   End;
212 
213 
214 Procedure AbsMsgObj.SetTime(STime: String);
215   Begin
216   End;
217 
218 
219 Procedure AbsMsgObj.SetLocal(LS: Boolean);
220   Begin
221   End;
222 
223 
224 Procedure AbsMsgObj.SetRcvd(RS: Boolean);
225   Begin
226   End;
227 
228 
229 Procedure AbsMsgObj.SetPriv(PS: Boolean);
230   Begin
231   End;
232 
233 
234 Procedure AbsMsgObj.SetCrash(SS: Boolean);
235   Begin
236   End;
237 
238 
239 Procedure AbsMsgObj.SetKillSent(SS: Boolean);
240   Begin
241   End;
242 
243 
244 Procedure AbsMsgObj.SetSent(SS: Boolean);
245   Begin
246   End;
247 
248 
249 Procedure AbsMsgObj.SetFAttach(SS: Boolean);
250   Begin
251   End;
252 
253 
254 Procedure AbsMsgObj.SetReqRct(SS: Boolean);
255   Begin
256   End;
257 
258 
259 Procedure AbsMsgObj.SetReqAud(SS: Boolean);
260   Begin
261   End;
262 
263 
264 Procedure AbsMsgObj.SetRetRct(SS: Boolean);
265   Begin
266   End;
267 
268 
269 Procedure AbsMsgObj.SetFileReq(SS: Boolean);
270   Begin
271   End;
272 
273 procedure AbsMsgObj.SetHold(SH : Boolean);
274 
275 begin
276 end;
277 
278 Procedure AbsMsgObj.DoString(Str: String);
279   Var
280     i: Word;
281 
282   Begin
283   For i := 1 to Length(Str) Do
284     DoChar(Str[i]);
285   End;
286 
287 
288 Procedure AbsMsgObj.DoChar(Ch: Char);
289   Begin
290   End;
291 
292 
293 Procedure AbsMsgObj.DoStringLn(Str: String);
294   Begin
295   DoString(Str);
296   DoChar(#13);
297   End;
298 
299 Procedure AbsMsgObj.DoKludgeLn(Str: String);
300   Begin
301   DoStringLn(Str);
302   End;
303 
304 
AbsMsgObj.WriteMsgnull305 Function AbsMsgObj.WriteMsg: Word;
306   Begin
307   End;
308 
309 
AbsMsgObj.GetCharnull310 Function AbsMsgObj.GetChar: Char;
311   Begin
312   End;
313 
314 
AbsMsgObj.GetStringnull315 Function AbsMsgObj.GetString: 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 := Wrapped;
338     Wrapped := 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               Wrapped := 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 Procedure AbsMsgObj.SeekFirst(MsgNum: LongInt);
402   Begin
403   End;
404 
405 
406 Procedure AbsMsgObj.SeekNext;
407   Begin
408   End;
409 
410 
AbsMsgObj.GetFromnull411 Function AbsMsgObj.GetFrom: String;
412   Begin
413   End;
414 
415 
AbsMsgObj.GetTonull416 Function AbsMsgObj.GetTo: String;
417   Begin
418   End;
419 
420 
AbsMsgObj.GetSubjnull421 Function AbsMsgObj.GetSubj: String;
422   Begin
423   End;
424 
425 
AbsMsgObj.GetCostnull426 Function AbsMsgObj.GetCost: Word;
427   Begin
428   End;
429 
430 
AbsMsgObj.GetDatenull431 Function AbsMsgObj.GetDate: String;
432   Begin
433   End;
434 
435 
AbsMsgObj.GetTimenull436 Function AbsMsgObj.GetTime: String;
437   Begin
438   End;
439 
440 
AbsMsgObj.GetRefernull441 Function AbsMsgObj.GetRefer: LongInt;
442   Begin
443   End;
444 
445 
AbsMsgObj.GetSeeAlsonull446 Function AbsMsgObj.GetSeeAlso: LongInt;
447   Begin
448   End;
449 
450 
AbsMsgObj.GetMsgNumnull451 Function AbsMsgObj.GetMsgNum: LongInt;
452   Begin
453   End;
454 
455 
456 Procedure AbsMsgObj.GetOrig(Var Addr: AddrType);
457   Begin
458   End;
459 
460 
461 Procedure AbsMsgObj.GetDest(Var Addr: AddrType);
462   Begin
463   End;
464 
465 
AbsMsgObj.IsLocalnull466 Function AbsMsgObj.IsLocal: Boolean;
467   Begin
468   End;
469 
470 
AbsMsgObj.IsCrashnull471 Function AbsMsgObj.IsCrash: Boolean;
472   Begin
473   End;
474 
475 
AbsMsgObj.IsKillSentnull476 Function AbsMsgObj.IsKillSent: Boolean;
477   Begin
478   End;
479 
480 
AbsMsgObj.IsSentnull481 Function AbsMsgObj.IsSent: Boolean;
482   Begin
483   End;
484 
485 
AbsMsgObj.IsFAttachnull486 Function AbsMsgObj.IsFAttach: Boolean;
487   Begin
488   End;
489 
490 
AbsMsgObj.IsReqRctnull491 Function AbsMsgObj.IsReqRct: Boolean;
492   Begin
493   End;
494 
495 
AbsMsgObj.IsReqAudnull496 Function AbsMsgObj.IsReqAud: Boolean;
497   Begin
498   End;
499 
500 
AbsMsgObj.IsRetRctnull501 Function AbsMsgObj.IsRetRct: Boolean;
502   Begin
503   End;
504 
505 
AbsMsgObj.IsFileReqnull506 Function AbsMsgObj.IsFileReq: Boolean;
507   Begin
508   End;
509 
510 
AbsMsgObj.IsRcvdnull511 Function AbsMsgObj.IsRcvd: Boolean;
512   Begin
513   End;
514 
515 
AbsMsgObj.IsPrivnull516 Function AbsMsgObj.IsPriv: Boolean;
517   Begin
518   End;
519 
AbsMsgObj.IsHoldnull520 Function AbsMsgObj.IsHold: Boolean;
521   Begin
522   IsHold:=false;
523   End;
524 
AbsMsgObj.IsDeletednull525 Function AbsMsgObj.IsDeleted: Boolean;
526 begin
527   IsDeleted:=false;
528 end;
529 
530 Procedure AbsMsgObj.SetDeleted(tr: boolean);
531 begin
532 end;
533 
AbsMsgObj.IsEchoednull534 Function AbsMsgObj.IsEchoed: Boolean;
535   Begin
536   End;
537 
538 
AbsMsgObj.GetMsgLocnull539 Function AbsMsgObj.GetMsgLoc: LongInt;
540   Begin
541   End;
542 
543 
544 Procedure AbsMsgObj.SetMsgLoc(ML: LongInt);
545   Begin
546   End;
547 
548 
549 Procedure AbsMsgObj.InitMsgHdr;
550   Begin
551   End;
552 
553 
554 Procedure AbsMsgObj.MsgTxtStartUp;
555   Begin
556   End;
557 
558 
AbsMsgObj.CreateMsgBasenull559 Function AbsMsgObj.CreateMsgBase(MaxMsg: Word; MaxDays: Word): Word;
560   Begin
561   End;
562 
563 
AbsMsgObj.MsgBaseExistsnull564 Function AbsMsgObj.MsgBaseExists: Boolean;
565   Begin
566   End;
567 
568 
569 Procedure AbsMsgObj.StartNewMsg;
570   Begin
571   End;
572 
573 
AbsMsgObj.GetHighMsgNumnull574 Function AbsMsgObj.GetHighMsgNum: LongInt;
575   Begin
576   End;
577 
578 
AbsMsgObj.SeekFoundnull579 Function AbsMsgObj.SeekFound: Boolean;
580   Begin
581   End;
582 
583 
584 Procedure AbsMsgObj.SetMailType(MT: MsgMailType);
585   Begin
586   End;
587 
588 
AbsMsgObj.GetSubAreanull589 Function AbsMsgObj.GetSubArea: Word;
590   Begin
591   GetSubArea := 0;
592   End;
593 
594 
595 Procedure AbsMsgObj.ReWriteHdr;
596   Begin
597   End;
598 
599 
600 Procedure AbsMsgObj.DeleteMsg;
601   Begin
602   End;
603 
604 
605 Procedure AbsMsgObj.SetEcho(ES: Boolean);
606   Begin
607   End;
608 
609 
610 Procedure AbsMsgObj.SeekPrior;
611   Begin
612   End;
613 
614 
AbsMsgObj.NumberOfMsgsnull615 Function AbsMsgObj.NumberOfMsgs: LongInt;
616   Begin
617   End;
618 
619 
AbsMsgObj.GetLastReadnull620 Function AbsMsgObj.GetLastRead: LongInt;
621   Begin
622   End;
623 
624 Procedure AbsMsgObj.SetLastRead(LR: LongInt);
625   Begin
626   End;
627 
AbsMsgObj.GetMsgDisplayNumnull628 Function AbsMsgObj.GetMsgDisplayNum: LongInt;
629   Begin
630   GetMsgDisplayNum := GetMsgNum;
631   End;
632 
AbsMsgObj.GetTxtPosnull633 Function AbsMsgObj.GetTxtPos: LongInt;
634   Begin
635   GetTxtPos := 0;
636   End;
637 
638 Procedure AbsMsgObj.SetTxtPos(TP: LongInt);
639   Begin
640   End;
641 
642 
643  {SetNextSeeAlso provided by 2:201/623@FidoNet Jonas@iis.bbs.bad.se}
644 
645 
646 Procedure AbsMsgObj.SetNextSeeAlso(SAlso: LongInt);
647   Begin
648   End;
649 
AbsMsgObj.GetNextSeeAlsonull650 Function AbsMsgObj.GetNextSeeAlso: LongInt;
651   Begin
652   GetNextSeeAlso:=0;
653   End;
654 
655 
AbsMsgObj.GetHighActiveMsgNumnull656 function AbsMsgObj.GetHighActiveMsgNum: LongInt;
657 begin
658   SeekFirst(GetHighMsgNum);
659   if not SeekFound then SeekPrior;
660   if SeekFound then begin
661     GetHighActiveMsgNum := GetMsgNum
662   end else
663     GetHighActiveMsgNum := 0;
664 end;
665 
666 
AbsMsgObj.GetLowActiveMsgNumnull667 function AbsMsgObj.GetLowActiveMsgNum: LongInt;
668 begin
669   SeekFirst(1);
670   if not SeekFound then SeekNext;
671   if SeekFound then begin
672     GetLowActiveMsgNum := GetMsgNum
673   end else
674     GetLowActiveMsgNum := 1;
675 end;
676 
AbsMsgObj.GetRealMsgNumnull677 Function AbsMsgObj.GetRealMsgNum: LongInt;
678 begin
679   GetRealMsgNum:=GetMsgNum;
680 end;
681 
AbsMsgObj.SetReadnull682 function AbsMsgObj.SetRead(RS: Boolean): boolean;
683 begin
684   if (IsRead=false) and (IsLocal=false) then begin
685     SetRcvd(true);
686     SetRead:=true;
687   end else
688     SetRead:=false;
689 end;
690 
691 
AbsMsgObj.IsReadnull692 function AbsMsgObj.IsRead: Boolean;
693 begin
694   IsRead:=IsRcvd;
695 end;
696 
697 
698 End.
699