home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Jason Aller Floppy Collection
/
153.img
/
TELES.ZIP
/
BBS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1988-07-24
|
18KB
|
534 lines
program bbs;
{$R-} {Range checking off}
{$B+} {Boolean complete evaluation on}
{$S+} {Stack checking on}
{$I+} {I/O checking on}
{$N-} {No numeric coprocessor}
{$M 32150,0,0} {Declared here suffices for all Units as well!}
{$V-}
Uses
Crt,
Dos,
Turbo3,
Common,
Unit0,
UnitX,
Unit1,
Unit2,
FileSc,
BoardEdt,
SysopUt,
MenuEdt,
Qwik;
Var
Sdoor:String[255];
Last_Menu:Astr;
P:Astr;
Duh:Boolean;
Function TimeStr:Astr;
Var I:Astr;
Begin
Str(Nsl/60:7:2,i);
i:=copy(i,2,length(i));
i:=copy(i,1,pos('.',i)-1);
timestr:=i;
end;
Procedure Tcenter(Z:Astr);
Var Y,P:Integer;
Begin
P:=40-(length(z) div 2);
y:=wherey;
gotoxy(p,y);
writeln(z);
End;
Procedure ReadP;
Var A:integer; D:astr; Filv:Text; Count:integer;
Begin
answerbaud:=0; quitafterdone:=false; count:=paramcount; returna:=false;
nightly:=false;
If ParamCount<>0 then Begin
if ParamCount>5 then Writeln('Too many command specs');
if paramcount>5 then count:=5;
a:=0;
repeat
a:=a+1;
if copy(paramstr(a),1,2)='-b' then begin
d:=copy(paramstr(a),3,length(paramstr(a)));
answerbaud:=value(d);
end;
if (paramstr(a))='-n' then nightly:=true;
if (paramstr(a))='-k' then answerbaud:=1;
if (paramstr(a))='-p' then quitafterdone:=true;
until (a=paramcount) or (a=5);
end;
ClrScr;
Textcolor(14); Textbackground(1); clreol; gotoxy(1,1);
Tcenter('Telegard Bulletin Board System Version '+ver);
Textbackground(0);
TextColor(1);
Writeln; Writeln; Writeln;
Textcolor(12);
Tcenter('Thank You For Downloading One Of The Most');
Tcenter('Powerful BBS Programs Today'); Writeln; Writeln; Writeln;
Textcolor(10); Tcenter('Telegard - Written By Carl Mueller'); Writeln;
Writeln;
Tcenter('Command Parameters Specified: ');
Textcolor(9);
Writeln;
If ParamCount=0 then tcenter('None');
if nightly then tcenter('Execute Nightly Event');
if answerbaud=1 then tcenter('Local I/O Only');
if answerbaud>2 then tcenter('Answer at '+cstr(answerbaud)+' Baud');
if quitafterdone then tcenter('Quit After User LogOn');
End;
Procedure Process_Door(Z:Integer);
Var I:Integer; Namm:Astr;
Begin
Namm:=Copy(Nam,1,Pos('#',Nam)-1);
Sdoor:='';
For I:=1 to Length(OptStr[z]) do begin
If Copy(OptStr[z],i,1)='@' then Begin
If Copy(OptStr[z],i+1,1)='N' then Sdoor:=Sdoor+Thisuser.Name;
If Copy(OptStr[z],i+1,1)='F' then Sdoor:=Sdoor+(copy(nam,1,(pos(' ',nam)-1)));
If Copy(OptStr[z],i+1,1)='L' then Begin
if pos(' ',copy(namm,1,length(namm)-1))=0 then Sdoor:=Sdoor+(Copy(Nam,1,(Pos(' ',Nam)-1))) else
Sdoor:=Sdoor+(copy(namm,pos(' ',namm)+1,length(namm)-(pos(' ',namm))-1));
End;
If Copy(OptStr[z],i+1,1)='T' then Sdoor:=Sdoor+timestr;
If Copy(OptStr[z],i+1,1)='B' then if spd<>'KB' then Sdoor:=Sdoor+Spd else Sdoor:=Sdoor+'0';
If Copy(OptStr[z],i+1,1)='G' then If okansi then Sdoor:=Sdoor+'1' else Sdoor:=Sdoor+'0';
If Copy(OptStr[z],i+1,1)='R' then Sdoor:=Sdoor+(copy(nam,pos('#',nam)+1,length(nam)));
I:=i+1;
End else
Sdoor:=Sdoor+Copy(Optstr[z],i,1);
End;
End;
Procedure Write_Dor;
Var FilVar:Text; First,Last:Astr; Dum:Astr;
Begin
assign(filvar,'dorinfo1.def');
rewrite(filvar); writeln(filvar,systat.bbsname);
writeln(filvar,systat.sysopfirst); writeln(filvar,systat.sysoplast);
writeln(filvar,'COM'+cstr(systat.comport));
if spd='KB' then dum:='0' else dum:=spd;
writeln(filvar,dum+' BAUD,N,8,1');
writeln(filvar,'0');
first:=copy(thisuser.name,1,pos(' ',thisuser.name));
last:=copy(thisuser.name,length(first)+1,length(thisuser.name));
If first='' then first:='THE';
writeln(filvar,first);
writeln(filvar,last);
{if thisuser.citystate='' then thisuser.citystate:='Unkown, MI';}
writeln(filvar,thisuser.citystate);
writeln(filvar,'1');
writeln(filvar,thisuser.sl);
writeln(filvar,timestr);
close(filvar);
End;
Procedure ChangeFileBoard(Int:Integer);
begin
if (int>-1) and (int<=maxulb) then
if (thisuser.dsl>=uboards[int].dsl) and (thisuser.age>=uboards[int].agereq)
and (uboards[int].key=dumb2)
and (uboards[int].ar='@') or (uboards[int].ar in thisuser.ar)
then
if (uboards[int].password='') or dcs then begin
FILEBOARD:=int; thisuser.res[2]:=FILEBOARD; end else begin
prt('Password? '); input(i,10);
if i<>uboards[int].password then
print('Wrong.')
else
begin FILEBOARD:=int; thisuser.res[2]:=FILEBOARD; end;
end;
end;
Procedure ChangeBoard(Nb:Integer);
Var inte:integer;
begin
if nb>0 then
if nb<=numboards then
if (boardacpw(nb)) and (boards[nb].key=dumb) then begin thisuser.res[1]:=nb;board:=nb;end
else
else
else begin
nb:=0;
{ for inte:=1 to numboards do if boards[inte].key=i then nb:=inte;}
if (nb<>0) and (i<>' ') then if boardacpw(nb) then board:=nb;
end;
end;
Procedure CheckAr(x:Integer);
var o:char;
Begin
p:=optstr[x];
if pos(',',optstr[x])<>0 then begin
O:=P[POS(',',OPTSTR[X])+1]; o:=upcase(o);
p:=copy(optstr[x],1,pos(',',optstr[x])-1);
if not (O in thisuser.ar) then begin
duh:=false;
print('You don''t possess the proper flags to enter this menu.');
end;
end;
end;
procedure mainmenu;
var nb,inte:integer; abort,next:boolean; ii:astr; rl:real; mr:mailrec;
filvar:text; x:integer; s:astr; zz:integer; menup:astr;
t:real; CmdExist,Cmdsl:Boolean; R,o:char;
begin
dump;
tleft; nl; nl;
macok:=true;
if mmnu in thisuser.defaults then printf(systat.gfilepath+directive);
menup:=menuprompt;
{ Putting a '*' in front of MenuPrompt will NOT print time left. }
if copy(menuprompt,1,1)='*' then menup:=copy(menuprompt,2,length(menuprompt));
{ Putting a '#' in front on MenuPrompt will print the menu When entered
regardless of xpert}
if (copy(menuprompt,1,1)='#') or (copy(menuprompt,1,1)='!') then
begin
if not (mmnu in thisuser.defaults) then
printf(systat.gfilepath+directive);
menup:=copy(menuprompt,2,length(menuprompt));
end;
if (copy(menuprompt,1,1)<>'*') and (copy(menuprompt,1,1)<>'!')
then print('[<Time Left - '+tlef+'>]');
sprompt(menup);
if onekey in thisuser.defaults then mmkey(i) else input(i,20);
if length(i)>1 then if copy(i,1,2)='//' then i:=copy(i,3,length(i)-2);
CmdExist:=False; CmdSL:=False;
for x:=1 to noc do begin
if i=cmdl[x] then begin
CmdExist:=True;
if thisuser.sl>=msl[x] then begin
CmdSl:=True;
case cmdtype[x] of
0:begin nl; sprint(optstr[x]); end;
1:if pos('.',optstr[x])=0 then printf(systat.gfilepath+optstr[x]) else
printfile(systat.gfilepath+optstr[x]);
2:begin
nl;nl; if not chatcall then sprompt(optstr[x]); nl; reqchat(optdata[x]);
end;
3:begin
nl;nl; sprompt(optstr[x]);
if yn then begin
cls;
printf(systat.gfilepath+'logoff');
hangup:=true;
hungup:=false;
end;
end;
4:hangup:=true;
5:begin boardlist(optstr[x]); ynq('Change to which board? '); input(s,2);
changeboard(value(s));
end;
6:if mmnu in thisuser.defaults then
thisuser.defaults:=thisuser.defaults-[mmnu]
else
thisuser.defaults:=thisuser.defaults+[mmnu];
7:if (ramsg in thisuser.ac) then
print('You are restricted from writing automessages.')
else
wmsg;
8:readamsg;
9:begin
nl; assign(filvar,systat.gfilepath+'auto.msg');
{$I-} reset(filvar); {$I+}
irt:='Your auto-message';
if ioresult<>0 then
print('Nothing to reply to.')
else begin
readln(filvar,lastname);
close(filvar);
if lastname[1]='@' then
if not (postn in seclev[thisuser.sl].anst) then
lastname:='';
if (lastname[1]='!') and so then
lastname:='';
if lastname='' then
print('You can''t reply')
else
autoreply;
end;
end;
10:yourinfo;
11:begin pver; printfile(systat.gfilepath+'logon.msg');
printf(systat.gfilepath+'system'); end;
12:chpw;
13:begin
if not (ansi in thisuser.defaults) then begin
thisuser.defaults:=thisuser.defaults+[ansi];
print('ANSI active.'); end
else begin
thisuser.defaults:=thisuser.defaults-[ansi];
print('ANSI disabled.'); end;
end;
14:begin
if not (color in thisuser.defaults) then begin
thisuser.defaults:=thisuser.defaults+[color];
print('Color on.'); end
else begin
thisuser.defaults:=thisuser.defaults-[color];
print('Color off.'); end;
end;
15:docitystate;
16:dojob;
17:dostreet;
18:dozipcode;
19:doscreen;
20:dophone;
21:abbs;
22:removem;
23:ulist;
24:smail(false);
25:begin irt:='Feedback'; imail(optdata[x]); end;
26:nscan;
27:begin dumb:=boards[optdata[x]].key; changeboard(optdata[x]); end;
28:begin zz:=board; changeboard(optdata[x]);
qscan(next,true); changeboard(zz);
end;
29:qscan(next,true);
30:begin post; savebase; end;
31:readmail;
32:vote;
33:gfiles;
34:mmacro;
35:delmail;
36:prg(false);
37:prg(true);
38:bulletins;
39:chbds;
40:setdirs;
41:begin listboards(optstr[x]); ynq('Change to which board? ');
input(s,2); if s<>'' then changefileboard(value(s));
end;
42:iul;
43:idl;
44:listfiles;
45:search;
46:searchd;
47:pointdate;
48:nf;
49:remove;
50:move;
51:lfii;
52:dlbatch;
53:yourfileinfo;
54:dirf(true);
55:dirf(false);
56:begin
duh:=true;
Last_Menu:=N; checkar(x);
if duh then begin
n:=systat.menupath+p+'.mnu';
readin;
end;
end;
57:dosj('U');
58:dosj('E');
59:dosj('G');
60:dlboardedit;
61:boardedit;
62:changestuff;
63:begin
if not (onekey in thisuser.defaults) then begin
thisuser.defaults:=thisuser.defaults+[onekey];
print('One key input.'); end
else begin
thisuser.defaults:=thisuser.defaults-[onekey];
print('Full line input.'); end
end;
64:if pause in thisuser.defaults then
begin thisuser.defaults:=thisuser.defaults-[pause];
print('No pause on screen.'); end else
begin thisuser.defaults:=thisuser.defaults+[pause];
print('Pause on screen active.'); end;
65:if nomail in thisuser.option then begin
thisuser.option:=thisuser.option-[nomail];
print('Mailbox now open.');
end else
if thisuser.forusr<>0 then begin
thisuser.forusr:=0;
print('Mail no longer forwarded.');
end else begin
ynq('Do you want to close your mailbox? ');
if yn then begin
thisuser.option:=thisuser.option+[nomail];
print('Mailbox now closed.');
CL(5); print('You >CAN NOT< recieve mail now.');
end else begin
ynq('Do you want your mail forwarded? ');
if yn then forwardmail;
end;
end;
66:chcolors;
67:begin
if not (wordwrap in thisuser.defaults) then begin
thisuser.defaults:=thisuser.defaults+[wordwrap];
print('Wordwrap on.'); end
else begin
thisuser.defaults:=thisuser.defaults-[wordwrap];
print('Wordwrap off.'); end;
end;
68:scan1;
69:smail(true);
70:begin
duh:=true;
Last_Menu:=N; dumb:=boards[optdata[x]].key;
changeboard(optdata[x]); checkar(x);
if duh then begin
n:=systat.menupath+''+optstr[x]+'.mnu';
readin;
end;
end;
71:Begin
If Optdata[x]<>1 then begin cl(3); prompt('[> '); cl(0); print('Opening Door at '+time+' ... Please wait.'); end;
Process_Door(X);
CommandLine('Writing to DORINFO1.DEF ...'); Write_Dor;
Commandline('Now Running '+sdoor);
SysopLog('[ Ran Door '+optstr[x]+' at '+time+' ]');
Exec('\Command.Com','/C '+sdoor); ChDir(Start_Dir);
SysopLog('[ Returned From Door at '+time+' ]');
if optdata[x]<>1 then clrscr;
GamePort; tim:=timer; dump; topscr;
End;
72:Chuser;
73:Begin
Ynq('Do you want to re-output to VOTES.TXT? ');
If Yn then VotePrint;
Ynq('Do you want to see VOTES.TXT? ');
If Yn then Printfile(Systat.GfilePath+'votes.txt');
End;
74:Begin
Last_Menu:=N; Menu_Edit; First_time:=true; N:=Last_Menu; ReadIn;
End;
75:Begin Dumb2:=Uboards[OptData[X]].key; ChangeFileBoard(OptData[X]); End;
76:Begin
Last_Menu:=N; Duh:=True; Dumb2:=Uboards[OptData[X]].key;
ChangeFileBoard(OptData[X]);
CheckAr(X);
If Duh then begin
N:=systat.menupath+''+optstr[x]+'.MNU';
ReadIn;
end;
End;
77:Begin
If (Not (MMNU in Thisuser.Defaults)) and
(Copy(MenuPrompt,1,1)<>'#') and (Copy(MenuPrompt,1,1)<>'!') then
printf(systat.gfilepath+directive);
End;
78:Editfiles;
79:Sort;
80:mailr;
81:Begin
nl; print('Enter file name to download (Drive:Path\FileName.Ext)');
prt(':');mpl(70);input(s,70); if s<>'' then Unlisted_download(s);
End;
82:Begin
Nl; Nl;
cl(3);
print('Statistics on "'+boards[board].name+'"'); nl;
Cl(0); Prompt('Board SL Requirement .... : '); cl(9); print(cstr(boards[board].sl));
Cl(0); Prompt('Board AR Requirement .... : '); cl(9);
If Boards[Board].Ar='@' then Print('None') else begin
for r:='A' to 'G' do if (r=boards[board].ar) then prompt(r); nl; end; nl;
Cl(0); Prompt('Maximum Messages ........ : '); cl(9); print(cstr(boards[board].maxmsgs));
Cl(0); Prompt('Post SL Requirement ..... : '); cl(9); print(cstr(boards[board].postsl)); Nl;
End;
83:Begin
Nl; Nl;
Cl(3);
Print('File Area: "'+uboards[fileboard].name+'"'); nl;
cl(0); Prompt('Board DSL Requirement ... : '); cl(9); print(cstr(uboards[fileboard].dsl));
Cl(0); Prompt('Board AR Requirement .... : '); cl(9);
If Uboards[Fileboard].Ar='@' then Print('None') else begin
For R:='A' to 'G' do if (r=uboards[fileboard].ar) then prompt(r); nl; end; Nl;
Cl(0); Prompt('Maximum Files Allowed ... : '); cl(9); print(cstr(uboards[fileboard].maxfiles));
Cl(0); Prompt('Minimum Age Required .... : '); cl(9); print(cstr(uboards[fileboard].agereq));
Cl(0); Prompt('File Points ............. : '); cl(9); print(cstr(thisuser.filepoints)); nl;
End;
84:Sysoplog(optstr[x]);
85:Newfiles(optdata[x],abort);
86:CommandLine(OptStr[X]);
87:if pos('.',optstr[x])=0 then printf(optstr[x]) else printfile(optstr[x]);
88:initvotes;
89:readq(systat.gfilepath+optstr[x]);
end; {End of Case}
end; {End SL Check}
if found=true then x:=noc;
end; {End Cmd Search}
end; {End Loop}
If (CmdSl=False) and (CmdExist=False) then print('Invalid Command.');
If (CmdSl=False) and (CmdExist=True) then print('You don''t have enough access for this command.');
end;
begin {Main Loop}
Ver:='1.6a';
ReadP;
CheckBreak:=false; { Takes the place of $C-}
readingmail:=false;
getdir(0,Start_Dir);
Async_Init;
Init;
ClrScr;
Repeat
Write_msg:=false;
GetCaller; {WFC MENU}
If not DoneDay then
Begin
If GetUser then
NewUser;
MacOk:=true;
If not HangUp then
if LogOn then
ReadMail; {MAIL READ}
Bulletins; {SYSTEM ANNOUCEMENTS}
{ FILEBOARD:=1;
ldat:=thisuser.laston;
ymbtt:=0.0;
ymodemfiles:=0;
if thisuser.res[2]=0 then thisuser.res[2]:=1;}
End;
Flush(Sysopf);
FILEBOARD:=1;
ldat:=thisuser.laston;
ymbtt:=0.0;
ymodemfiles:=0;
ymodemfiles:=0;
if thisuser.res[2]=0 then thisuser.res[2]:=1;
Last_Menu:='Main.Mnu';
n:=systat.menupath+'Main.Mnu';
ReadIn; {READ-IN MENU CMDS}
While not HangUp do
MainMenu;
if quitafterdone then begin elevel:=0; hangup:=true; doneday:=true; end;
Term_Ready(False); Delay(500);
If UserOn then
LogOff;
if cdet and (not doneday) then
hangupphone;
if enddayf then
endday;
enddayf:=false;
until doneday;
close(sysopf);
term_ready(true); delay(100); pr('ATZ');
remove_port;
halt(elevel);
end. {Main Loop}