-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmail5.pas
More file actions
969 lines (908 loc) · 26.7 KB
/
mail5.pas
File metadata and controls
969 lines (908 loc) · 26.7 KB
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
{$A+,B-,D-,E-,F+,I-,L-,N-,O+,R-,S+,V-}
unit mail5;
interface
uses crt, dos, overlay, common, timefunc;
procedure Post(replyto:longint; var ttoi:fromtoinfo; private:boolean);
procedure ReadMessages;
procedure ScanMessages(mstr:astr);
procedure NewScan(b:integer; var quit:boolean);
procedure GlobalNewScan;
procedure StartNewScan(var mstr:astr);
procedure ScanYours;
function firstnew:word;
implementation
uses sysop3, sysop4, mail0, mail1, Email, mail6, cuser, multnode, menus;
var
TempLastRead:longint;
procedure Post(replyto:longint; var ttoi:fromtoinfo; private:boolean);
var mheader,mheader2:mheaderrec;
ok:boolean;
procedure nope(s:astr);
begin
if (ok) then
print(^M^J + s + ^M^J);
ok:=FALSE;
end;
begin
ok:=TRUE;
loadboard(board);
if (not aacs(memboard.postacs)) then
nope('Your access does not allow you to post on this base.');
if (AccountBalance < General.CreditPost) and not (fnocredits in thisuser.flags) then
nope('Insufficient account balance to post a message.');
if ((rpost in thisuser.flags) or (not aacs(general.normpubpost))) then
nope('Your access priviledges do not include posting.');
if ((ptoday>=general.maxpubpost) and (not MsgSysOp)) then
nope('Too many messages posted today.');
if (ok) then begin
{xbread := readboard;}
initboard(board);
mheader.fileattached:=0;
mheader.status := [];
if (replyto <> -1) then begin
mheader.mto := ttoi;
if (mheader.mto.anon > 0) then
begin
mheader.mto.as := Usename(mheader.mto.anon,mheader.mto.as);
{ mheader.mto.real := mheader.mto.as; }
end;
end else
begin
fillchar(mheader.mto,sizeof(mheader.mto),0);
irt := '';
end;
if (InputMessage(TRUE,(replyto<>-1),'',mheader,'')) then
begin
if (replyto <> -1) then
mheader.replyto := (HiMsg + 1) - replyto;
if Private then
mheader.status := mheader.status + [Prvt];
saveheader(HiMsg+1,mheader);
if (replyto<> -1) then
begin
loadheader(replyto,mheader2);
inc(mheader2.replies);
saveheader(replyto,mheader2);
end;
sysoplog(mheader.subject+' posted on ^5'+memboard.name);
if (mheader.mto.as<>'') then
sysoplog(' To: "'+mheader.mto.as+'"');
print('^9Message posted on ^5'+memboard.name+'^9.'^M^J);
inc(thisuser.msgpost);
if not (fnocredits in thisuser.flags) then
AdjustBalance(General.CreditPost);
saveurec(thisuser, usernum);
inc(ptoday);
update_screen;
end;
{initboard(xbread);}
end;
end;
procedure MainRead(var quit:boolean; oneonly:boolean);
var
u:userrec;
mheader:mheaderrec;
old_menu, cmd, newmenucmd, s, s1:astr;
getm:longint;
i,j:integer;
threadstart:word;
Done,Cmdnothid,Cmdexists,ShowPrompt,b,
AskPost,ContList,DoneScan,HadUnval:boolean;
procedure ListMessages;
var
q:word;
adate:datetime;
numdone:byte;
begin
abort:=FALSE; numdone:=0;
q:=HiMsg;
if ((Msg_On<1) or (Msg_On>q)) then exit;
cls;
printacr('ÚÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄ¿');
printacr('³ Msg# ³ Sender ³ Receiver ³ '+
'Subject ³! Posted ³');
printacr('ÀÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÙ');
dec(Msg_On);
while ((not hangup) and (not abort) and (numdone < pagelength - 7) and (Msg_On >= 0) and (Msg_On < q)) do begin
inc(Msg_On);
loadheader(Msg_On,mheader);
if ((not (unvalidated in mheader.status))
and not (mdeleted in mheader.status))
or (MsgSysOp) then begin
if (mdeleted in mheader.status) then s:='''D '
else if (unvalidated in mheader.status) then s:='''U '
else if ToYou(mheader) or FromYou(mheader) then s:='''> '
else if (TempLastRead < mheader.date) then s:='''* '
else s:=' ';
s:=s + '"' + mln(cstr(Msg_On),5)+' #';
if (mbrealname in memboard.mbstat) then
s1:=Usename(mheader.from.anon,mheader.from.real)
else
s1:=Usename(mheader.from.anon,mheader.from.as);
s:=s+mln(s1,18)+' $';
if ((mbrealname in memboard.mbstat) and (mheader.mto.real<>'')) then
s1:=Usename(mheader.mto.anon,mheader.mto.real)
else
s1:=Usename(mheader.mto.anon,mheader.mto.as);
s:=s+mln(s1,19)+' % ';
if (mheader.fileattached = 0) then
s := s + mln(mheader.subject,18)
else
s := s + mln(stripname(mheader.subject),18);
packtodate(adate,mheader.date);
s:=s+' &'+Zeropad(cstr(adate.month))+'/'+Zeropad(cstr(adate.day))+'/'+Zeropad(cstr(adate.year));
if (allowmci in mheader.status) then
printacr(s)
else
print(s);
inc(numdone);
end;
wkey;
end;
ShowPrompt := TRUE;
{if (Msg_On>=q) and (Msg_On-2>=1) then dec(Msg_On,2) else dec(Msg_On);}
if (Msg_On = q) then
begin
dec(Msg_On);
loadheader(Msg_On, mheader);
end;
end;
function CantBeSeen:boolean;
begin
CantBeSeen := (not MsgSysOp) and ((unvalidated in mheader.status) or (mdeleted in mheader.status) or
((prvt in mheader.status) and not (ToYou(Mheader) or FromYou(Mheader))));
end;
begin
AskPost:=FALSE; ContList:=FALSE; DoneScan:=FALSE; HadUnval:=FALSE;
threadstart:=0; treadprompt := 0; Abort:=FALSE;
old_menu := curmenu; { otherwise it fucks up calling other menus }
curmenu := general.menupath + 'readp.mnu';
if (not newmenutoload) then
readin2;
AllowContinue := TRUE;
i:=1;
newmenucmd:='';
while ((i<=noc) and (newmenucmd='')) do
begin
if (MenuCommand^[i].ckeys='FIRSTCMD') then
begin
if (aacs(MenuCommand^[i].acs)) then
begin
newmenucmd:='FIRSTCMD';
domenuexec(cmd,newmenucmd);
end;
end;
inc(i);
end;
repeat
if (ContList) and (abort) then
begin
ContList := FALSE;
print(^M^J'Continuous message listing off.'^M^J);
treadprompt := 255;
end;
if (Msg_On < 1) or (Msg_On > HiMsg) then
begin
if (not ContList) then
begin
DoneScan := TRUE;
AskPost := TRUE;
end
else
begin
ContList := FALSE;
Msg_On := HiMsg;
print(^M^J'Continuous message listing off.'^M^J);
treadprompt := 255;
end;
end;
if (not DoneScan) and (treadprompt in [0..2,8..10,18]) then
begin
if (ContList) then
next := TRUE;
loadheader(Msg_On, mheader);
if (unvalidated in mheader.status) then
HadUnval := TRUE;
while (((Msg_On < HiMsg) and (treadprompt <> 2)) or
((Msg_On > 1) and (treadprompt = 2))) and
CantBeSeen do
begin
if (treadprompt = 2) then
dec(Msg_On)
else
inc(Msg_On);
loadheader(Msg_On, mheader);
end;
if ((Msg_On = 1) or (Msg_On = HiMsg)) and CantBeSeen then
begin
DoneScan := TRUE;
AskPost := TRUE;
end
else
begin
if ((clsmsg in thisuser.sflags) and (not ContList)) then
cls
else
nl;
readmsg(Msg_On, Msg_On, HiMsg);
if (TempLastRead < mheader.date) and (mheader.date <= getpackdatetime) then
TempLastRead := mheader.date;
inc(mread);
end;
end;
if (not ContList) and (not DoneScan) then
repeat
treadprompt := 0;
mainmenuhandle(cmd);
newmenucmd := ''; j := 0; done := FALSE;
repeat
fcmd(cmd, j, noc, cmdexists, cmdnothid);
if (j <> 0) and (MenuCommand^[j].cmdkeys <> '-^') and
(MenuCommand^[j].cmdkeys <> '-/') and (MenuCommand^[j].cmdkeys <> '-\') then
domenucommand(done, MenuCommand^[j].cmdkeys + MenuCommand^[j].options, newmenucmd);
until (j = 0) or (done) or (hangup);
abort := FALSE; next := FALSE;
case treadprompt of
1:;
2:if (Msg_On = 1) then
print(^M^J'Already at the first message.'^M^J)
else
dec(Msg_On, 1);
3:if MsgSysOp then movemsg(msg_on);
4:if CoSysOp then extract(msg_on);
5:if (MsgSysOp) or FromYou(mheader) then
begin
repeat
prt(^M^J'Message editing (^5?^4=^5Help^4) : ');
if (MsgSysOp) then
onek(cmd[1],'?VPRAFTSEODQ'^M)
else
onek(cmd[1],'?FTSEODQ'^M);
nl;
case cmd[1] of
'?':begin
lcmds(15,5,'From', 'To');
lcmds(15,5,'Subject', 'Edit text');
lcmds(15,5,'Oops', 'Display header');
if (MsgSysOp) then
begin
lcmds(15,5,'Permanent', 'Validation');
lcmds(15,5,'Rescan', 'Anonymous');
end;
lcmds(15,5,'Quit','');
end;
'D':for i:=1 to 5 do
printacr(headerline(mheader,msg_on,himsg,i));
'O':if pynq('Reload old information? ') then
loadheader(msg_on,mheader);
'E':begin
editmessage(msg_on);
loadheader(msg_on,mheader);
end;
'S':if (mheader.fileattached = 0) or (MsgSysOp) then
inputdefault(mheader.subject, mheader.subject, 40, 'C', TRUE)
else
print('Sorry, you can''t edit that.^M^J');
'T':begin
prt('Edit name (P)osted to, (R)eal name, (S)ystem name : ');
onek(cmd[1],'PRS'^M);
case cmd[1] of
'P':inputdefault(mheader.mto.as,mheader.mto.as,36,'',TRUE);
'R':inputdefault(mheader.mto.real,mheader.mto.real,36,'',TRUE);
'S':inputdefault(mheader.mto.name,mheader.mto.name,36,'',TRUE);
end;
end;
'F':if (mheader.from.anon > 0) or (MsgSysOp) then
begin
prt('Edit name (P)osted as, (R)eal name, (S)ystem name : ');
onek(cmd[1],'PRS'^M);
case cmd[1] of
'P':inputdefault(mheader.from.as,mheader.from.as,36,'',TRUE);
'R':inputdefault(mheader.from.real,mheader.from.real,36,'',TRUE);
'S':inputdefault(mheader.from.name,mheader.from.name,36,'',TRUE);
end;
end
else
print('Sorry, you can''t edit that.^M^J');
'A':begin
if (mheader.from.anon in [1,2]) then
mheader.from.anon:=0
else begin
i:=mheader.from.usernum;
loadurec(u,i);
b:=aacs1(u,i,general.csop);
if (b) then mheader.from.anon:=2 else mheader.from.anon:=1;
end;
if (mheader.from.anon=0) then s:='not '
else s:='';
s:='Message is '+s+'anonymous';
print(s);
sysoplog(s);
end;
'R':if (MsgSysOp) then begin
if (sent in mheader.status) then
begin
mheader.status:=mheader.status-[sent];
if not (mbscanout in memboard.mbstat) then
UpdateBoard;
s:='not ';
end
else
begin
mheader.status:=mheader.status+[sent];
s:='';
end;
s:='Message '+s+'marked as scanned.';
print(s);
sysoplog(s);
end;
'P':if (MsgSysOp) then begin
if (permanent in mheader.status) then begin
mheader.status:=mheader.status-[permanent];
s:='not ';
s1:='un';
end else begin
mheader.status:=mheader.status+[permanent];
s:='';
s1:='';
end;
s:='Message is '+s+'permanent.';
print(s);
sysoplog(s);
end;
'V':begin
if (unvalidated in mheader.status) then begin
s:='';
mheader.status:=mheader.status-[unvalidated];
end else begin
s:='un';
mheader.status:=mheader.status+[unvalidated];
end;
print(^M^J'Message '+s+'validated.'^M^J);
sysoplog('* '+s+'validated '+mheader.subject);
end;
end;
until (cmd[1] in ['Q',^M]) or (hangup);
saveheader(msg_on,mheader);
end;
6:begin
dumpquote(mheader);
nl;
if (prvt in mheader.status) then dyny := TRUE;
if (mheader.from.anon = 0) or (aacs(general.anonpubread)) then
if pynq('Is this to be a private reply? ') then
if (mbprivate in memboard.mbstat) then
if pynq('Reply in Email? ') then
autoreply(mheader)
else
Post(msg_on,mheader.from,TRUE)
else
autoreply(mheader)
else
Post(msg_on,mheader.from,FALSE)
else
Post(msg_on,mheader.from,FALSE);
end;
7:begin
Msg_On := himsg + 1;
loadheader(himsg, mheader);
if (mheader.date <= getpackdatetime) then
TempLastRead := Mheader.Date;
end;
8:if (msg_on - mheader.replyto > 0) and (mheader.replyto > 0) then
begin
if (threadstart = 0) then
threadstart := msg_on;
dec(Msg_On, mheader.replyto);
end;
9:if ((threadstart > 0) and (threadstart <= himsg)) then
begin
Msg_On := threadstart;
threadstart := 0;
end;
10:begin
contlist:=TRUE; abort:=FALSE;
print(^M^J'Continuous message listing on.'^M^J);
end;
11:if (permanent in mheader.status) then
print(^M^J'This is a permanent message.'^M^J)
else
begin
if (msg_on > 0) and (msg_on <= himsg) and
(MsgSysOp or FromYou(mheader)) then
begin
loadheader(Msg_On, mheader);
if (mdeleted in mheader.status) then
mheader.status := mheader.status - [mdeleted]
else
mheader.status := mheader.status + [mdeleted];
saveheader(Msg_On, mheader);
if not (mdeleted in mheader.status) then
begin
if FromYou(mheader) then
begin
if (thisuser.msgpost < 65535) then inc(thisuser.msgpost);
AdjustBalance(General.CreditPost);
end;
print(^M^J'Undeleted message.');
sysoplog('* Undeleted '+mheader.subject);
end
else
begin
if FromYou(mheader) then
begin
if (thisuser.msgpost > 0) then dec(thisuser.msgpost);
AdjustBalance(-General.CreditPost);
end;
print(^M^J'Deleted message.');
sysoplog('* Deleted '+mheader.subject);
end;
nl;
end
else
print(^M^J'That isn''t your message.'^M^J);
end;
12:begin
print(^M^J'Highest-read pointer for this base set to message #'+
cstr(msg_on)+'.'^M^J);
if (mheader.date <= getpackdatetime) then
TempLastRead := Mheader.Date;
end;
13:DoneScan := TRUE;
14:begin
DoneScan := TRUE;
Quit := TRUE;
end;
15:ListMessages;
16:if (CoSysOp) and CheckPw then
if lastauthor <> 0 then
uedit(lastauthor)
else
uedit(1);
17:if not (mbforceread in memboard.mbstat) then begin
if ToggleNewScan then
begin
s:='will NOT';
s1:='out of';
end
else
begin
s:='WILL';
s1:='back in';
end;
sysoplog('* Toggled ^5'+memboard.name+'^1 '+s1+' new scan.');
print(^M^J'^5'+memboard.name+'^3 '+s+' be scanned in future new scans.'^M^J);
end
else
print('^5' + memboard.name + '^3 cannot be removed from your newscan.');
18:inc(Msg_On); { Next }
end;
until (treadprompt in [1..2,7..10,13..15,18]) or (abort) or (next) or (hangup)
else
inc(Msg_On);
if (OneOnly) and (treadprompt in [13,14,18]) then
DoneScan := TRUE;
until (DoneScan) or (HangUp);
AllowContinue := FALSE;
curmenu := Old_menu;
newmenutoload := TRUE;
if ((HadUnval) and (MsgSysOp)) then
begin
nl;
if pynq('Validate messages here? ') then
begin
reset(msghdrf);
for i:=1 to HiMsg do
begin
loadheader(i,mheader);
if (unvalidated in mheader.status) then
mheader.status:=mheader.status-[unvalidated];
saveheader(i,mheader);
end;
close(msghdrf);
end;
end;
if ((AskPost) and (aacs(memboard.postacs)) and
(not (rpost in thisuser.flags)) and (ptoday<general.maxpubpost)) then
begin
nl;
if (treadprompt <> 7) then
if pynq('Post on ^5'+memboard.name+'^7? ') then
if (mbprivate in memboard.mbstat) then
Post(-1,mheader.from,pynq('Is this to be a private message? '))
else
Post(-1,mheader.from,FALSE);
end;
end;
procedure ReadMessages;
var
i:integer;
s:astr;
quit:boolean;
OldActivity:byte;
begin
initboard(board);
OldActivity := update_node(3);
nl;
if (HiMsg = 0) then
print('No messages on ^5'+memboard.name+'^1.')
else
begin
prompt(^M^J + fstring.readq);
scaninput(s,'Q');
i := value(s);
Msg_On := 1;
if (i < 1) then
i := 0
else
if (i <= HiMsg) then
Msg_On := i;
TempLastRead := LastMsgRead;
if (s <> 'Q') then
MainRead(quit,FALSE);
SaveLastRead(TempLastRead);
end;
update_node(OldActivity);
end;
function firstnew:word;
var
done:boolean;
MaxMsgs,cn,i:integer;
mheader:mheaderrec;
begin
MaxMsgs := filesize(msghdrf);
cn := 0;
if (MaxMsgs > 0) then
begin
cn := 1;
done := FALSE;
i := (MaxMsgs div 20) + 1;
while not done do
begin
loadheader(cn,mheader);
if not (LastMsgRead < mheader.date) then { LastMsgRead used instead
of TempLastRead 'cause it
won't matter here }
begin
if cn + i < MaxMsgs then
inc(cn,i)
else
done:=TRUE;
end
else
begin
if (cn - i - 1) > 0 then
dec(cn,i + 1);
done:=TRUE;
end;
end;
loadheader(cn,mheader);
while (cn < MaxMsgs) and not (LastMsgRead < mheader.date) do
begin
inc(cn);
loadheader(cn,mheader);
end;
if not (LastMsgRead < mheader.date) then
cn := 0;
end;
firstnew := cn;
end;
procedure ScanMessages(mstr:astr);
var
c:char;
CurrentMessage,CurrentBoard:integer;
ScanFor:string[40];
ScanNew, ScanGlobal, Quit:boolean;
OldActivity:byte;
procedure searchboard;
var
OldBoard:word;
MsgHeader:mheaderrec;
Match,
Anyshown:boolean;
Searched:string;
TotalLoaded:longint;
begin
OldBoard := Board;
if Board <> CurrentBoard then changeboard(CurrentBoard);
if (Board = CurrentBoard) then
begin
initboard(Board);
Anyshown := FALSE;
prompt('^1Scanning ^5'+memboard.name+' #'+cstr(cmbase(Board))+'^1...');
reset(msghdrf);
reset(msgtxtf,1);
if (IOResult <> 0) then
exit;
if ScanNew then
CurrentMessage := Firstnew
else
CurrentMessage := 1;
if (CurrentMessage > 0) and (filesize(msghdrf) > 0) then
while (CurrentMessage <= filesize(msghdrf)) and (not quit) do
begin
loadheader(CurrentMessage, MsgHeader);
Match:=FALSE;
wkey;
if abort then
quit := TRUE;
if (c in ['Y',^M]) then
if ToYou(msgheader) then
Match := TRUE;
if (c in ['F','A']) then
begin
if (mbrealname in memboard.mbstat) then
Searched := MsgHeader.From.Real
else
Searched := MsgHeader.From.As;
if (Memboard.MbType = 0) then
Searched := Searched;
Searched := allcaps(usename(MsgHeader.From.Anon,Searched));
if (pos(ScanFor,Searched) > 0) then
Match := TRUE;
end;
if (c in ['T','A']) then
begin
if (mbrealname in memboard.mbstat) then
Searched := MsgHeader.Mto.Real
else
Searched := MsgHeader.Mto.As;
if (Memboard.MbType = 0) then
Searched := Searched;
Searched := allcaps(usename(MsgHeader.Mto.Anon,Searched));
if (pos(ScanFor,Searched) > 0) then
Match := TRUE;
end;
if (c in ['S','A']) then
if (pos(ScanFor,allcaps(MsgHeader.Subject)) > 0) then
Match := TRUE;
if (c = 'A') and (not Match) and (MsgHeader.TextSize > 0) and
(MsgHeader.Pointer - 1 + MsgHeader.TextSize <= filesize(msgtxtf)) and
(MsgHeader.Pointer > 0) then
with MsgHeader do
begin
seek(msgtxtf,pointer-1);
TotalLoaded := 0;
repeat
blockread(msgtxtf, Searched[0],1);
blockread(msgtxtf, Searched[1],ord(Searched[0]));
Lasterror := IOResult;
inc(TotalLoaded,length(Searched)+1);
if (pos(ScanFor,allcaps(Searched)) > 0) then
Match := TRUE;
until (TotalLoaded >= textsize) or (Match);
end;
if Match then
begin
close(msghdrf);
close(msgtxtf);
Msg_On := CurrentMessage;
MainRead(Quit, TRUE);
nl;
reset(msghdrf);
reset(msgtxtf,1);
AnyShown := TRUE;
end;
inc(CurrentMessage);
end;
close(msghdrf);
close(msgtxtf);
end; {if board=currentboard}
if (not AnyShown) then
BackErase(14 + lennmci(memboard.name) + length(cstr(cmbase(Board))));
board := OldBoard;
abort := quit;
end; {searchboard}
begin
ScanNew := FALSE; ScanGlobal := FALSE;
OldActivity := update_node(3);
mstr := AllCaps(mstr);
if (mstr <> '') then
c := 'Y'
else
c := #0;
if (pos('N',mstr) > 0) then
ScanNew := TRUE;
if (pos('G',mstr) > 0) then
ScanGlobal := TRUE;
if (c = #0) then
repeat
prt(^M^J'Scan method (^5?^4=^5Help^4) : ');
onek(c,'FTSAY?Q'^M);
if (c = '?') then
begin
nl;
lcmds(15,5,'From field','To field');
lcmds(15,5,'Subject field','All text');
lcmds(15,5,'Your messages','Quit');
end;
until (c <> '?') or (hangup);
nl;
if (c <> 'Q') and (c <> ^M) then
begin
if (c <> 'Y') then
begin
prt('Text to scan for : ');
input(ScanFor,40);
if ScanFor = '' then exit;
nl;
end;
if (mstr = '') then
begin
dyny := TRUE;
ScanNew := pynq('Scan new messages only? ');
end;
quit := FALSE;
abort := FALSE;
if (ScanGlobal) or ((mstr = '') and pynq('Global scan? ')) then
begin
CurrentBoard:=1;
repeat
if (cmbase(CurrentBoard) > 0) then
SearchBoard;
inc(CurrentBoard);
wkey;
until ((CurrentBoard > MaxMBases) or (quit) or (abort) or (hangup));
end
else
begin
CurrentBoard := Board;
SearchBoard;
end;
end;
update_node(OldActivity);
end;
procedure ScanYours;
var
oldboard:integer;
found:integer;
CurrentMessage:integer;
CurrentBoard:integer;
MsgHeader:mheaderrec;
OldConf,AnyFound:boolean;
FoundMap:array[0..127] of set of 0..7;
s:string[20];
begin
fillchar(foundmap, sizeof(foundmap), 0);
oldboard := board;
CurrentBoard := 1;
abort := FALSE;
AnyFound := FALSE;
OldConf := ConfSystem;
ConfSystem := FALSE;
if oldconf then
newcomptables;
print(^M^J'Scanning for your new messages...'^M^J);
repeat
if (cmbase(CurrentBoard) > 0) then
if Board <> CurrentBoard then changeboard(CurrentBoard);
if (Board = CurrentBoard) then
begin
initboard(Board);
Found := 0;
if (NewScanMBase) then
begin
reset(msghdrf);
reset(msgtxtf, 1);
if (IOResult = 0) then
begin
str(trunc(Board / MaxMBases * 100):3,s);
prompt(^H^H^H^H + s + '%');
CurrentMessage := Firstnew;
if (CurrentMessage > 0) and (filesize(msghdrf) > 0) then
while (CurrentMessage <= filesize(msghdrf)) and (not abort) do
begin
loadheader(CurrentMessage, MsgHeader);
if ToYou(msgheader) then
begin
inc(Found);
FoundMap[CurrentBoard div 8] := FoundMap[CurrentBoard div 8] +
[CurrentBoard mod 8];
end;
inc(CurrentMessage);
end;
close(msghdrf);
close(msgtxtf);
end;
if (Found > 0) then
begin
print(^H^H^H^H + mln(memboard.name, 30) + ' ^1' + cstr(Found));
AnyFound := TRUE;
end;
end;
end;
inc(CurrentBoard);
wkey;
until (CurrentBoard > MaxMBases) or (abort) or (hangup);
if (not abort) and (not hangup) then printacr(^H^H^H^H + '100%');
board := oldboard;
if AnyFound and pynq(^M^J'Read these now? ') then
for Board := 1 to MaxMBases do
if (Board mod 8) in FoundMap[Board div 8] then
begin
ScanMessages('N');
if abort then break;
if pynq('Update message read pointers on this base? ') then
SaveLastRead(getpackdatetime);
end
else
else
if (not AnyFound) then
print('No messages found.'^M^J);
confsystem:=oldconf;
if oldconf then
newcomptables;
board := oldboard;
Lasterror := ioResult;
end;
procedure NewScan(b:integer; var quit:boolean);
var
oldboard:word;
begin
if (not quit) then begin
oldboard := board;
if (board<>b) then changeboard(b);
if (board = b) then begin
nl;
initboard(board);
TempLastRead := LastMsgRead;
lil := 0;
prompt('^3'+fstring.newscan1);
Lasterror := IOResult;
reset(msghdrf);
if (IOResult = 2) then
rewrite(msghdrf);
Msg_On := firstnew;
close(msghdrf);
if (Msg_On > 0) then
MainRead(quit,FALSE);
if (not quit) then
begin
lil:=0;
prompt(fstring.newscan2);
end;
end;
wkey;
if abort then quit:=TRUE;
SaveLastRead(TempLastRead);
board := oldboard;
initboard(board);
end;
end;
procedure GlobalNewScan;
var
bb:integer;
quit:boolean;
begin
sysoplog('Newscan of message bases');
print(^M^J + fstring.newscanall);
bb := 1;
quit := FALSE;
repeat
if (cmbase(bb) > 0) then
begin
initboard(bb);
if (NewScanMBase) or ((mbforceread in memboard.mbstat) and (not CoSysOp)) then
NewScan(bb,quit);
end;
inc(bb);
until ((bb > MaxMBases) or (quit) or (hangup));
print(^M^J + fstring.newscandone);
end;
procedure StartNewScan(var mstr:astr);
begin
update_node(3);
abort:=FALSE; next:=FALSE;
if (upcase(mstr[1])='C') then NewScan(board,next)
else if (upcase(mstr[1])='G') then GlobalNewScan
else if (value(mstr)<>0) then NewScan(value(mstr),next)
else begin
nl;
if pynq('Global NewScan? ') then
GlobalNewScan
else
NewScan(board,next);
end;
update_node(0);
end;
end.