home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Jason Aller Floppy Collection
/
153.img
/
TELES.ZIP
/
UNIT2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-07-24
|
17KB
|
532 lines
{$R-} {Range checking off}
{$B+} {Boolean complete evaluation on}
{$S+} {Stack checking on}
{$I+} {I/O checking on}
{$N-} {No numeric coprocessor}
{$V-}
Unit Unit2;
Interface
Uses
Crt,
Dos,
Common,
Unit0,
UnitX,
Unit1,
BoardEdt,
SysopUt,
FileSc,
MenuEdt;
procedure bulletins;
procedure chuser;
procedure pstat;
procedure mailr;
procedure init;
procedure hangupphone;
procedure zlog;
PROCEDURE scan2(var cn:integer; iread:newtyp; var quit:boolean);
procedure scan1;
procedure getcaller;
procedure qscan(var quit:boolean; tf:boolean);
procedure nscan;
Implementation
procedure chuser;
var n:integer;
begin
if checkpw then begin
prt('Which user? ');
finduser(n);
if n>0 then begin
thisuser.sl:=realsl;
thisuser.dsl:=realdsl;
reset(uf);
seek(uf,usernum);
write(uf,thisuser);
seek(uf,n);
read(uf,thisuser);
close(uf);
realsl:=thisuser.sl;
realdsl:=thisuser.dsl;
usernum:=n;
if spd<>'KB' then sysoplog('#*#*#*# '+#3+#8+'Changed to '+nam);
topscr;
end;
end;
end;
procedure pstat;
var c:char;
begin
outkey(chr(12));
with systat do begin
print('New User Pass : '+boardpw);
prompt('Board is : '); if closedsystem then print('Closed') else print('Open');
print('Number Users : '+cstr(users));
print('Number calls : '+cstr(callernum));
print('Date : '+lastdate);
print('Time : '+time);
print('Active today : '+cstr(activetoday));
print('Calls today : '+cstr(callstoday));
print('Messages today : '+cstr(msgposttoday));
print('Email sent today: '+cstr(emailtoday));
print('Feed back today : '+cstr(fbacktoday));
print('Up today : '+cstr(uptoday));
prompt('Sysop : '); if sysop then begin sprompt(SYSTAT.SYSOPIN); end
else begin sprompt(SYSTAT.SYSOPOUT); nl; end;
print('Files waiting : '+cstr(fw));
print('Disk free space : '+cstr(freek(0))+'k');
prompt('Sysop hours : ');
if lowtime=hitime then
print('None')
else
print(tch(cstr(lowtime div 60))+':'+tch(cstr(lowtime mod 60))+' to '+
tch(cstr(hitime div 60))+':'+tch(cstr(hitime mod 60)));
end;
if not useron then begin
nl;nl;print('Hit any key');
getkey(c);
end;
end;
procedure mailr;
var ii:integer; mr:mailrec; abort,a:boolean; c:char; u:userrec; is:astr;
begin
readingmail:=true;
{$I-} reset(mailfile); {$I+} c:=' ';
if ioresult=0 then begin
reset(uf);
ii:=filesize(mailfile)-1; c:=' ';
while (ii>=0) and (c<>'Q') and (not hangup) do begin
seek(mailfile,ii); read(mailfile,mr);
if mr.destin<>-1 then begin
repeat
seek(uf,mr.destin); read(uf,u); if systat.clearmsg then cls;
cl(1);prompt(' Title: ');cl(3);print(mr.title);
cl(1);prompt(' To: ');cl(9);print(u.name+' #'+cstr(mr.destin));
a:=true;
readmsg(mr.msg,a,next);
prt('Mail Read (R:e-read,D:elete,Q:uit,<space>,?) : ');
if next then c:=' ' else getkey(c); c:=upcase(c); print(c);
if c='D' then begin
close(uf); is:=rmail(ii); reset(uf);
if usernum=mr.destin then thisuser.waiting:=thisuser.waiting-1;
end;
nl;nl;
until (c<>'R') or hangup;
end;
ii:=ii-1;
end;
close(mailfile);
close(uf);
end;
readingmail:=false;
end;
procedure init;
var a,b,c:integer;
vdf:file of vdatar;
vd:vdatar;
fi:text;
i:astr;
f:file;
ch1:char;
begin
if daynum(date)=0 then begin
clrscr;
writeln('Please set the date & time, it is required for operation.');
halt;
end;
initp1;
assign(vdf,systat.gfilepath+'voting.dat');
{$I-} reset(vdf); {$I+}
if ioresult=0 then begin
for a:=1 to 9 do begin
read(vdf,vd);
vqu[a]:=vd.numa<>0;
end;
close(vdf);
end else for a:=1 to 9 do vqu[a]:=false;
a:=freek(0);
{errorptr:=ofs(erhnd);}
{!^ 62. Use the new ExitProc facility to replace ErrorPtr references.}
end;
procedure hangupphone;
var rl:real; try:integer;
procedure dely(r:real);
var r1:real;
begin
r1:=timer;
while abs(timer-r1)<r do;
end;
begin
try:=0;
term_ready(false);
while (try<2) and cdet do begin
dely(2.0);
pr1(#1#1#1);
rl:=timer;
while (cinkey<>'0') and (abs(timer-rl)<2.0) do;
dely(0.8);
pr(systat.hangup);
try:=try+1;
dely(0.3);
end;
end;
procedure zlog;
var d1:zlogt; n:integer; i:astr; zf:file of zlogt; abort,next:boolean;
function f(x,n:integer):astr;
var i:astr;
begin
i:=cstr(x);
while length(i)<n do
i:=' '+i;
f:=i;
end;
begin
assign(zf,systat.gfilepath+'zlog.dat');
{$I-} reset(zf); {$I+}
if ioresult=0 then begin
abort:=false;
read(zf,d1);
cl(3);printacr(
' Date Calls Active Posts Email Fback U/L %Act T/user',abort,next);
cl(2);printacr(
'-------- ----- ------ ----- ----- ----- --- ---- ------',abort,next);
while (not abort) and (d1.date<>'') do begin
i:=d1.date+f(d1.calls,8)+f(d1.active,8)+f(d1.post,8)+f(d1.email,8)+
f(d1.fback,8)+f(d1.up,8)+f(trunc(100.0*d1.active/1440.0),8);
if d1.calls>0 then i:=i+f(d1.active div d1.calls,9);
printacr(i,abort,next);
if eof(zf) then
abort:=true
else
read(zf,d1);
end;
end;
close(zf);
end;
PROCEDURE scan2(var cn:integer; iread:newtyp; var quit:boolean);
var unvali,uv,pq,donescan,abort,next:boolean; i:astr; t:integer;
b:messagerec;
begin
quit:=false;pq:=false; unvali:=false;
donescan:=false;
repeat
if iread=lt then begin cn:=cn+1; titles(cn); iread:=rp; end;
if iread=rp then begin
topscr;
rep:=false;
cl(5);prompt('['+(cstr(cn))+'] ');cl(3);
prompt('Read:(W,P,T,Q,B,D,A,M,1-'+cstr(tnum)+',<CR>) :');cl(5);
input(i,4); t:=value(i);
if (i='R') then begin t:=cn; i:=cstr(t); wantfilename:=false; end;
if (i='L') then begin t:=cn; i:=cstr(t); wantfilename:=true; end;
if (i<>'') and (t=0) then case i[1] of
'P':post;
'T':iread:=lt;
'Q':begin quit:=true; donescan:=true; end;
'B':donescan:=true;
'D':if lcs and (cn>0) and (cn<=tnum) then begin
deletem(cn); cn:=cn-1;
end;
'A':autoreply;
'M':if cs then movemsg(cn);
'W':begin rep:=true; irt:=irt+' (Msg #'+cstr(cn)+')'; post; end;
'?':begin
nl; cl(5);
print('- Message Commands -'); nl;
print('#:message to read <CR>:next msg');
print('T:itles Q:uit P:ost A:uto-reply');
print('R:e-read B:next board in N-scan');
print('W:rite reply to current message');nl;
if so then begin
cl(5);print('- Sysop Functions -');
nl;
print('L:ist message with filename');
print('D:elete message');
print('M:ove message to different base');nl;
end;
end;
end else begin
if (t>0) and (t<=tnum) then begin
cn:=t;
iread:=rm;
end else if i='' then begin
t:=cn+1;
if t<=tnum then begin
cn:=t;
iread:=rm;
end else begin donescan:=true; pq:=true; end;
end;
end;
end;
if (iread=rm) and (cn>0) and (cn<=tnum) then begin
readm(cn,next,uv); if uv then unvali:=true;
if next then cn:=cn+1 else iread:=rp;
mread:=mread+1; tleft;
if (mread>=extramsgs+seclev[thisuser.sl].mallowed)
and (thisuser.sl<>255) and (thisuser.ontoday<>1) then begin
print('You have read all your messages.');
hangup:=true;
end;
if (mread+5=extramsgs+seclev[thisuser.sl].mallowed) and (thisuser.ontoday<>1) then
print('5 messages left until forced logoff');
end else if iread=rm then iread:=rp;
if (iread=rm) and (cn=tnum+1) then begin donescan:=true; pq:=true; end;
until donescan or hangup;
if unvali and lcs then begin
ynq(chr(7)+'Validate messages here? ');
if yn then for t:=1 to tnum do
if mary[t].messagestat<>validated then
mary[t].messagestat:=validated;
bchanged:=true;
end;
if pq and (thisuser.sl>=boards[board].postsl) and not (rpost in thisuser.ac)
and ((ptoday<seclev[thisuser.sl].posts) or (thisuser.sl>55)) then begin
nl; ynq('Post on '+boards[board].name+'? ');
if yn then post;
end;
nl;
end;
procedure scan1;
var cn:integer; i:astr; quit:boolean;
begin
iscan;
print(cstr(tnum)+' msgs on '+boards[board].name);
if tnum<>0 then begin
prt('Start listing at (Q=quit)? ');
input(i,4);
cn:=value(i); if cn<=0 then cn:=0 else if cn>tnum then cn:=tnum else cn:=cn-1;
end else i:='S';
if i='S' then scan2(cn,rp,quit) else
if (i<>'Q') then
if i='N' then begin
cn:=1;
while (not greater(mary[cn].message)) and (cn<tnum) do
cn:=cn+1;
cn:=cn-1;
if greater(mary[cn].message) then scan2(cn,lt,quit);
end else scan2(cn,lt,quit);
savebase;
end;
procedure getcaller;
var c:char; x:smr; chkcom:boolean; rl,rl1,rl2:real; i:astr; wfcm:boolean; duh,txt:integer;
procedure init1;
begin
if (systat.init<>'') then begin
clrscr;textcolor(9);write('■ ');textcolor(11);rl2:=timer;
write('Initializing modem');
wfcm:=false;
set_baud(systat.maxbaud);
pr(systat.init);
dump;
end;
end;
procedure i1;
begin
init1; c:=#0; rl:=timer;
repeat
c:=cinkey;if abs(timer-rl)>4.0 then begin init1; rl:=timer; end;
until c=#13; delay(50);
end;
begin
duh:=0; txt:=0;
wfcm:=false; wantfilename:=false; windowon:=systat.bwindow; nopfile:=false;
buf:=''; enddayf:=false; delay(50); close(sysopf); append(sysopf); reading_a_msg:=false;
dump; mailread:=false; smread:=false; andwith:=255; checkit:=false;
curco:=7; sdc; window(1,1,80,25); beepend:=false;
outcom:=false; useron:=false; ll:=''; chatr:='';
hangup:=false; usernum:=0; chatcall:=false; hungup:=false;
term_ready(true); if answerbaud<2 then i1; clrscr;thisline:=''; okt:=false;
if systat.users>0 then
begin reset(uf); seek(uf,1); read(uf,thisuser); close(uf); usernum:=1; end
else with thisuser do begin
linelen:=80; pagelen:=25; defaults:=[]; option:=[];
end;
repeat
if (wfcm=false) and (lmsg=true) then lmsg:=false;
if not wfcm then begin wfcmenu;wfcm:=true; end;
if daynum(date)<>ldate then
if (daynum(date)-ldate)=1 then
ldate:=ldate+1
else begin
clrscr;
textcolor(9);write('■ ');textcolor(11);writeln('Date corrupted.');
halt(1);
end;
randomize; incom:=false; outcom:=false;
hangup:=false; hungup:=false; irt:=''; lastname:=''; macok:=true; cfo:=false;
spd:='KB'; c:=#0; chkcom:=false;chattime:=0.0; extratime:=0.0;
sdc; bread:=0; lil:=0; cursoroff; if systat.special then duh:=duh+1;
if duh=30 then begin
duh:=0; txt:=txt+1; if txt>13 then txt:=0; tc(txt);
tc(txt);gotoxy(1,1); write(' ─────────────────');
tc(txt);gotoxy(59,1); write(' ────────────────');
tc(txt+1);gotoxy(1,2); write('────────────────────');
tc(txt+1);gotoxy(59,2); write(' ────────────────────');
tc(txt+2);gotoxy(1,3); write(' ─────────────────');
tc(txt+2);gotoxy(59,3); write(' ────────────────');
end;
textcolor(11);
gotoxy(16,14);write(time);gotoxy(16,15);write(date);
if (time='04:00:00') and (nightly) then begin
clrscr; writeln('Time for nightly events.');
sl1('[> Ran nightly events at '+time);
exec('\command.com','/c night.bat');
sl1('[> Returned from nightly events at '+time); iport;
i1;
end;
gotoxy(41,17);if sysop then write('Available') else write('Not here ');
textcolor(3);gotoxy(2,24);
if lmsg=true then begin lmain:=true; lmsg:=false; wfcm:=false; end;
if answerbaud>2 then c:='A';
if returna=true then begin returna:=false; c:='A'; end else
if answerbaud<2 then c:=inkey;
if c<>#0 then begin
cursoron;
c:=upcase(c);
wfcm:=false;cls;
CL(1);
case c of
'#':Menu_edit;
'U':if usernum=1 then dosj('U');
' ':begin
write('Log on? '); rl2:=timer;
while (not keypressed) and (abs(timer-rl2)<60.0) do;
if keypressed then c:=readkey else c:='N'; c:=upcase(c); writeln(c);
if c='Y' then begin
c:=' '
END else c:='@';
end;
'Q':begin elevel:=0; hangup:=true; doneday:=true; end;
'L':begin close(sysopf); printfile(systat.gfilepath+'sysop.log');
pausescr; append(sysopf);
end;
'Y':begin printfile(systat.gfilepath+'ysysop.log'); pausescr; end;
'A':chkcom:=true;
'M':mailr;
'T':begin term; if returna=false then if answerbaud<>1 then i1; end;
'B':boardedit;
'I':initvotes;
'E':dosj('E');
'=':exec('\command.com','/c sysop.exe');
'P':changestuff;
'F':dlboardedit;
'R':if (systat.users>0) and (thisuser.waiting>0) then begin
writeln('Feedback: '); nl; nl;
macok:=true; readmail; macok:=false;
reset(uf); seek(uf,1); write(uf,thisuser); close(uf);
end;
'Z':begin zlog; pausescr; end;
'X':if answerbaud<>1 then i1;
'D':SysopShell;
'/':begin clrscr; printfile(systat.gfilepath+'user.log'); pausescr; end;
'V':begin voteprint; printfile(systat.gfilepath+'votes.txt'); end;
end;
curco:=7; sdc; window(1,1,80,25); clrscr; dump;
end;
if c<>' ' then c:=#0;
if (c<>#0) or commpressed or chkcom then begin
getcallera(c,chkcom);
if c='X' then Begin WfcM:=False; if answerbaud<2 then i1;
If QuitAfterDone then begin elevel:=0; hangup:=true; doneday:=true; end;
End;
end;
until incom or (c=' ') or doneday;
etoday:=0; ptoday:=0; ftoday:=0; if not doneday then begin
window(1,1,80,25);
writeln('Baud = '+spd);
end;
curco:=7; sdc;
if incom then begin
outcom:=true;
set_baud(value(spd));
delay(700);
end else begin term_ready(false); incom:=false; outcom:=false; end;
timeon:=timer; ftoday:=0;
dump;
if windowon then window(1,1,80,21) else window(1,1,80,24);
lil:=0; okt:=true;
thisuser.defaults:=thisuser.defaults-[ansi];
thisuser.cols:=dcols; curco:=$07;
andwith:=255; checkit:=true; beepend:=false;
end;
procedure qscan(var quit:boolean; tf:boolean);
var cn:integer; i:astr;
begin
iscan;
i:='#'+cstr(board);
cn:=1; nl;
cl(3);
print('[:New-scan '+boards[board].name+' '+i+' - '+cstr(tnum)+' msgs:]');
if (tnum<>0) then begin
if not tf then tf:=boardacpw(board);
if tf then begin
while (not greater(mary[cn].message)) and (cn<tnum) do
cn:=cn+1;
if greater(mary[cn].message) then scan2(cn,rm,quit) else quit:=false;
end;
end;
cl(4); print('[:'+boards[board].name+' New-scan done:]');
savebase;
end;
procedure bulletins;
var filv:Text; i:astr;
begin
nl;
assign(filv,systat.gfilepath+'bulletin.msg');
{$I-} reset(filv); {$I+}
if ioresult<>0 then print('There are no bulletins today.') else
begin
close(filv);
printf(systat.gfilepath+'bulletin');
repeat
prt('Enter Bulletin Selection (#,?,Q=Quit) : ');
input(i,3); if i='' then i:='Q';
if i='?' then printf(systat.gfilepath+'bulletin');
if (i<>'Q') and (i<>'?') then printf(systat.gfilepath+'bullet'+i);
until (i='Q') or (hangup);
end;
end;
procedure nscan;
var quit:boolean;
begin
nl;
ynq('Global new-scan? ');
if yn then begin
nl; cl(5); print(')[ New-scan All ](');
board:=1; quit:=false;
while (board<=numboards) and (not quit) and (not hangup) do begin
if (thisuser.qscn[board]) and not (boards[board].key='%') then
if boardac(board) then qscan(quit,false);
board:=board+1;
end;
nl; cl(5); print(')[ Global New-scan Done ]('); nl;
board:=1;
end else qscan(next,true);
end;
END.