home *** CD-ROM | disk | FTP | other *** search
- {$X+}
- (*--------------------------------------------------------------------------
- (c) copyright 1988-91 Santronics Software
- ----------------------------------------------------------------------------*)
- (*
- This is a demo program for showing how to use the Squish Pascal API.
- Note. This is not a perfect program.
- *)
-
- Uses crt, dos, iofiles, strlib, Squish, DosDate;
-
- Procedure ShowMenu;
- begin
- textcolor(White);
- write('O - Open New Squish File, <Enter> Read Mail, E - Enter, Q - Quit > ');
- end;
-
- {$I DISPTXT.INC}
-
- Var SqFv : Stream;
- SqBase : _sqbasetype;
- Sqfhdr : _sqfhdrtype;
- Sqmhdr : _sqmhdrtype;
- sqname : pathstr;
- ch : char;
- nextframe : longint;
- abytes : longint; (* actual message text bytes *)
-
- Const
- ShowKludge : Boolean = True;
- ShowSeenby : Boolean = True;
- ShowRaw : Boolean = False;
- msgid : word = 0;
- Lockit : Boolean = False; (* MultiLine? Sharing? *)
-
- begin
- nextframe := 0;
- msgid := 0;
- repeat
- ShowMenu;
- ch := upcase(readkey);
- writeln;
- case ch of
- #13 : Begin
- if filerec(sqfv).mode = fmInOut then (* file is open *)
- begin
- if nextframe <> 0 then
- begin
- sqreadfhdr(sqfv,sqfhdr,nextframe);
- sqreadmhdr(sqfv,sqmhdr,nextframe);
- nextframe := sqfhdr.next_frame;
- inc(msgid);
- with sqmhdr do
- begin
- FromWhom := mat2str(FromWhom,SQMSG_FROM_SIZE-1);
- ToWhom := mat2str(ToWhom,SQMSG_TO_SIZE-1);
- Subj := mat2str(Subj,SQMSG_SUBJ_SIZE-1);
- textcolor(yellow);
- clrscr;
- writeln('FROM : ',FromWhom);
- writeln(' TO : ',ToWhom);
- writeln('SUBJ : ',Subj);
- gotoxy(50,1);writeln('DATE WRITTEN: ',DosDateFormat(date_written,3));
- gotoxy(50,2);writeln('DATE ARRIVED: ',DosDateFormat(date_arrived,3));
- gotoxy(50,3);writeln('MSGID : ',msgid,'/',sqbase.num_msg);
- end;
- Display_Text(sqfv, sqfhdr.msg_length, ShowRaw,ShowKludge,ShowSeenby,Abytes);
- end;
- end else writeln('NO SQUISH FILE OPEN');
- end;
- 'O' : Begin
- if filerec(sqfv).mode = fmInOut then (* already open *)
- begin
- fclose(sqfv);
- writeln('previous file closed now');
- end;
- write('Enter Squish File Name (without extension): ');
- readln(sqname);
- if removelb(sqname) <> '' then
- begin
- if SqOpenSQD(sqname,sqfv, LOCKIT) = 0 then
- begin
- SqSetSQBSize(sqfv);
- SqReadBHdr(sqfv,sqbase);
- _SQFSIZE := sqbase.sz_sqhdr;
- nextframe := sqbase.begin_frame;
- msgid := 0;
- end
- else Writeln('ERROR OPENING FILE');
- end;
- end;
- end;
- until ch = 'Q';
-
- if filerec(sqfv).mode = fmInOut then (* already open *)
- begin
- fclose(sqfv);
- writeln('previous file closed now');
- end;
- end.
-