TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Bob Lawrence
from: Keith Richardson
date: 1997-06-01 19:47:50
subject: UUCP!!!

ok bob, heres a uucp reader, or more exactly a ".d" file reader.
its very basic, everything is hard coded, and there is no error checking,
but it aint too bad for 90 mins coding. i compiled it under delphi 2, but i
think that it should compile under d1 ok. there are some very crude bits
coz i used pascal strings and read the file as a text file, and the support
for these is rather crude.

keith

------------------->8 cut here 8<---------------------------------------------
unit message;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    Subject: TMemo;
    Label2: TLabel;
    NewsGroup: TMemo;
    Label3: TLabel;
    Date: TMemo;
    Label4: TLabel;
    From: TMemo;
    Label5: TLabel;
    MsgNo: TMemo;
    Label6: TLabel;
    Organisation: TMemo;
    MessageText: TMemo;
    Prev: TButton;
    Next: TButton;
    Exit: TButton;
    procedure FormCreate(Sender: TObject);
    procedure NextClick(Sender: TObject);
    procedure ExitClick(Sender: TObject);
    procedure PrevClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1:      TForm1;
  File1:      TextFile;
  ThisLine:   string;
  InFile:     string;
  TempString: string;
  Lines:      integer;
  Code:       integer;
  TextLine:   integer;
  MessageNo:  integer;
  i:          integer;


implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
     InFile := 'C:\dmail\scorpio\dml1A.EML';
     AssignFile( File1, InFile );
     FileMode := 0;  { Set file access to read only }
     Reset(File1);
     MessageNo := 0;
     NextClick(self);
end;

procedure TForm1.NextClick(Sender: TObject);
begin
  TempString := '';
  ThisLine   := '';
  MessageText.Clear;
  while  Pos('#!', ThisLine) = 0 do  {look for start of message}
    Readln( File1, ThisLine);
  inc(MessageNo);                    {found one}
  delete(ThisLine, 1, 8);            {extract message number}
  MsgNo.Text := (ThisLine);          {display it}
  while  Pos('Lines', TempString) = 0 do {extract header info}
  begin
    Readln( File1, ThisLine);
    TempString :=  ThisLine;
    delete(TempString, Pos(':', TempString), Length(TempString));
    delete(ThisLine, 1, (Pos(':', ThisLine) + 1));
    if TempString = 'From' then      {all these ifs are because pascal cant}
      From.Text :=  ThisLine         {use strings in case statements}
    else if TempString = 'Date' then
      Date.Text :=  ThisLine
    else if TempString = 'Newsgroups' then
      NewsGroup.Text :=  ThisLine
    else if TempString = 'Subject' then
      Subject.Text :=  ThisLine
    else if TempString = 'Organization' then
      Organisation.Text :=  ThisLine
    else if TempString = 'Lines' then  {last line of header shows how}
      Val(ThisLine, Lines, Code);      {many lines in the message}
    end;
    for TextLine := 1 to Lines do
    begin
      Readln( File1, ThisLine);         {read message}
      MessageText.lines.Add(ThisLine);  {display it}
    end;
end;

procedure TForm1.ExitClick(Sender: TObject);
begin
  Halt(0);
end;

procedure TForm1.PrevClick(Sender: TObject);
begin
  Reset(File1);                  {gotta do all this crap cos there aint no }
  MessageNo := MessageNo - 2;    {was to back up a text file}
  for i :=0 to (MessageNo) do
  begin
    ThisLine := '';
    while  Pos('#!', ThisLine) = 0 do
      Readln( File1, ThisLine);
  end;
  NextClick(self);
end;

end.

@EOT:

--- WinPoint 0.2.08 Alpha
* Origin: Malfunction Junction (3:712/610.6)
SEEN-BY: 711/934 712/610
@PATH: 712/610 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.