-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmail6.pas
303 lines (273 loc) · 7.11 KB
/
mail6.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
{$A+,B-,D-,E-,F+,I-,L-,N-,O+,R-,S+,V-}
unit mail6;
interface
uses crt, dos, overlay, common;
procedure editmessage(var i:longint);
procedure movemsg(x:word);
procedure doshowpackbases;
procedure packmessagebases;
procedure chbds;
implementation
uses mail0, mail1, mail7, msgpack, sysop3;
procedure editmessage(var i:longint);
var t:text;
f:file;
mheader:mheaderrec;
s:string;
fname:string[12];
dfdt1,dfdt2,totload:longint;
oldfileattach:byte;
begin
loadheader(i,mheader);
fname:='TEMPQ'+cstr(node)+'.MSG';
reset(msgtxtf,1);
assign(t,fname); rewrite(t);
if (IOResult <> 0) then
begin
sysoplog('error editing message.');
exit;
end;
totload:=0;
seek(msgtxtf,mheader.pointer-1);
repeat
blockread(msgtxtf,s[0],1);
blockread(msgtxtf,s[1],ord(s[0]));
Lasterror := IOResult;
if (Lasterror <> 0) then
begin
sysoplog('error loading message text.');
totload := mheader.textsize;
end;
inc(totload,length(s)+1);
writeln(t,s);
until (totload>=mheader.textsize);
close(t);
getftime(t,dfdt1);
close(msgtxtf);
oldfileattach := mheader.fileattached; { yet another kludge }
if not (InputMessage((ReadBoard <> -1), FALSE, '',mheader, fname)) then
begin
kill(fname);
exit;
end;
mheader.fileattached := oldfileattach;
assign(f,fname);
getftime(f,dfdt2);
if (dfdt1<>dfdt2) then begin
assign(t,fname);
reset(t);
mheader.textsize:=0;
reset(msgtxtf,1);
mheader.pointer:=filesize(msgtxtf)+1;
seek(msgtxtf,mheader.pointer-1);
repeat
readln(t,s);
if (IOResult <> 0) then
print('error reading edited text.');
inc(mheader.textsize,length(s)+1);
blockwrite(msgtxtf,s,length(s)+1);
until (eof(t));
close(msgtxtf);
close(t);
saveheader(i,mheader);
end;
Lasterror := IOResult;
kill(fname);
end;
procedure movemsg(x:word);
var f:file;
f2:file of mheaderrec;
mheader:mheaderrec;
s:astr;
totload:longint;
i,oldboard:integer;
done,oconf:boolean;
begin
nl;
oconf := confsystem;
confsystem := FALSE;
oldboard := readboard;
if oconf then newcomptables;
if ((x>=0) and (x<=himsg)) then begin
i:=0; done:=FALSE;
repeat
prt('Enter board #, (?)List, or (Q)uit : ');
scaninput(s,'?Q'^M);
if (s='Q') or (s=^M) or (s='') then
done:=TRUE
else
if (s='?') then
begin
mbaselist(FALSE);
end
else
begin
i:=ambase(value(s));
if ((i>=1) and (i<>readboard) and (i<=MaxMBases)) then
done:=TRUE
else
print('Can''t move it there.');
end;
until ((done) or (hangup));
if ((i>=1) and (i<=MaxMBases)) then begin
if (mbaseac(i)) then begin
initboard(oldboard);
loadheader(x,mheader);
loadboard(i);
assign(f2,general.msgpath+memboard.filename+'.HDR');
reset(f2);
if (ioresult = 2) then rewrite(f2);
assign(f,general.msgpath+memboard.filename+'.DAT');
reset(f,1);
if (ioresult = 2) then rewrite(f,1);
seek(f2,filesize(f2));
reset(msgtxtf,1);
seek(msgtxtf,mheader.pointer-1);
mheader.pointer:=filesize(f)+1;
seek(f,filesize(f));
mheader.status := mheader.status - [mdeleted];
write(f2,mheader);
close(f2);
totload:=0;
repeat
blockread(msgtxtf,s[0],1);
blockread(msgtxtf,s[1],ord(s[0]));
Lasterror := IOResult;
blockwrite(f,s,length(s)+1);
inc(totload,length(s)+1);
until (totload>=mheader.textsize);
close(f);
close(msgtxtf);
initboard(oldboard);
loadheader(x,mheader);
mheader.status:=mheader.status+[mdeleted];
saveheader(x, mheader);
print(^M^J'Move successful.');
end;
end;
end;
Lasterror := IOResult;
nl;
confsystem := oconf;
initboard(oldboard);
if oconf then newcomptables;
end;
procedure doshowpackbases;
var tempboard:boardrec;
i:integer;
begin
TempPause := FALSE;
sysoplog('Packed all message bases');
nl;
star('Packing all message bases'^M^J);
print('^1Packing ^5Private Mail'); packbase('email',0);
reset(MBasesFile);
if (IOResult <> 0) then exit;
Abort := FALSE;
for i:=0 to filesize(MBasesFile)-1 do
begin
seek(MBasesFile,i); read(MBasesFile,tempboard);
print('^1Packing ^5'+tempboard.name+'^5 #'+cstr(i+1));
packbase(tempboard.filename,tempboard.maxmsgs);
wkey;
if (abort) then break;
end;
close(MBasesFile);
lil:=0;
end;
procedure packmessagebases;
begin
nl;
if pynq('Pack all message bases? ') then doshowpackbases else begin
with memboard do begin
initboard(board);
sysoplog('Packed message base ^5'+memboard.name);
print(^M^J'^1Packing ^5'+name+'^5 #'+cstr(cmbase(board)));
packbase(filename,maxmsgs);
end;
end;
end;
procedure chbds;
var
s:string[15];
First,
Last,
Temp:word;
oldconf:boolean;
begin
oldconf := confsystem;
confsystem := FALSE;
if (oldconf) then
newcomptables;
if (novice in thisuser.flags) then
mbaselist(TRUE)
else
nl;
repeat
prt('Range to toggle (^5x^4-^5y^4), [F]lag or [U]nflag all, [Q]uit (^5?^4=^5List^4): ');
scaninput(s,'FUQ-?'^M);
if (s = '?') then
mbaselist(TRUE)
else
if (s = 'F') then
begin
print(^M^J'You are now reading all message bases.'^M^J);
for Temp := 1 to MaxMBases do
begin
initboard(Temp);
if not NewScanMBase then
NewScanMBase := ToggleNewScan;
end
end
else
if (s = 'U') then
begin
print(^M^J'You are now not reading any message bases.'^M^J);
for Temp := 1 to MaxMBases do
begin
initboard(Temp);
if NewScanMBase and not (mbforceread in memboard.mbstat) then
NewScanMBase := ToggleNewScan;
end
end
else
if (value(s) > 0) then
begin
First := ambase(value(s));
if (pos('-', s) > 0) then
begin
Last := ambase(value(copy(s, pos('-', s) + 1, 255)));
if (First > Last) then
begin
Temp := First;
First := Last;
Last := Temp;
end;
end
else
Last := First;
if (First >= 1) and (Last <= MaxMBases) then
begin
for Temp := First to Last do
begin
initboard(Temp);
if not (mbforceread in memboard.mbstat) then
begin
NewScanMBase := ToggleNewScan;
if (First = Last) then
print(^M^J'^5' + memboard.name + '^3 will ' + aonoff(NewScanMBase, 'not ','') + 'be scanned.'^M^J);
end
else
print(^M^J'^5' + memboard.name + '^3 cannot be removed from your newscan.'^M^J)
end;
end
else
print(^M^J'Invalid range.'^M^J);
end;
until (s = 'Q') or (hangup);
confsystem := oldconf;
if (oldconf) then
newcomptables;
lastcommandovr := TRUE;
end;
end.