Skip to content

Latest commit

 

History

History
372 lines (347 loc) · 9.85 KB

mail6.pas

File metadata and controls

372 lines (347 loc) · 9.85 KB
 
Nov 18, 2000
Nov 18, 2000
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
{$A+,B+,D-,E+,F+,I+,L+,N-,O+,R-,S+,V-}
unit mail6;
interface
uses
crt, dos,
{rcg11172000 no overlay under Linux.}
{overlay,}
common,
mail0, mail3, mail9, msgpack;
procedure movemsg(x:integer);
procedure mailr;
procedure dopurgepub(cms:string);
procedure purgepriv;
procedure doshowpackbases;
procedure packmessagebases;
procedure chbds;
implementation
procedure movemsg(x:integer);
var f:file;
pinfo:pinforec;
mheader:mheaderrec;
mixr:msgindexrec;
s:string;
brdsig,totload:longint;
i,oldboard:integer;
done:boolean;
begin
nl;
if ((x>=0) and (x<=himsg)) then begin
i:=0; done:=FALSE;
repeat
prt('Enter board #, (?)List, or (Q)uit : '); input(s,3);
if ((s='') or (s='Q')) then done:=TRUE
else
if (s='?') then begin mbaselist; nl; end
else begin
i:=ccboards[0][value(s)];
if ((i>=1) and (i<>board) and (i<=numboards)) then done:=TRUE;
if (not done) then print('Can''t move it there.');
end;
until ((done) or (hangup));
if ((i>=1) and (i<=numboards)) then begin
oldboard:=board;
changeboard(i);
if (board=i) then begin
board:=oldboard;
ensureloaded(x); mixr:=mintab[getmixnum(x)];
loadmhead(x,mheader);
savepinfo(pinfo);
assign(f,systat.msgpath+brdfnopen+'.BRD'); reset(f,1);
initbrd(i);
seek(f,mixr.hdrptr);
blockread(f,mheader,sizeof(mheaderrec));
mixr.hdrptr:=filesize(brdf);
mheader.msgptr:=mixr.hdrptr+sizeof(mheaderrec);
seek(brdf,mixr.hdrptr);
blockwrite(brdf,mheader,sizeof(mheaderrec));
totload:=0;
repeat
blockreadstr2(f,s);
blockwritestr2(brdf,s);
inc(totload,length(s)+2);
until (totload>=mheader.msglength);
savemhead(mheader);
newmix(mixr);
loadpinfo(pinfo);
changeboard(oldboard);
delmail(x);
print('Move successful.');
nl;
end;
end;
end;
end;
procedure mailr;
var mixr:msgindexrec;
i,j:integer;
c:char;
abort,next,gonext,contlist:boolean;
begin
readingmail:=TRUE;
contlist:=FALSE; gonext:=FALSE;
initbrd(-1);
i:=himsg; c:=#0;
if ((thisuser.clsmsg<>1) and (i>=0)) then nl;
while ((i>=0) and (c<>'Q') and (not hangup)) do begin
ensureloaded(i); mixr:=mintab[getmixnum(i)];
gonext:=FALSE;
repeat
if (c<>'?') then begin
if ((thisuser.clsmsg=1) and (not contlist)) then cls;
readmsg(3,i,i,himsg,abort,next);
end;
if (not contlist) or ((abort) and (not next)) then begin
if (contlist) then begin
print('Continuous message listing off.'); nl;
contlist:=FALSE;
end;
prt('Mail read (?=help) : '); onek(c,'Q-CDGILNR?'^M^N);
end else
c:='I';
case c of
'?':begin
nl;
sprint('<^3CR^1>Next message');
lcmds(20,3,'Ignore message','-Previous message');
lcmds(20,3,'Goto message','Continuous listing');
lcmds(20,3,'Re-read message','Delete message');
lcmds(20,3,'Quit','');
nl;
end;
'-':if (i<himsg) then inc(i);
'C':begin
nl;
print('Continuous message listing on.');
contlist:=TRUE;
end;
'D':if (miexist in mixr.msgindexstat) then begin
sysoplog('* Deleted mail to '+rmail(i));
print('Mail deleted.');
end else begin
sysoplog('* Undeleted mail to '+rmail(i));
print('Mail undeleted.');
end;
'G':begin
prt('Goto which message? (1-'+cstr(himsg)+') : ');
inu(j);
if (not badini) then
if ((j>=0) and (j<=himsg)) then i:=j;
end;
'R':;
else
gonext:=TRUE;
end;
until ((pos(c,'?LR')=0) or (gonext) or (hangup));
if (gonext) then dec(i);
gonext:=FALSE;
end;
closebrd;
readingmail:=FALSE;
end;
procedure purgepub(global:boolean);
var oldboard:integer;
abort,next:boolean;
procedure purgeit;
var mheader:mheaderrec;
mixr:msgindexrec;
pc:string;
cn:integer;
c:char;
begin
abort:=FALSE; next:=FALSE;
nl;
initbrd(board);
sprint(#3#3+'[--> Purge '+#3#5+memboard.name+#3#3' <--]');
cn:=0; c:=#0;
while ((cn<=himsg) and (not abort) and (not hangup)) do begin
ensureloaded(cn); mixr:=mintab[getmixnum(cn)]; loadmhead(cn,mheader);
if (mheader.fromi.usernum<>usernum) then
inc(cn)
else begin
if (c<>'?') then readmsg(4,cn,cn+1,himsg+1,abort,next);
if (not next) then begin
pc:='QDIR?'^M^N;
if (global) then pc:=pc+'B';
prt('Purge posts (?=help) : '); onek(c,pc);
end else
c:='I';
case c of
'?':begin
nl;
sprint('<'+#3#3+'CR'+#3#1+'>Next msg');
lcmds(12,3,'Re-read msg','Ignore (next msg)');
if (global) then
lcmds(12,3,'Delete msg','BNext board in purge')
else
lcmds(12,3,'Delete msg','');
lcmds(12,3,'Quit','');
nl;
end;
'D':if (mipermanent in mixr.msgindexstat) then
print('This is a permanent message.')
else begin
if (miexist in mixr.msgindexstat) then
sysoplog('- "'+mheader.title+'" purged off '+
#3#5+memboard.name)
else
sysoplog('+ "'+mheader.title+'" unpurged on '+
#3#5+memboard.name);
delmail(cn);
end;
^M,^N,'I':inc(cn);
'B','Q':begin
abort:=TRUE; cn:=himsg+1;
if (c='B') then next:=TRUE;
end;
end;
end;
end;
nl;
sprint(#3#4+'[--> '+#3#5+memboard.name+#3#4+' Purge DONE <--]');
closebrd;
end;
procedure globalpurge;
var i:integer;
begin
nl;
sprint(#3#7+')>=- Global Purge -=<(');
i:=1; changeboard(i);
repeat
if ((mbaseac(board)) and (board=i)) then purgeit;
inc(i); changeboard(i);
if (next) then abort:=FALSE;
until ((i>numboards) or (abort) or (hangup));
nl;
sprint(#3#7+'[> Global Purge COMPLETE <]');
end;
begin
oldboard:=board;
if (global) then globalpurge else purgeit;
board:=oldboard;
end;
procedure dopurgepub(cms:string);
var i:integer;
begin
if (cms='C') then purgepub(FALSE)
else if (cms='G') then purgepub(TRUE)
else if (value(cms)<>0) then begin
i:=board;
changeboard(value(cms));
if (board=value(cms)) then purgepub(FALSE);
changeboard(i);
end else begin
nl;
purgepub(pynq('Global purge? '));
end;
end;
procedure purgepriv;
var mheader:mheaderrec;
mixr:msgindexrec;
i:integer;
c:char;
abort,done,next:boolean;
begin
readingmail:=TRUE; done:=FALSE;
nl;
initbrd(-1);
i:=0; c:=#0;
while ((i<=himsg) and (not done) and (not hangup)) do begin
ensureloaded(i); mixr:=mintab[getmixnum(i)]; loadmhead(i,mheader);
if (mheader.fromi.usernum<>usernum) then
inc(i)
else begin
if (c<>'?') then begin
if ((thisuser.clsmsg=1) and (not contlist)) then cls;
readmsg(4,i,i+1,himsg+1,abort,next);
end;
prt('Delete mail (?=help) : '); onek(c,'QDINR?'^M^N);
case c of
'?':begin
nl;
sprint('<^3CR^1>Next message');
lcmds(20,3,'Re-read message','Ignore (next message)');
lcmds(20,3,'Delete message','Quit');
nl;
end;
'Q':done:=TRUE;
'D':if (miexist in mixr.msgindexstat) then begin
sysoplog('* Deleted mail to '+rmail(i));
print('Mail deleted.');
end else begin
sysoplog('* Undeleted mail to '+rmail(i));
print('Mail undeleted.');
end;
else
inc(i);
end;
end;
end;
closebrd; topscr;
readingmail:=FALSE;
end;
procedure doshowpackbases;
var tempboard:boardrec;
i:integer;
b:boolean;
begin
b:=(pause in thisuser.ac);
thisuser.ac:=thisuser.ac-[pause];
nl;
sysoplog('Packed all message bases');
sprint(#3#4+'þþ '+#3#3+'Packing all message bases '+#3#4+'þþ');
nl;
sprint(#3#1+'Packing '+#3#5+'Private Mail'); packbase('email',0);
reset(bf);
for i:=0 to filesize(bf)-1 do begin
reset(bf); seek(bf,i); read(bf,tempboard);
sprint(#3#1+'Packing '+#3#5+tempboard.name+#3#5+' #'+cstr(i+1));
packbase(tempboard.filename,tempboard.maxmsgs);
end;
reset(bf); close(bf);
lil:=0;
if (b) then thisuser.ac:=thisuser.ac+[pause];
end;
procedure packmessagebases;
begin
nl;
if pynq('Pack all message bases? ') then doshowpackbases else begin
with memboard do begin
sysoplog('Packed message base '+#3#5+memboard.name);
nl; sprint(#3#1+'Packing '+#3#5+name+#3#5+' #'+cstr(ccboards[1][board]));
packbase(filename,maxmsgs);
end;
end;
end;
procedure chbds;
var s:astr;
i:integer;
done:boolean;
begin
nl;
if (novice in thisuser.ac) then begin mbaselist; nl; end;
done:=FALSE;
repeat
prt('Set NewScan message bases (Q=Quit,?=List,#=Toggle base) : '); input(s,3);
if (s='Q') then done:=TRUE;
if (s='?') then begin mbaselist; nl; end;
i:=ccboards[0][value(s)];
if (mbaseac(i)) then { loads memboard }
if (i>=1) and (i<=numboards) and
(length(s)>0) and (s[1] in ['0'..'9']) then begin
nl;
sprompt(#3#5+memboard.name+#3#3);
if (i in zscanr.mzscan) then begin
sprint(' will NOT be scanned.');
zscanr.mzscan:=zscanr.mzscan-[i];
end else begin
sprint(' WILL be scanned.');
zscanr.mzscan:=zscanr.mzscan+[i];
end;
nl;
end;
until (done) or (hangup);
lastcommandovr:=TRUE;
savezscanr;
end;
end.