home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Jason Aller Floppy Collection
/
270.img
/
FORUM25C.ZIP
/
MAILRET.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-01-01
|
2KB
|
102 lines
{$R-,S-,I-,D-,V-,B-,N-,L- }
{$O+}
unit mailret;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\}
interface
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\}
uses gentypes,gensubs,subs1,configrt,statret,textret;
Function searchmail (startpt,usernum:integer):integer;
Procedure delmail (n:integer);
Procedure addmail (sentto:integer; line:integer; VAR me:message);
Function getnummail (un:integer):integer;
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\}
implementation
{/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\}
Function searchmail (startpt,usernum:integer):integer;
VAR cnt:integer;
m:mailrec;
begin
searchmail:=0;
if startpt>=filesize(mfile)-1 then exit;
startpt:=startpt+1;
seek (mfile,startpt); che;
for cnt:=startpt to filesize(mfile)-1 do begin
read (mfile,m); che;
if m.sentto=usernum then begin
searchmail:=cnt;
exit
end
end
end;
Procedure delmail (n:integer);
VAR m:mailrec;
c:integer;
begin
seek (mfile,n);
read (mfile,m);
deletetext (m.line);
for c:=n to filesize(mfile)-2 do begin
seek (mfile,c+1);
read (mfile,m);
seek (mfile,c);
write (mfile,m)
end;
seek (mfile,filesize(mfile)-1);
truncate (mfile);
if filesize(mfile)=0 then begin
m.sentto:=0;
seek (mfile,0);
write (mfile,m)
end
end;
Procedure addmail (sentto : integer; line:integer; VAR me:message);
VAR m:mailrec;
u:userrec;
begin
m.sentby := unum;
m.anon := me.anon;
m.when := now;
m.title := me.title;
m.line := line;
m.sentto := sentto;
m.read := false;
m.Anonpost := FALSE;
Seek(mfile,filesize(mfile));
Write(mfile,m);
Seek(ufile,sentto);
Read(ufile,u);
if match(u.handle,sysopname) then newmail:=newmail+1
End;
Function getnummail (un:integer):integer;
VAR cnt:integer;
m:mailrec;
total:integer;
begin
total:=0;
seek (mfile,0);
for cnt:=1 to filesize(mfile) do begin
read (mfile,m);
if m.sentto=un then total:=total+1
end;
getnummail:=total
end;
end.