home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Jason Aller Floppy Collection
/
153.img
/
TELES.ZIP
/
UNIT0.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-07-24
|
33KB
|
1,006 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 Unit0;
Interface
Uses
Crt,
Dos,
Common,
Qwik;
procedure star;
procedure tcenter(i:astr);
procedure ansig(x:integer; y:integer);
procedure ansic(c:integer);
procedure savebase;
procedure updateuser;
procedure beephim;
function mln(i:astr; l:integer):astr;
procedure inu(var i:integer);
procedure ini(var i:byte);
procedure movemsg(var cn:integer);
function mn(i,l:integer):astr;
procedure titles(var cn:integer);
function forwardm(n:integer):integer;
procedure imail(i:integer);
procedure autoreply;
procedure email(touser:integer; xx:boolean);
procedure deletem(ntd:integer);
procedure readm(cn:integer; var next:boolean; var unvali:boolean);
function tnum:integer;
procedure iscan;
procedure inmsg(var mrec:messages;an:anontyp;var title:astr;tr,mp:boolean);
function filename(mrec:messages):astr;
procedure printfile1(fn:astr; var abort:boolean);
procedure wfcmenu;
procedure mmkey(var i:astr);
function greater(mrec:messages):boolean;
function maxage(x:integer):integer;
function boardacpw(nb:integer):boolean;
function boardac(nb:integer):boolean;
procedure isr(uname:astr;usernum:integer);
function ctp(t,b:integer):astr;
procedure inli(var i:astr);
procedure readmsg(mrec:messages;rname:boolean; var next:boolean);
Implementation
var
msgval:boolean;
procedure star;
begin
textbackground(0);
tc(9);write('■ ');tc(11);
end;
procedure tcenter(i:astr);
var p,x,y:integer;
begin
p:=40-(length(i) div 2);
x:=wherex; y:=wherey;
x:=p;
gotoxy(x,y);
writeln(i);
end;
procedure ansig(x:integer; y:integer);
begin
pr1(#27+'['+cstr(y)+';'+cstr(x)+'H');
gotoxy(x,y);
end;
procedure ansic(c:integer);
begin
cl(c);
end;
procedure savebase;
var f:file;
begin
if (bread>0) and bchanged then begin
assign(f,systat.gfilepath+''+boards[bread].filename+'.BRD');
reset(f,sizeof(messagerec));
blockwrite(f,mary[0],mary[0].message.number+1);
truncate(f);
close(f);
bchanged:=false;
end;
end;
procedure updateuser;
var s:astr;
begin
repeat
nl;
print('Enter your city & state seperated by a comma');
prompt(':');
inputl(thisuser.citystate,26);
until (pos(',',thisuser.citystate)<>0) or (hangup);
repeat
print('Enter your mailing address: <House number> <Street> [APT#]');
prt(':');mpl(30);inputl(thisuser.street,30);
until (thisuser.street<>'') or (hangup);
repeat
print('Enter your zipcode (9 digit if available)');
print(' ##### or #####-####');
prt(':');mpl(10);input(thisuser.zipcode,10);
until (thisuser.zipcode<>'') or (hangup);
repeat
print('Enter your occupation:');
prt(':');mpl(40);inputl(thisuser.occupation,40);
until (thisuser.occupation<>'') or (hangup);
repeat
print('Where did you hear about this BBS?');
prt(':');mpl(40);inputl(thisuser.wherebbs,40);
until (thisuser.wherebbs<>'') or (hangup);
end;
procedure beephim;
var rl,rl1:real; ch:char;
begin
beepend:=false;
rl:=timer;
repeat
sound(900);delay(20);sound(500);delay(20);sound(200);delay(20);nosound;
rl1:=timer;
while (abs(rl1-timer)<0.9) and (not keypressed) do;
until (abs(rl-timer)>30.0) or keypressed;
end;
function mln(i:astr; l:integer):astr;
begin
while length(i)<l do i:=i+' ';
mln:=i;
end;
procedure inu(var i:integer);
var s:astr;
begin
input(s,5); i:=value(s);
end;
procedure ini(var i:byte);
var s:astr;
begin
input(s,3); i:=value(s);
end;
procedure movemsg(var cn:integer);
var mr:messagerec; i:astr; c1,c2,c3,ob:integer; done:boolean;
begin
nl; nl; if (cn>0) and (cn<=tnum) then begin
print('Move message'); c1:=0; done:=false;
repeat
prt('To which board (1-'+cstr(numboards)+') ?=list, Q=Quit :');
input(i,3);
if (i='') or (i='Q') then done:=true;
if i='?' then begin
nl;
for c2:=1 to numboards do begin
cl(3);prompt(cstr(c2));cl(4);prompt(': ');cl(1);
print(boards[c2].name);
end;
nl;
end;
c1:=value(i);
if (c1>0) and (c1<=numboards) then done:=true;
until done or hangup;
if (c1>0) and (c1<=numboards) then begin
mr:=mary[cn];
mary[0].message.number:=tnum-1;
for c2:=cn+1 to tnum+1 do
mary[c2-1]:=mary[c2];
bchanged:=true;
savebase;
ob:=board;
board:=c1;
iscan;
if tnum>=boards[board].maxmsgs then deletem(1);
mary[0].message.number:=tnum+1;
mary[tnum]:=mr;
bchanged:=true;
savebase;
board:=ob;
iscan;
if cn>tnum then cn:=tnum;
print('Moved.');
end;
end;
end;
function mn(i,l:integer):astr;
begin
mn:=mln(cstr(i),l);
end;
procedure titles(var cn:integer);
var abort,next:boolean; nl:integer; i:astr;
begin
nl:=0;
abort:=false;
while (not hangup) and (not abort) and (nl<10) and (cn<=tnum) do begin
if mary[cn].owner=usernum then i:='['+cstr(cn)+']' else
i:='('+cstr(cn)+')';
while length(i)<8 do i:=' '+i; i:=i+' '+mary[cn].title;
if greater(mary[cn].message) then i[1]:='*';
if mary[cn].messagestat<>validated then if lcs
then begin
i[1]:='N'; i[2]:='V';
end else
i:=copy(i,1,9)+'<<< NOT VALIDATED YET >>>';
printacr(i,abort,next);
nl:=nl+1;cn:=cn+1;
end;
cn:=cn-1;
end;
function forwardm(n:integer):integer;
var chk:array[1..maxusers] of boolean; cur:integer; u:userrec; done:boolean;
begin
for cur:=1 to maxusers do chk[cur]:=false;
cur:=n; done:=false;
while not done do
if chk[cur] then begin
done:=true;
cur:=0;
end else
if (cur<filesize(uf)) and (cur>0) then begin
seek(uf,cur); read(uf,u);
if u.deleted then begin
done:=true;
cur:=0;
end else begin
if u.forusr=0 then begin
done:=true;
if ((nomail in u.option) and not cs) or ((n=1) and (u.waiting>50))
or ((n<>1) and (u.waiting>15)) or ((cur=usernum) and not so) then
cur:=0;
end else begin
chk[cur]:=true;
cur:=u.forusr;
end;
end;
end else begin
done:=true;
cur:=0;
end;
forwardm:=cur;
end;
procedure email(touser:integer; xx:boolean);
var mr:mailrec; t,e,cp:integer; f:messages; a:anontyp; i:astr; us:userrec; ok:boolean;
procedure nope(i:astr);
begin
if ok then print(i);
ok:=false;
end;
begin
ok:=not xx;
reset(uf);
if (touser>0) and (touser<filesize(uf)) then begin
seek(uf,touser); read(uf,user); close(uf);
if ((remail in thisuser.ac) or (thisuser.sl<=10)) and (user.sl<>255) then
nope('Your access privledges don''t include sending mail.');
if (etoday>=seclev[thisuser.sl].emails) and (thisuser.sl<55) and (user.sl<>255) then
nope('Too much E-mail sent today.');
if (user.sl=255) and (ftoday>=5) and (not so) then
nope('Too much feedback sent today.');
if (touser=usernum) and (not so) then
nope('Can''t E-mail yourself');
if (((user.sl=255) and (user.waiting>50)) or ((user.sl<>255) and
(user.waiting>15))) and (not so) then
nope('Mailbox full.');
if (nomail in user.option) and (not cs) then
nope('Mailbox closed.');
if user.deleted then
nope('Deleted user.');
if xx then ok:=true;
if ok then begin
a:=no; if sanm in seclev[thisuser.sl].anst then a:=yes;
inmsg(f,a,i,false,false);
if f.ext<>0 then begin
{$I-} reset(mailfile); {$I+}
if (ioresult<>0) then
rewrite(mailfile);
e:=filesize(mailfile);
if e=0 then cp:=0 else begin
cp:=-1; t:=e-1;
seek(mailfile,t); read(mailfile,mr);
while (t>0) and (mr.destin=-1) do begin
t:=t-1; seek(mailfile,t); read(mailfile,mr);
end;
cp:=t+1;
end;
seek(mailfile,cp);
mr.msg:=f; if lan then mr.from:=-usernum else mr.from:=usernum;
mr.destin:=touser;
mr.title:=i; mr.date:=daynum(date);
mr.mage:=maxage(thisuser.sl);
write(mailfile,mr);
if touser=1 then begin thisuser.feedback:=thisuser.feedback+1;
ftoday:=ftoday+1; fw:=fw+1; end else begin thisuser.emailsent:=
thisuser.emailsent+1; etoday:=etoday+1; end;
close(mailfile); reset(uf); seek(uf,touser); read(uf,user);
user.waiting:=user.waiting+1; seek(uf,touser); write(uf,user);
if touser=usernum then thisuser.waiting:=thisuser.waiting+1;
i:=user.name+' #'+cstr(touser);
close(uf); topscr;
if useron then sysoplog('Mail sent to '+i);
print('Mail sent to '+i);
end;
end;
end;
end;
procedure imail(i:integer);
var user:userrec; ori:integer;
begin
ori:=i;
if i>0 then begin
reset(uf); seek(uf,i); read(uf,user);
if user.deleted then begin
print('That user is deleted.');
close(uf);
end else begin
if user.forusr<>0 then begin
i:=forwardm(i);
if i>0 then begin
seek(uf,i); read(uf,user); close(uf);
print('That user is forwarding his mail to '+user.name+'.');
ynq('Confirm Email ['+user.name+' #'+cstr(i)+'] ? ');
if yn then
if ori=1 then
email(i,true)
else
email(i,false);
end else begin
print('Can''t E-mail that user.');
close(uf);
end;
end else begin
close(uf);
ynq('Confirm E-mail ['+user.name+' #'+cstr(i)+'] ? ');
if yn then email(i,false);
end;
end;
end;
end;
procedure autoreply;
var i:integer; c:char;
begin
if lastname='' then print('Can''t Auto-reply now.') else begin
i:=length(lastname);
while (lastname[i]<>'#') and (i>1) do i:=i-1;
i:=value(copy(lastname,i+1,5));
if i=0 then print('It seems I can''t do that now.') else imail(i);
end;
end;
procedure deletem(ntd:integer);
var filvar:file; t:integer;
begin
assign(filvar,filename(mary[ntd].message));
{$I-} erase(filvar); {$I+} t:=ioresult;
for t:=ntd+1 to tnum do begin
mary[t-1]:=mary[t];
end;
mary[0].message.number:=tnum-1;
bchanged:=true;
end;
procedure readm(cn:integer; var next:boolean; var unvali:boolean);
var i:astr; ratall,rname:boolean; x:integer; s:astr;
begin
nl;nl;
ratall:=true; next:=false;unvali:=false; msgval:=true;
if mary[cn].messagestat<>validated then begin unvali:=true; msgval:=false; end;
(* if mary[cn].messagestat<>validated then begin unvali:=true;
msgval:=false;
if systat.clearmsg then cls;
prompt(' Title: '); cl(3); prompt(mary[cn].title);
for i:=1 to (31-length(mary[cn].title)) do prompt(' ');
cl(0); print('Msg# '+cstr(cn)+' of '+cstr(tnum));
{I:=cstr(cn)+'/'+cstr(tnum);while length(I)<7 do I:=I+' ';I:=I+':';
prompt(i);cl(8);print(' <[ Not Validated ]>');}
lastname:='';
if not lcs then ratall:=false;
end; *)
if ratall then begin
if systat.clearmsg then cls;
prompt(' Title: '); cl(3); prompt(mary[cn].title);
for x:=1 to (31-length(mary[cn].title)) do prompt(' ');
cl(1); print('Msg# '+cstr(cn)+' of '+cstr(tnum));
{I:=cstr(cn)+'/'+cstr(tnum);while length(I)<7 do I:=I+' ';I:=I+':';
prompt(I);cl(3);print(' '+mary[cn].title);}
irt:=mary[cn].title;
if postn in seclev[thisuser.sl].anst then rname:=true else rname:=false;
readmsg(mary[cn].message,rname,next); tleft;
if greater(mary[cn].message) then thisuser.qscan[board]:=mary[cn].message;
end;
end;
function tnum:integer;
begin
tnum:=mary[0].message.number;
end;
procedure iscan;
var f:file; n:integer;
begin
if bread<>board then begin
assign(f,systat.gfilepath+boards[board].filename+'.BRD');
{$I-} reset(f,sizeof(messagerec)); {$I+}
if (ioresult=0) then begin
blockread(f,mary[0],1);
blockread(f,mary[1],mary[0].message.number);
end else begin
rewrite(f);
mary[0].message.number:=0;
blockwrite(f,mary[0],1);
end;
close(f);
bread:=board;
bchanged:=false;
end;
end;
procedure inmsg(var mrec:messages;an:anontyp;var title:astr;tr,mp:boolean);
var li:array[1..120] of astr; t1,t,maxli,lc:integer; filler,spc,ti,i:astr;
saveline,exit,save,abortit,ab,nx:boolean; c:char; filvar:text;
procedure ptl;
begin
if systat.clearmsg then cls else nl;
prt('Title: '); mpl(30); inputl(title,30);
end;
procedure listit(linenum:boolean);
var l:integer; abort,next:boolean;
begin
l:=1;
abort:=false;
while (l<>lc) and (not abort) do begin
if linenum then print(cstr(l)+':');
printa(li[l],abort,next);
if (pap<>0) AND (NOFEED=FALSE) then nl;
l:=l+1;
end;
cl(3);prompt('-=> ');cl(4);prompt('Total lines: [');cl(2);prompt(cstr(lc-1));cl(4);print(']');
saveline:=false;
end;
procedure rpl(var i1:astr; i2:astr);
var c1,c2:integer; i3:astr;
begin
if i2[1]='/' then delete(i2,1,1);
if i2[length(i2)]=#1 then i2:=copy(i2,1,length(i2)-1);
if i2[length(i2)]='/' then i2:=copy(i2,1,length(i2)-1);
c1:=pos('/',i2); i3:=copy(i2,1,c1-1);
delete(i2,1,c1);
if i2[length(i2)]='/' then i2:=copy(i2,1,length(i2)-1);
c2:=pos(i3,i1);
if (length(i1)-length(i3)+length(i2))>(thisuser.linelen+10) then
print('Line would be too long')
else
if c2>0 then begin
delete(i1,c2,length(i3));
insert(i2,i1,c2);
end;
end;
var ii:integer; filv:text; s:astr;
begin
if freek(0)>10 then begin
lc:=1;spc:=' ';
filler:='-------------------------------------------------------------------------------';
ll:=''; maxli:=systat.maxlines;
if tr then ptl else ptl;
end else begin
title:=''; tr:=true;
print('Not enough disk space');sysoplog('Hard DISK FULL - Not enough space to save message');
end;
if (title<>'') or not tr then begin
nl;nl;
prompt('Enter message now. You may have ');cl(3);prompt(cstr(maxli));cl(1);print(' lines maximum.');
prompt('Enter "');cl(0);prompt('/H');cl(1);
print('" for help with commands. "/S" to save your message.');
cl(3);if (okansi) then
print(copy('[───:────:────:────:────:────:────:────]────:────:────:────:────:────:────:────]',
1,thisuser.linelen)) else
print(copy('[---=----=----=----=----=----=----=----]----=----=----=----=----=----=----=----]',
1,thisuser.linelen));
repeat
repeat
saveline:=true; exit:=false; save:=false; abortit:=false;
inli(i);
if (i[1]=^J) and (i[2]='/') then i:=copy(i,2,length(i));
ti:=copy(i,1,3); if ti[length(ti)]=#1 then ti:=copy(ti,1,length(ti)-1);
ti[1]:=upcase(ti[1]); ti[2]:=upcase(ti[2]); ti[3]:=upcase(ti[3]);
if ((ti='/RL') or (ti='/R')) and (lc>1) then begin print('Replace:'); saveline:=false; lc:=lc-1; end;
if (ti='/EX') or (ti='/E') then begin exit:=true; saveline:=false; end;
if (ti='/ES') or (ti='/S') then begin exit:=true; save:=true; saveline:=false; end;
if ti='/C:' then begin
i:=copy(i,4,length(i)-3);
if i[length(i)]<>#1 then i:=i+#1;
i:=#2+i;
end;
if (ti='/T:') and (maxli-lc>2) then begin
i:=copy(i,4,length(i)-3);
if i[length(i)]=#1 then i:=copy(i,1,length(i)-1);
li[lc]:=#2+#3+#3+'.-'+copy(filler,1,length(i))+'-.'+#1;
li[lc+1]:=#2+#3+#3+'| '+#3+#0+i+#3+#3+' |'+#1;
li[lc+2]:=#2+#3+#3+'`-'+copy(filler,1,length(i))+'-''';
saveline:=false; lc:=lc+3;
end;
(* if (ti='/UL') and (so) then begin
print('Enter file name to upload: ');mpl(40);inputl(s,40);
assign(filv,s);
{$I-} reset(filv); {$I+}
if ioresult<>0 then print('File not found.') else
while not eof(filv) do begin
readln(filv,n);
dm(' '+n,c);
end;
close(filv);
end; *)
if (ti='/AB') or (ti='/A') then begin
exit:=true; abortit:=true; saveline:=false; end;
if (ti='/CL') or (ti='/C') then begin
saveline:=false; lc:=1;
print('Message cleared.... Start over...');
end;
if ((ti='/SU') or (ti='/ED')) and (lc>1) then begin
prt('Replace string on what line (1-'+cstr(lc-1)+') ? ');
input(i,4); if (value(i)>0) and (value(i)<lc) then begin
print('Enter replacement string (format: StringtoReplace/NewString)');
prt(':'); inputl(s,74);
{rpl(li[lc-1],copy(i,4,80));}
rpl(li[value(i)],s);
print('Edited line: '); ab:=false;
printacr(li[value(i)],ab,nx);
end;
saveline:=false;
end;
if (ti='/HE') or (ti='/H') or (ti='/?')
then begin printf(systat.gfilepath+'prhelp'); saveline:=false; end;
if ti='/CO' then begin saveline:=false; printf(systat.gfilepath+'color'); end;
if (ti='/LI') or (ti='/L') then begin
ynq('With line numbers? '); if yn then listit(true) else listit(false);
end;
if saveline then begin li[lc]:=i; lc:=lc+1; if lc>maxli then begin
print('You have used up your maxium amount of lines.');
exit:=true;
end;
end;
until exit or hangup;
if hangup then abortit:=true;
if (not abortit) and (not save) then
repeat
prt('Message Editor Command - [S,L,A,C,R,I,D,T,U,?] : '); CL(5);
ONEK(c,'SULACRIDT?');
case c of
'L':begin prompt('With line numbers? '); if yn then listit(true) else listit(false); end;
'T':ptl;
'D':begin
prompt('Line number to delete (1-'+cstr(lc-1)+')? ');
input(i,4);t:=value(i); if (t>0) and (t<lc) then begin
for t1:=t to lc-2 do li[t1]:=li[t1+1]; lc:=lc-1;
end;
end;
'R':begin
prompt('Line number to replace (1-'+cstr(lc-1)+')? ');
input(i,4);t:=value(i); if (t>0) and (t<lc) then begin
print('Old line:'); ab:=false; printa(li[t],ab,nx);
print('Enter new line:'); inli(i);
if (li[t][length(li[t])]=#1) and (i[length(i)]<>#1) then
li[t]:=i+#1 else li[t]:=i;
end;
end;
'U':begin
prompt('Line number to update (1-'+cstr(lc-1)+')? ');
input(i,4);t:=value(i); if (t>0) and (t<lc) then begin
nl; ab:=false; printa(li[t],ab,nx); nl; print('Format: oldstr/newstr');
prompt('Update: '); inputl(i,70); rpl(li[t],i);
nl; ab:=false; printa(li[t],ab,nx); nl; nl;
end;
end;
'I':if (lc<maxli) then begin
prompt('Line number to insert before (1-'+cstr(lc-1)+')? ');
input(i,4); t:=value(i); if (t>0) and (t<lc) then begin
for t1:=lc downto t+1 do li[t1]:=li[t1-1]; lc:=lc+1;
print('New line:'); inli(li[t]);
end;
end;
'A':begin
prompt('Abort? ');
if yn then abortit:=true else c:=' ';
end;
'S':save:=true;
'C':if lc>maxli then begin print('Too long.'); c:=' '; end else
print('Continue...');
'?':printf(systat.gfilepath+'editor');
end;
until (c='S') or (c='A') or (c='C') or hangup;
until abortit or save or hangup;
if lc=1 then begin abortit:=true; save:=false; end;
if save then begin
case an of
no : ti:=nam;
forced : if so then ti:='!'+nam else ti:='@'+nam;
yes : begin
ynq('Anonymous? '); CL(1);
if yn then
if so then
ti:='!'+nam
else
ti:='@'+nam
else
ti:=nam;
end;
dearabby: begin
nl;print('Post as:'); print('1. Abby');
print('2. Problemed Person'); print('3. '+nam);
nl;prompt('Which? '); onek(c,'123N'+#13);
case c of
'1' : ti:='+'+nam;
'2' : ti:='-'+nam;
'3',#13,'N': ti:=nam;
end;
end;
end;
if ti=nam then lan:=false else lan:=true;
prompt('Saving...');
while (lc>1) and ((li[lc-1]='') or (li[lc-1]=chr(10))) do lc:=lc-1;
mrec:=systat.hmsg; mrec.number:=mrec.number+1; if mrec.number=-32767 then
mrec.ltr:=succ(mrec.ltr);
if mrec.ltr>'Z' then begin
mrec.ltr:='A';
mrec.ext:=mrec.ext+1;
if mrec.ext>=128 then mrec.ext:=1;
end;
systat.hmsg:=mrec;
if mp then mrec.ext:=mrec.ext+128;
i:=filename(mrec);
assign(filvar,i);
rewrite(filvar);
writeln(filvar,ti); ti:=dat; writeln(filvar,ti);
if irt<>'' then begin
writeln(filvar,' RE: '+#3+#9+irt+#3+#1);
writeln(filvar); writeln(filvar); writeln(filvar);
end;
for t:=1 to lc-1 do
writeln(filvar,li[t]);
close(filvar); savesystat;
cl(5); for t:=1 to 9 do begin prompt('<'); delay(20); prompt(#8+' '+#8+#8); end;
cl(9);
end else begin print('Aborted.'); mrec.ext:=0; end;
end else begin print('Aborted.'); mrec.ext:=0; end;
end;
function filename(mrec:messages):astr;
begin
filename:=systat.msgpath+mrec.ltr+cstr(mrec.number)+'.'+cstr(mrec.ext);
end;
procedure printfile1(fn:astr; var abort:boolean);
begin
pfl(fn,abort,false);
end;
procedure wfcmenu;
VAR I:INTEGER;
begin
clrscr; tc(1); (* Dark Blue *)
gotoxy(1,1); write(' ─────────────────');
gotoxy(59,1); write(' ────────────────');
gotoxy(1,2); write('────────────────────');
gotoxy(59,2); write(' ────────────────────');
gotoxy(1,3); write(' ─────────────────');
gotoxy(59,3); write(' ────────────────');
if systat.special then for i:=22 downto 0 do begin
TC(14);
gotoxy(22,1+i);
write('┌─┬─┐ ┌── ┬ ┌── ┌──┐ ┌──┐ ┬──┐ ┬──┐');
tc(12);
gotoxy(22,2+i); write(' │ ├─ │ ├─ │ ┬ ├──┤ ├─┬┘ │ │');
tc(4);
gotoxy(22,3+i); write(' ┴ └── └── └── └──┘ ┴ ┴ ┴ └┘ ┴──┘');
gotoxy(22,4+i); clreol;
end else
begin
TC(14);
gotoxy(22,1);
write('┌─┬─┐ ┌── ┬ ┌── ┌──┐ ┌──┐ ┬──┐ ┬──┐');
tc(12);
gotoxy(22,2); write(' │ ├─ │ ├─ │ ┬ ├──┤ ├─┬┘ │ │');
tc(4);
gotoxy(22,3); write(' ┴ └── └── └── └──┘ ┴ ┴ ┴ └┘ ┴──┘');
gotoxy(22,4); clreol;
end;
tc(10);
gotoxy(13,5); writeln('Telegard BBS System, By Carl Mueller and Jeff Randolph');
gotoxy(33,7); textcolor(14); write('- WFC Commands -');
WRITELN;textcolor(15);
writeln(' >Log-on system A>nswer phone B>oard edit />Short Log');
writeln(' F>ile Board Edit E>dit a text file D>Drop to DOS #>Menu Edit');
writeln(' I>nit Votes L>og of today M>ail read P>Setup config');
writeln(' Q>uit to DOS R>ead feeback X>Init modem T>erminal');
writeln(' U>ser editor Y>esterday''s log Z>log report =>External Utl');
textcolor(14);
writeln(' - System Status -');textcolor(3);
TEXTCOLOR(15);
writeln(' Time : Disk space : Comm port :');
writeln(' Date : Files waiting: # of users:');
writeln(' Total calls: New user''s pw: Max baud :');
writeln(' Board : Sysop status : Hours :');
TEXTCOLOR(14);writeln(' - Today''s Status -');TEXTCOLOR(15);
writeln(' Activity : # of posts : Email sent:');
writeln(' Calls : Uploads : Feedback :');
{writeln(' Last Caller:');}
textcolor(11);gotoxy(16,16);write(cstr(systat.callernum));gotoxy(16,17);
if systat.closedsystem then write('Closed') else write('Open');
gotoxy(41,14);write(cstr(freek(0))+'k');gotoxy(41,15);write(cstr(fw));
Gotoxy(41,16);if systat.boardpw='' then write('None') else
write(systat.boardpw);gotoxy(62,14);write(systat.comport);gotoxy(62,15);
write(cstr(systat.users));gotoxy(62,16);write(systat.maxbaud);gotoxy(62,17);
if systat.lowtime=systat.hitime then write('None') else
write(tch(cstr(systat.lowtime div 60))+':'+tch(cstr(systat.lowtime mod 60))+' to '+
tch(cstr(systat.hitime div 60))+':'+tch(cstr(systat.hitime mod 60)));
gotoxy(18,19);write(cstr(systat.activetoday));gotoxy(18,20);write(cstr(systat.callstoday));
gotoxy(43,19);write(cstr(systat.msgposttoday));gotoxy(43,20);write(cstr(systat.uptoday));
gotoxy(64,19);write(cstr(systat.emailtoday));gotoxy(64,20);write(cstr(systat.fbacktoday));
{ gotoxy(18,21);write(lastcaller);}
textcolor(3);
end;
procedure mmkey(var i:astr);
var c:char;
begin
repeat
repeat
getkey(c);
until (((c>=' ') and (c<chr(127))) or (c=chr(13))) or hangup;
c:=upcase(c);
outkey(c);
thisline:=thisline+c;
if (c='/') or (c='1') then begin
i:=c;
repeat
getkey(c);
until ((c>=' ')and(c<=chr(127))) or (c=chr(13)) or (c=chr(8)) or hangup;
c:=upcase(c);
if c<>chr(13) then begin outkey(c); thisline:=thisline+c; end;
if (c=chr(8)) or (c=chr(127)) then prompt(' '+c);
if c='/' then begin cl(6); input(i,50); end else if c<>chr(13) then i:=i+c;
end else i:=c;
until (c<>chr(8)) and (c<>chr(127)) or hangup;
nl;
end;
function greater(mrec:messages):boolean;
begin
if mrec.ext>thisuser.qscan[board].ext then greater:=true else
if mrec.ltr>thisuser.qscan[board].ltr then greater:=true else
if (mrec.ltr=thisuser.qscan[board].ltr) and (mrec.number>thisuser.qscan[board].number) then
greater:=true
else greater:=false;
end;
function maxage(x:integer):integer;
begin
maxage:=255;
if x<20 then
maxage:=5
else if x<30 then
maxage:=14
else if x<40 then
maxage:=90
else if x<60 then
maxage:=120;
end;
function boardacpw(nb:integer):boolean;
var i:astr;
begin
boardacpw:=false;
if (thisuser.sl>=boards[nb].sl) and
((boards[nb].ar='@') or (boards[nb].ar in thisuser.ar)) then
if boards[nb].pw='' then boardacpw:=true else begin
prt('Password? '); mpl(10); input(i,10);
if i=boards[nb].pw then boardacpw:=true else print('Wrong.');
end;
end;
function boardac(nb:integer):boolean;
begin
boardac:=false;
if (thisuser.sl>=boards[nb].sl) and
((boards[nb].ar='@') or (boards[nb].ar in thisuser.ar)) then boardac:=true;
end;
procedure isr(uname:astr;usernum:integer);
var t,i,ii:integer; sr:smalrec;
begin
ii:=systat.users; i:=0;
while (ii-i)>1 do begin
t:=(ii+i) div 2;
if uname<srl[t].name then
ii:=t
else
i:=t;
end;
if srl[ii].name<uname then i:=ii;
for ii:=systat.users downto i+1 do
srl[ii+1]:=srl[ii];
sr.name:=uname; sr.number:=usernum;
srl[i+1]:=sr;
systat.users:=systat.users+1;
savesystat;
rewrite(sf); for ii:=0 to systat.users do write(sf,srl[ii]); close(sf);
end;
function ctp(t,b:integer):astr;
var i,i1:astr; n:real;
begin
i:=cstr((t*100) div b); if length(i)=1 then i:=' '+i; i:=i+'.';
if length(i)=3 then i:=' '+i;
n:=t/b+0.0005;
i1:=cstr(trunc(n*1000) mod 10);
ctp:=i+i1+'%';
end;
procedure inli(var i:astr);
var cp,rp:integer; c,c1:char; cv,cc:integer; escp:boolean;
procedure bkspc;
begin
if cp>1 then begin
if (i[cp-2]=#3) and (i[cp-1] in [#0..#9]) then begin
cp:=cp-1;
CL(1);
end else
if i[cp-1]=#8 then begin
prompt(' ');
rp:=rp+1;
end else
if i[cp-1]<>#10 then begin
prompt(#8+' '+#8);
rp:=rp-1;
end;
cp:=cp-1;
end;
end;
var ccc,d:char;
begin
write_msg:=true;
ccc:='1';
escp:=false;
rp:=1; cp:=1;
i:='';
if ll<>'' then begin prompt(ll); i:=ll; ll:=''; cp:=length(i)+1; rp:=cp;end;
repeat
getkey(c);
case ord(c) of
32..255:if (cp<strlen) and (rp<thisuser.linelen) then begin
i[cp]:=c; cp:=cp+1; rp:=rp+1; outansi(c); thisline:=thisline+c;
end;
27:if (cp<strlen) and (rp<thisuser.linelen) then begin
escp:=true; i[cp]:=c; cp:=cp+1; rp:=rp+1; outansi(c); thisline:=thisline+c;
end;
8:bkspc;
2:dm(' -'+#14+'/'+#14+'l'+#14+'\'+#14,c);
19:dm(' '+nam+' ',c);
24:begin
cp:=1; for cv:=1 to rp-1 do prompt(#8+' '+#8);
rp:=1;
if ccc<>'1' then begin
c1:=ccc;
i[cp]:=#3;
cp:=cp+1;
i[cp]:=chr(ord(c1)-ord('0'));
cp:=cp+1;
CL(ord(i[cp-1]));
end;
end;
23:if cp>1 then repeat
bkspc;
until (cp=1) or (i[cp]=' ') or ((i[cp]=chr(8)) and (i[cp-1]<>#3));
14:if (not (rbackspace in thisuser.ac)) then begin
prompt(chr(8)); i[cp]:=chr(8); cp:=cp+1; rp:=rp-1;
end;
10:if (not (rbackspace in thisuser.ac)) then begin
prompt(c); i[cp]:=c; cp:=cp+1;
end;
16:if okansi and (cp<strlen-1) then begin
getkey(c1);
if c1 in ['0'..'9'] then begin
ccc:=c1;
i[cp]:=#3;
cp:=cp+1;
i[cp]:=chr(ord(c1)-ord('0'));
cp:=cp+1;
CL(ord(i[cp-1]));
end;
end;
9:begin
cv:=5-(cp mod 5); if (cp+cv<strlen) and (rp+cv<thisuser.linelen) then
for cc:=1 to cv do begin
rp:=rp+1; prompt(' ');
i[cp]:=' '; cp:=cp+1;
end;
end;
end;
until (c=chr(13)) or ((rp=(thisuser.linelen)) or (cp=strlen) and (wordwrap in thisuser.defaults)) or hangup;
i[0]:=chr(cp-1);
if (c<>chr(13)) and (cp<>strlen) and (escp=false) then begin
cv:=cp-1;
while (cv>1) and (i[cv]<>' ') and ((i[cv]<>chr(8)) or (i[cv-1]=#3)) do
cv:=cv-1;
if (cv>(rp div 2)) and (cv<>cp-1) then begin
ll:=copy(i,cv+1,cp-cv); for cc:=cp-2 downto cv do prompt(chr(8));
for cc:=cp-2 downto cv do prompt(' ');
i[0]:=chr(cv-1);
end;
end;
if (escp) and (rp=thisuser.linelen) then cp:=strlen;
if cp<>strlen then nl;
if cp=strlen then begin rp:=1; cp:=1; i:=i+chr(29); end;
if c=chr(13) then begin
if (rp=(thisuser.linelen)) then i:=i+chr(29) else i:=i+chr(1);
if (escp=true) and (i[length(i)]<>#1) then i[length(i)+1]:=#1;
{false}
end;
write_msg:=false;
end;
procedure readmsg(mrec:messages;rname:boolean; var next:boolean);
var f,n,rn,d:astr; filvar:text; abort:boolean; kkk:boolean;s:astr; i:integer;
begin
kkk:=false;
lastname:=''; next:=false;
f:=filename(mrec); rn:='';
if (wantfilename) and (cs) and (not hangup) then begin
prompt(' File: ');cl(5);print(f);end;
assign(filvar,f); {$I-} reset(filvar); {$I+}
if ioresult<>0 then begin cl(5);print(#7+'--> Message not available'); kkk:=true;
end else
if (not hangup) then begin
readln(filvar,n);
readln(filvar,d); lastname:=n;
if ((n[1]='@') and rname) or ((n[1]='!') and so) then
n:=copy(n,2,length(n)-1)+' (Anon)'
else
if (n[1] in ['!','@']) then
begin
lastname:='';
n:='Anonymous'; d:='In-Active';
end;
if (N[1]='+') or (n[1]='-') then begin
rn:=copy(n,2,length(n)-1);
if n[1]='+' then n:='Abby' else n:='Problemed Person';
if not rname then begin d:='?'; rn:=''; lastname:=''; end;
end;
abort:=false;
s:=' By: '+#3+#5+n;
for i:=1 to (31-length(n)) do s:=s+' ';
s:=s+#3+#1+'Status: '+#3+#3; if not readingmail then if msgval=true then s:=s+'Public' else s:=s+'Unvalidated' else
s:=s+'Private';
printacr(s,abort,next); if not abort then begin
if rn<>'' then BEGIN prompt('Real NN: ');cl(5);print(rn); END;
s:=' Date: '+#3+#5+d;
for i:=1 to (31-length(d)) do s:=s+' ';
if not readingmail then
s:=s+#3+#1+'Board: '+#3+#3+boards[board].name else
s:=s+#3+#1+'Board: '+#3+#3+'E-mail';
printacr(s,abort,next); nl;
{ if okansi then begin
cl(2); s:=' '; for i:=1 to 68 do s:=s+'─';
printacr(s,abort,next);
end; }
if lcs then msgval:=true;
while (not abort) and (not eof(filvar)) and (msgval) do begin
readln(filvar,n);
reading_a_msg:=true;
printa(n,abort,next);
reading_a_msg:=false;
end;
if not abort then nl;
end;
end;
if kkk=false then close(filvar); nl;
end;
end.