home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
OTHERUTI
/
WWIV310S.ZIP
/
PART2.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1986-04-01
|
40KB
|
1,114 lines
overlay function getuser:boolean;
var tries:integer; pasw,phone:str; nu,ok:boolean;
begin
macok:=false; nu:=false;
window(1,5,80,25);
echo:=true;nl;nl;nl;nl;nl;
pasw:='';
printfile('gfiles\welcome.msg');
tries:=0;
repeat
repeat
print('Enter number or name or "NEW"');
prompt('NN: '); finduser(usernum);
if usernum=0 then tries:=tries+1;
until (tries=3) or hangup or (usernum<>0);
if tries=3 then hangup:=true;
ok:=true;
if usernum=-1 then begin
if incom and systat.closedsystem then begin
printfile('gfiles\system.msg');
printfile('gfiles\nonewusr.msg');
if not hangup then delay(5000); pasw:='';
while not empty do pasw:=pasw+inkey;
{ if pasw=#14+#21 then nu:=true else} hangup:=true;
end else
nu:=true;
end else begin
echo:=false; reset(uf); seek(uf,usernum); read(uf,thisuser);
topscr; mcursor;
prompt('PW: '); input(pasw,8);
prompt('PH: ###-###-'); input(phone,4); echo:=true;
if (thisuser.pw<>pasw) or (copy(thisuser.ph,9,4)<>phone) then begin
print(''); print(chr(7)+'ILLEGAL LOGON'+CHR(7)); PRINT('');
if (not hangup) and (usernum<>0) then sl1('### ILLEGAL LOGON USER #'+cstr(usernum));
thisuser.illegal:=thisuser.illegal+1; seek(uf,usernum);
write(uf,thisuser);
OK:=FALSE; tries:=tries+1; if tries=3 then hangup:=true;
end;
if (thisuser.sl=255) and ok and incom then begin echo:=false;
prompt(':'); input(pasw,8); echo:=true; if pasw<>systat.sysoppw then begin
nl;print(chr(7)+'ILLEGAL LOGON'+chr(7)); nl; ok:=false;
sl1('$$$$ ILLEGAL SYSOP SECOND PW $$$$');
end;
end;
close(uf);
end;
until hangup or ok or (tries=3);
if not nu then begin
if (rlogon in thisuser.ac) and (thisuser.laston=date) then begin
print('You can only log on once per day.');
hangup:=true; sl1(thisuser.name+' #'+cstr(usernum)+' tried logging on');
end;
if tries=3 then hangup:=true;
end;
getuser:=nu;
end;
overlay procedure readmail;
var pl,i,i1,mc,x,nmf:integer; c:char; abort,next:boolean; mr:mailrec; a:boolean;
filevar:file; ii,is:str;
begin
nl; helpl:='M';
if thisuser.waiting=0 then print('You have no mail.') else begin
reset(mailfile);pl:=filesize(mailfile);
if thisuser.waiting>1 then begin
reset(uf);nl;
print('Mail summary: :'+cstr(thisuser.waiting)+': pieces:'); mc:=0;
i:=0; i1:=1; while (i<filesize(mailfile)) and not hangup do begin
seek(mailfile,i); read(mailfile,mr); if mr.destin=usernum then
if (mr.from<=0) and not (emailn in seclev[thisuser.sl].anst)
then begin print(cstr(i1)+': >UNKNOWN<'); mc:=mc+1; end else begin
seek(uf,abs(mr.from)); read(uf,user); print(''+cstr(i1)+' :'+user.name+
' #'+cstr(abs(mr.from))); i1:=i1+1; mc:=mc+1;
end;
i:=i+1;
end;
close(uf);nl;nl;
print('Hit <ENTER> to read mail'); input(ii,2);nl;nl;
thisuser.waiting:=mc; if usernum=1 then fw:=mc;
end;
i:=0; nmf:=0;
repeat
abort:=false;
if i<=filesize(mailfile)-1 then begin seek(mailfile,i); read(mailfile,mr); end;
while (i<filesize(mailfile)-1) and (mr.destin<>usernum) do begin
i:=i+1; seek(mailfile,i); read(mailfile,mr);
end;
if (mr.destin=usernum) and (i<=filesize(mailfile)-1) then begin
nmf:=nmf+1;
repeat
a:=false; if emailn in seclev[thisuser.sl].anst then a:=true;
irt:='Your previous letter';
nl; if mr.title<>'' then print('Title: '+mr.title); irt:=mr.title;
if irt='' then irt:='Your previous letter';
readmsg(mr.msg,a,next); next:=false; tleft;
repeat
nl;prompt('Mail: D,I,R,A,? :');
if cs then onek(c,'ZDIRAV?') else onek(c,'DIRA?');
case c of
'I':next:=true;
'?':begin
print('D:elete I:gnore');
print('R:e-read A:uto-reply');
end;
'A','D','Z':begin
if c<>'Z' then ssm(abs(mr.from),nam+' read your letter on '+date);
is:=rmail(i); next:=true; nmf:=nmf-1;
thisuser.waiting:=thisuser.waiting-1;
topscr;
end;
'V':if cs then vallastuser;
end;
if c='A' then begin close(mailfile); autoreply; reset(mailfile); end;
until (C IN ['D','I','R','A','Z']) or hangup;
until next or hangup;
i:=i+1;
end else i:=i+1;
until (i>filesize(mailfile)-1) or hangup;
close(mailfile); if not hangup then thisuser.waiting:=nmf;
end;
end;
overlay procedure vote;
var vdata:file of vdatar; vd:vdatar; int,int2:integer; i,i1,ij:str; abort,next,done,lq:boolean;
procedure vote1(qnum:integer);
var cv,tv,ii:integer; i,i1,i2:str; c:char;
begin
i2:=' '; cls;
seek(vdata,qnum-1); read(vdata,vd);
if vd.numa=0 then print('Inactive question.') else begin
print('Question #'+cstr(qnum)+':');
print(vd.question);
tv:=0; for ii:=1 to vd.numa do tv:=tv+vd.answ[ii].numres;
print('Users voting: '+ctp(tv,systat.users)); if tv=0 then tv:=1;
nl; print('0:No Comment');
ij:='Q0';
for ii:=1 to vd.numa do begin
ij:=ij+cstr(ii);
i1:=copy(vd.answ[ii].ans,1,25);
i1:=i1+copy(i2,1,25-length(i1))+' :';
i:=copy(cstr(vd.answ[ii].numres),1,3);
i1:=i1+copy(i2,1,3-length(i))+i+' '+ctp(vd.answ[ii].numres,tv);
print(cstr(ii)+':'+i1);
end;
nl;nl;
i:='Your vote: '+vd.answ[thisuser.vote[qnum]].ans; print(i);
if not(rvoting in thisuser.ac) and (not hangup) and (thisuser.sl>10) then begin
prompt('Change it? '); if yn then begin
nl;prompt('Which number (0-'+cstr(vd.numa)+') ? '); onek(i[1],ij);
i[0]:=#1; ii:=value(i); if (i<>'') and (ii>=0) and (ii<=vd.numa) then begin
if thisuser.vote[qnum]<>0 then
vd.answ[thisuser.vote[qnum]].numres:=vd.answ[thisuser.vote[qnum]].numres-1;
thisuser.vote[qnum]:=ii;
if ii<>0 then vd.answ[ii].numres:=vd.answ[ii].numres+1;
seek(vdata,qnum-1); write(vdata,vd);
cls; print('Current Standings: '); nl; print(vd.question); nl;
tv:=0; for ii:=1 to vd.numa do tv:=tv+vd.answ[ii].numres;
print('Users voting: '+ctp(tv,systat.users)); nl; if tv=0 then tv:=1;
for ii:=1 to vd.numa do begin
i1:=copy(vd.answ[ii].ans,1,25);
i1:=i1+copy(i2,1,25-length(i1))+' :';
i:=copy(cstr(vd.answ[ii].numres),1,3);
i1:=i1+copy(i2,1,3-length(i))+i+' '+ctp(vd.answ[ii].numres,tv);
print(cstr(ii)+':'+i1);
end;
end;
end;
end;
dump;
end;
end;
begin
i:=''; done:=false; lq:=true; helpl:='V';
assign(vdata,'gfiles\voting.dat');
{$I-} reset(vdata); {$I+}
if ioresult<>0 then print('No voting data found.') else
repeat
done:=false;
ij:='Q?';
abort:=false;
if lq then begin
cls; printacr('Current Questions:',abort,next); nl;
end;
int2:=0;
for int:=1 to 9 do begin
seek(vdata,int-1); read(vdata,vd);
if vd.numa<>0 then begin
int2:=int2+1;
if lq and not abort then begin
if thisuser.vote[int]=0 then i1:='* ' else i1:=' ';
i1:=i1+cstr(int)+': '+vd.question;
printacr(i1,abort,next);
end;
ij:=ij+cstr(int);
end;
end;
lq:=false;
if int2=0 then begin done:=true; print('No voting questions now.') end
else begin
nl; nl; prompt('Which question (#,Q,?) : '); onek(i[1],ij); i[0]:=#1;
int:=value(i); if i='Q' then done:=true; if i='?' then lq:=true;
if (int>0) and (int<10) then vote1(int);
end;
until done or hangup;
close(vdata);
end;
overlay procedure logon;
var fil:file of str; lo:array[1..8] of str; num:integer; i:str; ul:charfil; c:char;
abort:boolean;
begin
realsl:=thisuser.sl; cls;nl;nl;
assign(fil,'gfiles\laston.fil');
reset(fil); for num:=1 to 8 do read(fil,lo[num]); close(fil);
print('Last few callers:');nl;
if cosysop in seclev[thisuser.sl].anst then for num:=1 to 8 do print(lo[num]) else
for num:=5 to 8 do print(lo[num]);
if realsl<>255 then begin
rewrite(fil); for num:=2 to 8 do write(fil,lo[num]);
i:=cstr(systat.callernum)+': '+nam;
write(fil,i); close(fil);
end;
print('You are caller #'+cstr(systat.callernum));
if thisuser.laston=date then thisuser.ontoday:=thisuser.ontoday+1
else thisuser.ontoday:=1;
if systat.lastdate<>date then begin
systat.lastdate:=date;
assign(ul,'gfiles\ysysop.log'); {$I-} erase(ul); {$I+} num:=ioresult; assign(ul,'gfiles\sysop.log');
rename(ul,'gfiles\ysysop.log');append(ul); writeln(ul,'Total Time On = '+
cstr(systat.activetoday)); writeln(ul,'Calls Today: '+cstr(systat.
callstoday)); writeln(ul,'Messages posted today: '+cstr(systat.
msgposttoday)); close(ul); rewrite(sysopf); writeln(sysopf); close(sysopf);
assign(ul,'gfiles\user.log'); rewrite(ul); writeln(ul); close(ul);
with systat do begin
activetoday:=0; callstoday:=0; msgposttoday:=0; emailtoday:=0;
fbacktoday:=0; uptoday:=0;
end;
enddayf:=true;
end;
if (realsl<>255) or incom then begin
append(sysopf);
writeln(sysopf,'');
writeln(sysopf,(cstr(systat.callernum)+': '+nam+' '+time+' '+date+' '+spd+
' - '+cstr(thisuser.ontoday))); close(sysopf);
if realsl<>255 then begin
assign(ul,'gfiles\user.log'); append(ul);
writeln(ul,cstr(systat.callernum)+': '+nam+' '+spd+' - '+cstr(thisuser.ontoday)); close(ul);
systat.callernum:=systat.callernum+1; systat.callstoday:=systat.callstoday+1;
end;
end;
nl;nl; board:=1; expert:=false;
if thisuser.loggedon<2 then expert:=false else expert:=true;
mread:=0; extratime:=0; timeon:=timer; extramsgs:=0;
topscr; dump;
if incom then begin
printfile1('gfiles\logon.msg',abort);
if not abort then begin prompt('(-*-)'); getkey(c); end;
end;
readamsg;
reset(systatf); write(systatf,systat); close(systatf);
nl;nl;print('Name: '+nam);
print('Time allowed on: '+cstr(seclev[thisuser.sl].ttime));
if thisuser.waiting<>0 then print('Mail waiting : '+cstr(thisuser.waiting));
if thisuser.illegal<>0 then print(chr(7)+'Illegal logons : '+cstr(thisuser.illegal));
if thisuser.laston<>date then print('Last on : '+thisuser.laston)
else print('Times on today : '+cstr(thisuser.ontoday));
abort:=false;
for num:=1 to 9 do
if vqu[num] and (thisuser.vote[num]=0) then abort:=true;
if abort then print('You haven''t voted yet.');
nl;nl;mcursor;useron:=true; topscr;
if smw in thisuser.option then rsm;
thisuser.option:=thisuser.option-[smw];
if alert in thisuser.option then chatcall:=true;
if thisuser.waiting<>0 then begin
nl;nl;prompt('Read your mail now? ');
if yn then begin nl; readmail; end;
nl;nl;
end;
end;
overlay procedure reqchat;
begin
helpl:='C';
nl;nl; if (not sysop) or (rchat in thisuser.ac)
then begin
print('Sysop not available.');
print('Use Feedback instead.');
imail(1);
end else begin
if not chatcall then begin
prompt('Reason: '); inputl(i,70);
if i<>'' then begin
sysoplog('Chat: '+i);
print('Chat call now on.');
sound(440); delay(500); nosound;
chatr:=i; chatcall:=true;
end else chatr:='';
end else
begin chatcall:=false; print('Chat call turned off.'); chatr:='';end;
end;
nl;nl; topscr;
end;
overlay procedure abbs;
var filvar:charfil; i,i1:str; c:char; tf:text; there:boolean;
begin
if not(ramsg in thisuser.ac) and (thisuser.sl>10) then begin
nl;prompt('Do you want to add to the bbs list? '); helpl:='A';
if yn then begin
repeat
print('Enter the phone number in the form:');
print(' ###-###-####');
prompt(':'); input(i1,12);
until (length(i1)=12) or (i1='') or hangup;
assign(tf,'gfiles\bbslist.msg'); there:=false;
{$I-} reset(tf); {$I+} if ioresult=0 then while not eof(tf) do begin
readln(tf,i); if copy(i,1,12)=i1 then there:=true;
end;
close(tf);
if there then begin nl;nl; print('It''s already in there.');
i1:=''; end;
i:=i1; if i<>'' then begin
print('Enter the name of the BBS:');
prompt(':'); inputl(i1,64);
i:=i+' '+i1;
if i1<>'' then begin
nl;print(i); nl;prompt('Is this correct? ');
if yn then begin
assign(filvar,'gfiles\bbslist.msg'); {$I-} append(filvar); {$I+}
if ioresult<>0 then
rewrite(filvar);
writeln(filvar,i);
close(filvar);
sysoplog('Added "'+i+'"');
end;
end;
end;
end;
end;
end;
overlay procedure yourinfo;
begin
cls;
print('Your name : '+nam);
print('Phone number : '+thisuser.ph);
print('Mail waiting : '+cstr(thisuser.waiting));
print('Sec Lev : '+cstr(thisuser.sl));
print('Last on : '+thisuser.laston);
print('Times on : '+cstr(1+thisuser.loggedon));
print('On today : '+cstr(thisuser.ontoday));
print('Messages posted: '+cstr(thisuser.msgpost));
print('E-mail sent : '+cstr(thisuser.emailsent+thisuser.feedback));
prompt('Messages : '); if rvalidate in thisuser.ac then
print('Unvalidated') else print('Validated');
prompt('Backspacing : '); if rbackspace in thisuser.ac then
print('Off') else print('On');
end;
overlay procedure prg(x:boolean);
var q:boolean;
procedure purge(var quit:boolean);
var pl,cn:integer; c:char; mr:messagerec; a,b:boolean;
begin
quit:=false;
print('== Purge '+boards[board].name+' ==');
iscan(pl);
cn:=1;
while (cn<=pl) and (not quit) and (not hangup) do begin
seek(mf,cn); read(mf,mr);
if mr.owner<>usernum then cn:=cn+1 else begin
readm(cn,a,b,pl); nl;
prompt('D:elete, I:gnore, Q:uit :'); onek(c,'DIQ');
case c of
'D':begin deletem(pl,cn);
sysoplog('-'+mr.title+' purged off '+boards[board].name);
end;
'Q':begin quit:=true; cn:=pl+1; end;
'I':cn:=cn+1;
end;
end;
end;
close(mf);
print('== '+boards[board].name+' Purge Done ==');
end;
procedure gpurge;
var quit:boolean;
begin
print('=== GLOBAL PURGE ===');
board:=1; repeat
if (thisuser.sl>=boards[board].sl) and
((boards[board].ar='@') or (boards[board].ar in thisuser.ar)) then
purge(quit);
board:=board+1;
until (board>numboards) or hangup or quit;
board:=1;
print('=== GLOBAL PURGE DONE ===');
end;
begin
helpl:='J';
if x then gpurge else purge(q);
end;
overlay procedure wamsg;
var filvar:text; i,n:str; ii:integer; li:array[1..3] of str;
begin
readamsg; helpl:='W';
if not (ramsg in thisuser.ac) and (thisuser.sl>10) then begin
prompt('Change auto-message? ');
if yn then begin
nl;print('Enter three lines:'); nl;
for ii:=1 to 3 do begin
prompt(cstr(ii)+':'); inputl(li[ii],37);
end;
n:=nam; if pana in seclev[thisuser.sl].anst then begin
nl;prompt('Anonymous? ');
if yn then n:='@'+n;
end;
prompt('Is this alright? ');
if yn then begin
assign(filvar,'gfiles\auto.msg');
rewrite(filvar); writeln(filvar,n);
for ii:=1 to 3 do writeln(filvar,li[ii]);
close(filvar); print('Auto-message saved.');
if (realsl<>255) or incom then begin
append(sysopf); writeln(sysopf,' Changed Auto-message');
for ii:=1 to 3 do writeln(sysopf,' '+li[ii]); close(sysopf);
end;
end else prompt('Nothing saved.');
end;
end;
end;
overlay procedure removem;
var b:messagerec; pl,t:integer; i:str;
begin
print('You have the following messages posted:');
iscan(pl); helpl:='R';
for t:=1 to pl do begin
seek(mf,t); read(mf,b);
if b.owner=usernum then
print(cstr(t)+': '+b.title);
end; prompt('Message to remove? ');
input(i,3); t:=value(i);
if t<>0 then
if (t<1) or (t>pl) then
print('Illegal number') else begin
seek(mf,t); read(mf,b); if (b.owner<>usernum) and
not lcs then
print('You didn''t write it.') else begin
print(cstr(t)+': '+b.title); prompt('Remove it? ');
if yn then begin
deletem(pl,t); print('Removed.');
sysoplog('-'+b.title+' deleted off of '+boards[board].name);
end;
end;
end;
close(mf);
end;
overlay procedure boardlist;
var b:integer; i:str; abort,next:boolean;
begin
nl;nl; print('Boards available to you:'); print('');
b:=1; abort:=false;
while (b<=numboards) and (not abort) do begin
if boardac(b) then begin
if boards[b].key=' ' then i:=cstr(b)
else i:=boards[b].key;
if length(i)=1 then i:=' '+i;
i:=i+' : '+boards[b].name;
printacr(i,abort,next);
end;
b:=b+1;
end;
nl;nl;
end;
overlay procedure newuser;
var c:char; tries,i,ii,t:integer; s,s1,s2:str; tf:boolean; fi:text; pasw:str;
begin
sl1('*** NEW USER *** '+time+' '+date);
if systat.users>=maxusers then begin
print('Sorry, there are the maximum number');
print('of users already.');
hangup:=true;
end else begin
if incom then begin
nl;nl;printfile('gfiles\system.msg');
nl;nl;printfile('gfiles\newuser.msg');
tries:=0; pasw:='';
while (systat.boardpw<>pasw) and (not hangup) do begin
prompt('Newuser password :'); input(pasw,38); tries:=tries+1;
if (pasw='OFF') or (pasw='BYE') then tries:=4;
if tries>=4 then hangup:=true;
end;
end;
repeat
t:=0;
repeat
print('Enter your full name, or your alias.');
prompt(':'); input(thisuser.name,25); tf:=false;
if (thisuser.name='BYE') or (thisuser.name='OFF') then hangup:=true; nl;
if (thisuser.name[1]<'A') or (thisuser.name='') then tf:=true;
for i:=1 to systat.users do if srl[i].name=thisuser.name then tf:=true;
assign(fi,'gfiles\trashcan.txt');{$I-} reset(fi); {$I+}
if ioresult=0 then begin
s2:=' '+thisuser.name+' ';
while not eof(fi) do begin
readln(fi,s1); if s1[length(s1)]=#1 then s1[length(s1)]:=' ' else s1:=s1+' ';
s1:=' '+s1; for i:=1 to length(s1) do s1[i]:=upcase(s1[i]);
if pos(s1,s2)<>0 then tf:=true;
end;
close(fi);
end;
if tf then begin print(chr(7)+'Sorry, can''t use that name.'); t:=t+1; end;
if t>=3 then hangup:=true;
until (tf=false) or hangup;
print('Enter your VOICE phone number in the');
print('form:');
print(' ###-###-####.'); prompt(':');
input(thisuser.ph,12);
nl; print('Enter your REAL first name.');
prompt (':');
inputl(thisuser.realname,14);
nl; print('Which computer type do you have?');
for i:=1 to 8 do
print(cstr(i)+'. '+comptyp[i]);
nl; prompt('Which? ');
onek(c,'12345678');
thisuser.comptype:=value(c); nl; nl;
print('['+thisuser.name+'] ['+thisuser.realname+']');
print('['+thisuser.ph+'] ['+comptyp[thisuser.comptype]+']');
c:='Y'; if (length(thisuser.ph)<>12) or (thisuser.ph[4]<>'-') or
(thisuser.ph[8]<>'-') then begin print('Enter the phone number right!'); c:='N'; end;
if thisuser.realname='' then c:='N';
nl; if c='Y' then begin dump; prompt('Is this correct? ');
if yn then c:='Y' else c:='N'; end else
print('Please use proper format.');
until (c='Y') or hangup;
if not hangup then begin
with thisuser do begin
deleted:=false; waiting:=0; laston:='Never.';loggedon:=0; msgpost:=0;
emailsent:=0; feedback:=0; linelen:=80; pagelen:=25;
defaults:=[onekey,wordwrap]; ontoday:=0; illegal:=0; cursor:='/>\<';
option:=[];dsl:=0; downloads:=0; uploads:=0; uk:=0; dk:=0;
if incom then sl:=10 else sl:=30;
ac:=[rvalidate]; ar:=[]; for i:=1 to 9 do vote[i]:=0; qscan[1].ext:=1;
qscan[1].ltr:='A'; qscan[1].number:=-32767;
for i:=2 to 19 do qscan[i]:=qscan[1];
for i:=1 to 19 do qscn[i]:=true;
end;
thisuser.macro[1]:='THIS IS THE CTRL-D MACRO';
thisuser.macro[2]:='THIS IS THE CTRL-F MACRO';
thisuser.sbn:=0;
randomize;
thisuser.pw:='';
for i:=1 to 6 do begin
ii:=random(36);
if ii<10 then c:=chr(ord('0')+ii)
else c:=chr(ord('A')+ii-10);
thisuser.pw:=thisuser.pw+c;
end;
reset(uf);
ii:=0; for i:=1 to filesize(uf)-1 do begin
seek(uf,i);
read(uf,user);
if user.deleted and (ii=0) then ii:=i;
end;
if ii=0 then usernum:=filesize(uf) else usernum:=ii;
seek(uf,usernum);
write(uf,thisuser);
close(uf);
isr(thisuser.name,usernum); nl; nl;
repeat
print('Your user number is '+cstr(usernum));
print('Your password is "'+thisuser.pw+'".');
print('Please write them down and re-type');
print('your password for verification.');
prompt('Password: '); input(s,8);
until (s=thisuser.pw) or hangup;
nl; nl;
if incom then begin
topscr;
print('You will now send a letter to the sysop');
print('asking for validation. If you do not');
print('complete it, you will not be validated.');
irt:='New User Application';
nl; email(1);
end;
end;
end;
end;
overlay procedure delmail;
var tu,d,i,x:integer; mr:mailrec; f:file; u:userrec; c:char; abort,next,done:boolean;
begin
helpl:='K';
prompt('Kill old E-mail? '); if yn then begin
nl;nl;d:=daynum(date); reset(uf); reset(mailfile);i:=0; done:=false;
while (i<filesize(mailfile)) and (not hangup) and (not done) do begin
seek(mailfile,i); read(mailfile,mr);
if (abs(mr.from)=usernum) and (mr.destin<>-1) then repeat
tu:=mr.destin; seek(uf,tu); read(uf,u);
nl;print('To : '+u.name+' #'+cstr(tu));
print('Title: '+mr.title);
print('Sent : '+cstr(d-mr.date)+' days ago');
nl; prompt('R:ead, D:elete, N:ext, Q:uit : ');
onek(c,'QNDR');
case c of
'Q':done:=true;
'D':begin
close(uf); sysoplog('Deleted mail to '+rmail(i)); reset(uf);
if tu=usernum then thisuser.waiting:=thisuser.waiting-1;
print('Mail deleted.');
end;
'R':begin nl; nl; readmsg(mr.msg,abort,next);end;
end;
until hangup or (c<>'R');
i:=i+1;
end;
close(uf); close(mailfile); topscr;
end;
end;
overlay procedure gfiles;
var b:gft; f:file of gft; i:str; t,c:integer; deep,exit:boolean;
gftit:array[1..150] of record tit:string[80]; arn:integer; gfile:boolean;end;
lgftn,lgftnt,numgft:integer; titl:str;
procedure gettit(n:integer);
var r:integer; b:gft;
begin
numgft:=0;
if n>0 then begin
seek(f,n); read(f,b); titl:='[ '+b.title+' ]';
end else titl:='[ Main Section ]';
r:=n+1;
if r<=t then begin
seek(f,r); read(f,b);
while (r<=t) and (b.filen[1]<>#1) do begin
if b.num<=thisuser.sl then begin
numgft:=numgft+1;
gftit[numgft].tit:=b.title;
gftit[numgft].arn:=r;
gftit[numgft].gfile:=true;
end;
r:=r+1;
if (r<=t) then begin seek(f,r); read(f,b); end;
end;
end;
if n=0 then
while (r<=t) do begin
seek(f,r); read(f,b);
if (b.filen[1]=#1) and (b.num<=thisuser.sl) then begin
numgft:=numgft+1;
gftit[numgft].tit:='[ '+b.title+' ]';
gftit[numgft].arn:=r;
gftit[numgft].gfile:=false;
end;
r:=r+1;
end;
end;
procedure lgft;
var abort,next:boolean; c:integer;
begin
nl; print(titl); nl;
if numgft=0 then print('No G-files.') else begin
abort:=false; next:=false; c:=1;
while (c<=numgft) and (not abort) do begin
printacr(cstr(c)+': '+gftit[c].tit,abort,next);
c:=c+1;
end;
end;
end;
begin
nl;assign(f,'gfiles\gfiles.dat'); {$I-} reset(f); {$I+}
if ioresult<>0 then begin
rewrite(f); b.num:=0; write(f,b);
end;
seek(f,0); read(f,b); t:=b.num; helpl:='G';
if t=0 then print('No G-files yet.') else begin
gettit(0); exit:=false;
lgft; lgftn:=0; deep:=false; lgftnt:=0;
repeat
nl; nl; prompt('Gfiles: (1-'+cstr(numgft)+', ^'+cstr(lgftn)+'),?,Q : ');
input(i,3);
if i='' then if lgftn=numgft then i:='Q' else i:=cstr(lgftn+1);
if i='?' then lgft;
if i='Q' then
if deep then begin
deep:=false;
gettit(0);
lgft;
lgftn:=lgftnt;
end else exit:=true;
c:=value(i);
if (c>0) and (c<=numgft) then begin
if gftit[c].gfile=true then begin
seek(f,gftit[c].arn);
read(f,b);
printfile('gfiles\'+b.filen);
lgftn:=c;
end else begin
gettit(gftit[c].arn);
lgftn:=c;
if numgft>0 then begin
lgft;
lgftnt:=c; lgftn:=0;
deep:=true;
end else begin
gettit(0);
nl; print('No G-files there.');
end;
end;
end;
until exit or hangup;
end;
close(f);
nl;nl;
end;
overlay procedure chpw;
var i:str;
begin
cls; print('Your current password is "'+thisuser.pw+'"');
print('If you change it, it must be between');
print('three and eight characters. Do you want');
helpl:='Z';
prompt('To change it? ');
if yn then begin
repeat
print('Enter new password:'); print(' (-!----)'); prompt(':');
input(i,8);
until (length(i)>2) or hangup;
print('New password="'+i+'"');
if not hangup then thisuser.pw:=i;
sysoplog('Changed password.');
end;
topscr;
end;
overlay procedure mmacro;
var i:str; c,mc:char; mcn,n,n1,mn:integer; done:boolean;
begin
done:=false; helpl:='H';
repeat
nl; prompt('Macros: M,L,Q,? :'); onek(c,'MLQ?');
case c of
'?':begin
print('M:ake macro L:ist macros');
print('Q:uit ?:this');
end;
'Q':done:=true;
'L':begin
nl; print('Current Macros:');
for n:=1 to 2 do begin nl;
if n=1 then print('Ctrl-D:') else print('Ctrl-F:');
prompt('"');
for n1:=1 to length(thisuser.macro[n]) do
if thisuser.macro[n][n1]>=' ' then
prompt(thisuser.macro[n][n1])
else
prompt('^'+chr(64+ord(thisuser.macro[n][n1])));
print('"');
end;
end;
'M':begin
nl; prompt('Which (D,F,Q=Quit) :'); onek(c,'DFQ');
if c<>'Q' then begin
nl;nl; mc:=c; print('Enter your macro now, Ctrl-'+mc);
print('to end macro.'); nl;if mc='D' then mcn:=4 else mcn:=6;
n:=1; i:=''; macok:=false; if mc='D' then mn:=1 else mn:=2;
helpl:=#0;
repeat
getkey(c);
if ord(c)>127 then c:=chr(0);
if (ord(c)<32) then
if not((c=#8) or (c=#10) or (c=#13) or (c=#14) or (c=#9) or
(c=#24) or (c=chr(mcn))) then c:=chr(0);
if c=#8 then if n<2 then c:=#0 else begin
bs; oc(#8); n:=n-1; c:=#0;
end;
if (c<>#0) and (c<>chr(mcn)) then begin
if (c=#21) or (c=#14) or (c=#9) or (c=#24) then prompt('^'+chr(ord(c)+64))
else oc(c);
i[n]:=c; n:=n+1;
if c=#13 then oc(chr(10));
end;
until (c=chr(mcn)) or (n=80) or hangup;
nl; helpl:='H';
if n=80 then begin
print('Macro limit is 79 chars.');
print('That much saved.');
end;
i[0]:=chr(n-1);
print('Ctrl-'+mc+' macro is now:'); prompt('"');
for n1:=1 to length(i) do
if i[n1]>=' ' then
prompt(i[n1])
else
prompt('^'+chr(64+ord(i[n1])));
print('"'); dump;
prompt('Is this what you want? ');
if yn then begin thisuser.macro[mn]:=i; print('Macro saved.') end
else print('Macro not saved, then.');
macok:=true;
end;
end;
end;
until done or hangup;
end;
overlay procedure default;
var c:char; i:str; i1,ii:integer;
begin
c:='?';
repeat
if c='?' then begin
print(chr(12)+'Your defaults:');nl;
print('1. Screen size : '+cstr(thisuser.linelen)+'X'+cstr(thisuser.pagelen));
prompt('2. Cursor : ');
if spcsr in thisuser.defaults then print(thisuser.cursor) else
print('Standard');
prompt('3. Input : ');
if onekey in thisuser.defaults then print('One key') else print('Line');
prompt('4. Wordwrap : ');
if wordwrap in thisuser.defaults then print('On') else print('Off');
prompt('5. Pause on screen: '); if pause in thisuser.defaults then
print('On') else print('Off');
prompt('6. Mailbox : '); if nomail in thisuser.option then begin
print('Closed'); print(' You can not receive mail'); end else print('Open');
print('7. Configured Q-scan');
end;
nl;nl; helpl:='D'; prompt('Enter number to change, Q or ? :');
onek(c,'Q1234567?');nl;
case c of
'1':begin
nl;nl;prompt('Number of characters per line? ');
input(i,2); if i<>'' then thisuser.linelen:=value(i);
if thisuser.linelen>80 then thisuser.linelen:=80;
if thisuser.linelen<32 then thisuser.linelen:=32;
prompt('Number of lines per page? ');
input(i,2); if i<>'' then thisuser.pagelen:=value(i);
if thisuser.pagelen>25 then thisuser.pagelen:=25;
if thisuser.pagelen<4 then thisuser.pagelen:=4;
end;
'2':begin
nl;nl; prompt('Do you want a spinning cursor? ');
if yn then thisuser.defaults:=thisuser.defaults+[spcsr]
else thisuser.defaults:=thisuser.defaults-[spcsr];
if spcsr in thisuser.defaults then begin
print('Current Cursor: '+thisuser.cursor);
print('Enter new cursor, or <CR> to leave it.');
print(' (--------)');
prompt(':'); inputl(i,10); if i<>'' then thisuser.cursor:=i;
mcursor;
end;
end;
'3':begin
if not (onekey in thisuser.defaults) then begin
thisuser.defaults:=thisuser.defaults+[onekey]; print('Turned on.'); end
else begin
thisuser.defaults:=thisuser.defaults-[onekey]; print('Turned off.'); end
end;
'4':begin
if not (wordwrap in thisuser.defaults) then begin
thisuser.defaults:=thisuser.defaults+[wordwrap]; print('Turned on.'); end
else begin
thisuser.defaults:=thisuser.defaults-[wordwrap]; print('Turned off.'); end;
end;
'5':if pause in thisuser.defaults then
begin thisuser.defaults:=thisuser.defaults-[pause];
print('Turned off.'); end else
begin thisuser.defaults:=thisuser.defaults+[pause];
print('Turned on.'); end;
'6':if nomail in thisuser.option then begin
thisuser.option:=thisuser.option-[nomail];
print('Mailbox now open.'); print('You can receive mail now.');
end else begin
thisuser.option:=thisuser.option+[nomail];
print('Mailbox now closed.'); print('You >CAN NOT< recieve mail now.');
end;
'7':repeat
helpl:='I';
nl;nl;print('boards to Q-scan marked with ''*''');
nl; for ii:=1 to numboards do if boardac(ii) then begin
if thisuser.qscn[ii] then prompt('* ') else prompt(' ');
if boards[ii].key=' ' then i:=cstr(ii) else i:=boards[ii].key;
if length(i)=1 then i:=' '+i;
i:=i+' : '+boards[ii].name;print(i);
end;
repeat
prompt('Enter board #, Q, or ? :'); input(i,2);
ii:=value(i);
if (ii>0) and (ii<=numboards) then
if (boards[ii].key=' ') and boardac(ii) then thisuser.qscn[ii]:=
not thisuser.qscn[ii]
else
else begin
i1:=0;
for ii:=1 to numboards do if boards[ii].key=i then i1:=ii;
if (i1<>0) and (i<>' ') then if boardac(ii) then
thisuser.qscn[ii]:=not thisuser.qscn[ii];
end;
until (i='Q') or (i='?') or hangup;
until (i='Q') or hangup;
end;
until hangup or (c='Q');
topscr;
end;
overlay procedure logoff;
var s,d:integer; mr:mailrec; x:smr;
begin
term_ready(false);
thisuser.laston:=systat.lastdate;
thisuser.loggedon:=thisuser.loggedon+1;
thisuser.sl:=realsl;
thisuser.illegal:=0;
reset(uf); seek(uf,usernum); write(uf,thisuser); close(uf);
systat.activetoday:=systat.activetoday+trunc((timer-timeon+30)/60);
systat.fbacktoday:=systat.fbacktoday+ftoday;
systat.emailtoday:=systat.emailtoday+etoday;
reset(systatf); write(systatf,systat); close(systatf);
window(1,1,80,25);clrscr;
if hungup then sysoplog('*** HUNG UP ***');
sysoplog('Read: '+cstr(mread)+' Time on: '+cstr(trunc((timer-timeon+30)/60)));
{$I-} reset(mailfile) {$I+}; if ioresult=0 then
if filesize(mailfile)>1 then begin
s:=0; d:=0;
while s<filesize(mailfile) do begin
seek(mailfile,s); read(mailfile,mr);
if (mr.destin<>-1) then
if s=d then d:=d+1 else begin
seek(mailfile,d); write(mailfile,mr); d:=d+1;
end;
s:=s+1;
end;
mr.destin:=-1; mr.from:=-1;
for s:=d to filesize(mailfile)-1 do begin
seek(mailfile,s); write(mailfile,mr);
end;
end;
close(mailfile);
{$I-} reset(smf) {$I+}; if ioresult=0 then
if filesize(smf)>1 then begin
s:=0; d:=0;
while s<filesize(smf) do begin
seek(smf,s); read(smf,x);
if x.destin<>-1 then
if s=d then d:=d+1 else begin
seek(smf,d); write(smf,x); d:=d+1;
end;
s:=s+1;
end;
x.destin:=-1;
for s:=d to filesize(smf)-1 do begin
seek(smf,s); write(smf,x);
end;
end;
close(smf);
end;
overlay procedure endday;
var cn,pl,d,i,tu,fu:integer; mr:mailrec; f:file; u:userrec; b:messagerec; is:str;
begin
d:=daynum(date); reset(mailfile);
for i:=0 to filesize(mailfile)-1 do begin
seek(mailfile,i); read(mailfile,mr);
if (d-mr.date>mr.mage) and (mr.destin<>-1) then begin
fu:=abs(mr.from);
is:=rmail(i);
ssm(fu,is+' never got your letter.');
end;
end;
close(mailfile);
reset(uf);
for board:=1 to numboards do begin
iscan(pl);
cn:=1;
while cn<=pl do begin
seek(mf,cn); read(mf,b);
if ((d-b.date>b.mage) or (b.messagestat=deleted)) and (b.date>0) then
deletem(pl,cn)
else
cn:=cn+1;
end;
close(mf);
end;
close(uf);
end;
overlay procedure smail(tf:boolean);
var ix,c1,c2,c3,c4:integer; c:char;
mr:mailrec; t,e,cp:integer; f:messages; a:anontyp; i:str; us:userrec;
na:array[1..20] of integer; ok:boolean;
begin
if tf=false then begin
irt:=''; helpl:='Q';
print('Enter user name or number.'); prompt(':');
finduser(ix);
if ix>0 then
imail(ix);
end else if not((remail in thisuser.ac) or
((etoday>=seclev[thisuser.sl].emails) and (thisuser.sl<55))) then begin
reset(uf); helpl:='E';
repeat
nl; nl; print('Send mail to more than one user.'); ok:=false;
print('Enter user NUMBERS, separated by commas, max 20.');
prompt(':'); input(i,78);
for c1:=1 to 20 do na[c1]:=0;
c1:=1; c2:=1;
while i<>'' do begin
c3:=pos(',',i);
if c3=0 then c3:=length(i)+1;
c4:=value(copy(i,1,c3-1));
i:=copy(i,c3+1,length(i)-c3);
if (c4<1) or (c4>maxusers) or (c4>=filesize(uf)) then c4:=0;
if c4<>0 then begin
seek(uf,c4); read(uf,us);
if us.deleted or ((c4=1) and (us.waiting>50)) or ((c4<>1) and
(us.waiting>15)) or ((nomail in us.option) and not cs) or
((c4=usernum) and (realsl<>255)) then
c4:=0;
if not cs then
for c2:=1 to 20 do
if na[c2]=c4 then
c4:=0;
if (c4<>0) and (c1<=20) then begin
na[c1]:=c4;
c1:=c1+1;
end;
end;
end;
nl; print('Users marked:');
c1:=1;
while (na[c1]<>0) and (c1<=20) do begin
seek(uf,na[c1]); read(uf,us); print(' '+us.name+' #'+cstr(na[c1]));
c1:=c1+1;
end;
if na[1]=0 then print(' None');
nl; prompt('Is this correct? '); ok:=yn;
until ok;
if na[1]<>0 then begin
a:=no; if sanm in seclev[thisuser.sl].anst then a:=yes;
inmsg(f,a,i,false,true);
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);
if (realsl<>255) or incom then begin
assign(sysopf,'gfiles\sysop.log'); {$I-} append(sysopf);{$I+}
if ioresult<>0 then
rewrite(sysopf);
end;
mr.msg:=f; if lan then mr.from:=-usernum else mr.from:=usernum;
mr.title:=i; mr.date:=daynum(date);
mr.mage:=maxage(thisuser.sl);
c1:=1; nl; print('Sending mail to:');
while (na[c1]<>0) and (c1<=20) do begin
mr.destin:=na[c1];
write(mailfile,mr);
if na[c1]=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;
seek(uf,na[c1]); read(uf,us);
us.waiting:=us.waiting+1; seek(uf,na[c1]); write(uf,us);
if na[c1]=usernum then thisuser.waiting:=thisuser.waiting+1;
i:=us.name+' #'+cstr(na[c1]);
if (realsl<>255) or incom then
writeln(sysopf,' Mult-mail sent to '+i);
print(' '+i);
c1:=c1+1;
end;
close(sysopf); close(mailfile); topscr;
end;
end;
close(uf);
end;
end;
overlay procedure ulist;
var inte:integer; abort,next:boolean;
begin
inte:=0; abort:=false; while (not abort) and (inte<systat.users) do begin
inte:=inte+1;
printacr(srl[inte].name+' #'+cstr(srl[inte].number),abort,next);
end;
end;