-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBBSLIST.PAS
304 lines (287 loc) · 7.04 KB
/
BBSLIST.PAS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
{$I DIRECT.INC}
Unit BBSList;
Interface
Procedure ListBBS;
Procedure AddBBS;
Procedure ChangeBBS;
Procedure ViewAnsi;
Procedure Deletebbs;
Implementation
Uses ConfigRt, GenSubs, Subs1, Subs2, TextRet, Mainr2, OverRet1,
FileLock, Gentypes;
Var BLFile : File Of BBSRec;
Procedure OpenBBSFiles;
Begin
If IsOpen(BLFile) Then Close(BLFile);
Assign(BLFile,Cfg.DataDir + 'BBSLIST.DAT');
ResetOrRewrite(BLFile, SizeOf(BBSRec));
End;
Function NumBBSes : Word;
Begin
NumBBSes := FileSize(BLFile)
End;
Procedure SeekBLFile (N : Word);
Begin
Seek(BLfile,N - 1);
End;
Procedure ListBBS;
Var Cnt,
b1,
b2 : Integer;
B : BBSRec;
Begin
OpenBBSFiles;
If NumBBSes = 0 Then
Begin
SendCr(^M^S'There are no entries! Add one!');
Close(BLFile);
Exit;
End
Else
Begin
ParseRange (NumBBSes,b1,b2,'BBS Listing');
SendCr('');
If B1 < 1 Then
Begin
Close(BLFile);
Exit;
End;
ListingFile(Cfg.TextFileDir + 'BBSLIST.TOP',True);
For Cnt := b1 to b2 Do
Begin
If Break Then EXIT;
SeekBLFile(cnt);
NRead(blfile,b);
Sr.C[1] := 'NA'; Sr.S[1] := B.Name; Sr.T[1] := 30;
Sr.C[2] := 'PH'; Sr.S[2] := B.Phone; Sr.T[2] := 12;
Sr.C[3] := 'BA'; Sr.S[3] := B.Baud; Sr.T[3] := 5;
Sr.C[4] := 'WA'; Sr.S[4] := B.Ware; Sr.T[4] := 8;
Sr.C[5] := 'EX'; Sr.S[5] := YesNo(B.Extended > 0); Sr.T[5] := 3;
Sr.C[6] := 'NU'; Sr.S[6] := Strr(Cnt); Sr.T[6] := 2;
ListingFile(Cfg.TextFileDir + 'BBSLIST.MID',False);
End;
ListingFile(Cfg.TextFileDir + 'BBSLIST.BOT',False);
End;
Close(BLFile);
End;
Procedure AddBBS;
Var M : Message;
B : BBSRec;
Begin
WriteHdr('Adding to BBS List');
SendCr('');
MultiColor(Strng^.AddBBS_Name);
NoCRInput('Aborted!',30);
If Inpt = '' Then Exit;
Fillchar(B,Sizeof(B),0);
B.Name := Inpt;
MultiColor(Strng^.AddBBS_Number);
NoCRInput('Aborted!',12);
If Inpt = '' Then Exit;
B.Phone := Inpt;
MultiColor(Strng^.AddBBS_Baud);
NoCRInput('14.4',4);
If Inpt = '' Then Inpt := '14.4';
B.Baud := Inpt;
MultiColor(Strng^.AddBBS_Type);
NoCRInput('Pipeline',8);
If Inpt = '' Then Inpt := 'PiPELiNE';
B.Ware := Inpt;
B.LeftBy := Unam;
DefYes := True;
WriteStr(Strng^.AddBBS_Upload);
If Yes Then
Begin
OkForTitle := False;
Quoting.AllowQuote := False;
FillChar(M,SizeOf(M),0);
M.Add_AutoSig := False;
B.Extended := Editor(M,False,False,True,'0','0','0','BBSANSI.TXT','BBSANSI.MAP');
OkForTitle := True;
End
Else B.Extended := -1;
OpenBBSFiles;
Seek(BLFile,FileSize(BLFile));
NWrite (BLFile,B);
SendCr('');
MultiColor (Strng^.BBS_Added);
Close(BLFile);
End;
Procedure ChangeBBS;
Var Q,
Spock : Integer;
K : Char;
B : BBSRec;
M : Message;
Procedure ShowBBS;
Begin
SendCr
(^M^R'['^A'1'^R'] Name.....: '^S+B.Name+
^M^R'['^A'2'^R'] Number...: '^S+B.Phone+
^M^R'['^A'3'^R'] Max Baud.: '^S+B.Baud+
^M^R'['^A'4'^R'] Software.: '^S+B.Ware+
^M^R'['^A'5'^R'] Extended.: '^S+YesNo(B.Extended>0)+
^M^R'['^A'Q'^R'] Quit');
End;
Begin
OpenBBSFiles;
Writehdr ('Change an Entry');
Spock := 0;
Repeat
Inpt := '';
WriteStr (^M^R'Entry to Change ['^A'?'^R']/List: &');
if inpt[1]='?' Then
Begin
ListBBS;
OpenBBSFiles;
End
Else
Begin
Spock:=valu(inpt);
If (Spock < 1) Or (Spock > NumBBSes) Then exit;
End;
Until (Spock > 0) Or (HungupOn);
SeekBlfile (Spock);
NRead (blfile,b);
If (Not (Match (B.LeftBy,Unam))) And (IsSysop=False) Then
Begin
SendCr(^M'You didn''t make the entry!'^M);
Close(BLFile);
Exit;
End;
Repeat
Showbbs;
WriteStr (^M^R'Edit Command ['^A'R'^R']eshow: *');
K := Upcase(Inpt[1]);
Case K of
'1' : GetString ('Name',b.name);
'2' : GetString ('Number',b.phone);
'3' : GetString ('Max Baud',b.baud);
'4' : GetString ('Software',b.ware);
'5' : If B.Extended>0 then
begin
ReloadText ('BBSANSI.TXT','BBSANSI.MAP',B.Extended,M);
M.Title := '';
M.Anon := False;
M.SendTo := 'All';
If ReEdit (M,True) then
begin
DeleteText ('BBSANSI.TXT','BBSANSI.MAP',B.Extended);
B.Extended := MakeText ('BBSANSI.TXT','BBSANSI.MAP',M,'');
If B.Extended < 1 Then SendCr(^M^S'Extended description/file reset...');
End
End
else
begin
Writestr(^M'Description doesn''t exist. Create One? !');
If Yes then
begin
OkForTitle := False;
Quoting.AllowQuote := False;
FillChar(M,SizeOf(M),0);
M.Add_AutoSig := False;
B.Extended := Editor(M,False,False,True,'0','0','0','BBSANSI.TXT','BBSANSI.MAP');
OkForTitle := True;
End;
End;
End;
Until (K='Q') Or (HungUpOn);
SeekBLFile(Spock);
NWrite (blfile,b);
Close(BLFile);
End;
Procedure ViewAnsi;
Var B : BBSRec;
S,F : Integer;
More : Boolean;
Begin
OpenBBSFiles;
If NumBBSes < 1 Then
Begin
SendCr('No listings...');
Close(BLFile);
Exit;
End;
WriteHdr('View Extended Info');
ParseRange (NumBBSes,S,F,'View Extended BBS Info');
If S < 1 Then
Begin
Close(BLFile);
Exit;
End;
More := S <> F;
For S := S To F Do
Begin
SeekBLFile(S);
NRead(BLFile,B);
If B.Extended > 0 Then PrintText('BBSANSI.TXT','BBSANSI.MAP',B.Extended)
Else SendCr(^M^S'No extended description for '^P + B.Name);
If More Then
Begin
DefYes := True;
WriteStr(Strng^.View_Extended_BBS);
If Not Yes Then
Begin
Close(BLFile);
Exit;
End;
End;
End;
SendCr('');
Close(BLFile);
End;
Procedure Deletebbs;
Var Bud,
Cnt,
N : Integer;
F : File;
B : BBSRec;
Begin
OpenBBSFiles;
Writehdr ('Delete a BBS');
Repeat
N:=0;
Writestr (^S^R'BBS number to delete? ['^A'?'^R']/List: *');
If Inpt='' Then Exit
Else
If Inpt = '?' Then
Begin
ListBBS;
OpenBBSFiles;
End
Else
Begin
Bud := Valu(inpt);
If Bud > Numbbses Then
Begin
Close(BLFile);
exit;
End;
N := Bud;
If N = 0 Then
Begin
Close(BLFile);
Exit;
End;
End;
Until (N>0) or (HungUpOn);
SeekBLFile(N);
NRead (blfile,B);
If ((Match (Unam,B.LeftBy)) = False) and (IsSysop = False) Then
Begin
SendCr(^G^M^S'That was not entered by you!');
Close(BLFile);
Exit;
End;
Writestr('Delete '+^S+B.name+^P+'? !');
If Not Yes Then
Begin
Close(BLFile);
Exit;
End;
DeleteText('BBSANSI.TXT','BBSANSI.MAP',B.Extended);
DeleteRecs(BLFile,N-1,1);
SendCr(^M'Deleted.');
Close(BLFile);
End;
End.