forked from g8bpq/linbpq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BPQMailConfig.c
3823 lines (2777 loc) · 96.6 KB
/
BPQMailConfig.c
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
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Mail and Chat Server for BPQ32 Packet Switch
//
// Configuration Module
#include "bpqmail.h"
#define C_PAGES 7
int CurrentPage=0; // Page currently on show in tabbed Dialog
#define BBSPARAMS 0
#define ISPPARAMS 1
#define MAINTPARAMS 2
#define WELCOMEMSGS 3
#define PROMPTS 4
#define FILTERS 5
#define WPUPDATE 6
typedef struct tag_dlghdr {
HWND hwndTab; // tab control
HWND hwndDisplay; // current child dialog box
RECT rcDisplay; // display rectangle for the tab control
DLGTEMPLATE *apRes[C_PAGES];
} DLGHDR;
HWND hwndDlg; // Config Dialog
HWND hwndDisplay; // Current child dialog box
HWND hCheck[33];
HWND hNullCheck[33];
HWND hSendMF[33];
HWND hSendHDDR[33];
HWND hLabel[33];
HWND hUIBox[33];
HFONT hFont;
LOGFONT LFTTYFONT ;
char CurrentConfigCall[20]; // Current user or bbs
int CurrentConfigIndex; // Index of current user record
int CurrentMsgIndex; // Index of current Msg record
struct UserInfo * CurrentBBS; // User Record of selected BBS iin Forwarding Config;
struct UserInfo * MsgBBSList[NBBBS+2] = {0}; // Sorted BBS List
char InfoBoxText[100]; // Text to display in Config Info Popup
char Filter_FROM[20];
char Filter_TO[20];
char Filter_VIA[60]; // Filters for Edit Message Dialog
char Filter_BID[16]; // Filters for Edit Message Dialog
extern char LTFROMString[2048];
extern char LTTOString[2048];
extern char LTATString[2048];
VOID * GetOverrideFromString(char * input);
extern time_t MaintClock; // Time to run housekeeping
DLGTEMPLATE * WINAPI DoLockDlgRes(LPCSTR lpszResName);
VOID WINAPI OnSelChanged(HWND hwndDlg);
VOID WINAPI OnChildDialogInit(HWND hwndDlg);
VOID WINAPI OnTabbedDialogInit(HWND hwndDlg);
VOID SaveWPConfig(HWND hDlg);
PrintMessage(struct MsgInfo * Msg);
BOOL ForwardMessagetoFile(struct MsgInfo * Msg, FILE * Handle);
VOID TidyPrompts();
struct UserInfo * FindBBS(char * Name);
INT_PTR CALLBACK UIDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK EditMsgTextDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
VOID SaveMAINTConfigFromDialog();
VOID TidyWelcomeMsg(char ** pPrompt);
// POP3 Password is encrypted by xor'ing it with an MD5 hash of the hostname and pop3 server name
double GetDlgItemFloat(HWND hDlg, int DlgItem, BOOL *lpTranslated, BOOL bSigned)
{
char Num[32];
double ret = 0.0;
GetDlgItemText(hDlg, DlgItem, Num, 31);
return atof(Num);
}
BOOL SetDlgItemFloat(HWND hDlg, int DlgItem, double Value, BOOL bSigned)
{
char Num[32];
sprintf(Num, "%.2f", Value);
while (Num[strlen(Num) -1] == '0')
Num[strlen(Num) -1] = 0;
if (Num[strlen(Num) -1] == '.')
Num[strlen(Num) -1] = 0;
return SetDlgItemText(hDlg, DlgItem, Num);
}
int ww, wh, w, h, hpos, vpos;
int xmargin;
int ymargin;
INT_PTR CALLBACK ConfigWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
RECT Rect;
SCROLLINFO Sinfo;
int ret;
DLGHDR *pHdr = (DLGHDR *) GetWindowLong(hwndDlg, GWL_USERDATA);
switch (message)
{
case WM_INITDIALOG:
ShowScrollBar(hDlg, SB_BOTH, FALSE); // Hide them till needed
OnTabbedDialogInit(hDlg);
// initialise scroll bars
xmargin = 6;
ymargin = 2 + GetSystemMetrics(SM_CYCAPTION);
hpos = vpos = 0;
return (INT_PTR)TRUE;
case WM_SIZE:
w = LOWORD(lParam);
h = HIWORD(lParam);
// If window is smaller than client area enable scroll bars
ret = GetWindowRect(hwndDisplay, &Rect);
ww = Rect.right - Rect.left;
wh = Rect.bottom - Rect.top;
if (ww <= w && (wh + ymargin) <= h)
{
ShowScrollBar(hDlg, SB_BOTH, FALSE); // Hide them till needed
MoveWindow(hwndDisplay, xmargin, ymargin, ww, wh, TRUE);
hpos = vpos = 0;
return TRUE;
}
ShowScrollBar(hDlg, SB_BOTH, TRUE);
Sinfo.cbSize = sizeof(SCROLLINFO);
Sinfo.fMask = SIF_ALL;
Sinfo.nMin = 0;
Sinfo.nMax = ww + xmargin;
Sinfo.nPage = w;
Sinfo.nPos = hpos;
SetScrollInfo(hDlg, SB_HORZ, &Sinfo, TRUE);
Sinfo.cbSize = sizeof(SCROLLINFO);
Sinfo.fMask = SIF_ALL;
Sinfo.nMin = 0;
Sinfo.nMax = wh + ymargin;
Sinfo.nPage = h;
Sinfo.nPos = hpos;
SetScrollInfo(hDlg, SB_VERT, &Sinfo, TRUE);
return TRUE;
case WM_HSCROLL:
switch (LOWORD(wParam))
{
case SB_PAGELEFT:
hpos -= 20;
if (hpos < 0)
hpos = 0;
goto UpdateHPos;
case SB_LINELEFT:
if (hpos)
hpos --;
goto UpdateHPos;
case SB_PAGERIGHT:
hpos += 20;
goto UpdateHPos;
case SB_LINERIGHT:
hpos++;
goto UpdateHPos;
case SB_THUMBPOSITION:
hpos = HIWORD(wParam);
UpdateHPos:
// Need to update Scroll Bar
Sinfo.cbSize = sizeof(SCROLLINFO);
Sinfo.fMask = SIF_ALL;
Sinfo.nMin = 0;
Sinfo.nMax = ww + xmargin;
Sinfo.nPage = w;
Sinfo.nPos = hpos;
SetScrollInfo(hDlg, SB_HORZ, &Sinfo, TRUE);
// Move Client Window
MoveWindow(hwndDisplay, xmargin - hpos , ymargin - vpos , ww, wh, TRUE);
return TRUE;
}
return TRUE;
case WM_VSCROLL:
switch (LOWORD(wParam))
{
case SB_PAGEUP:
vpos -= 20;
if (vpos < 0)
vpos = 0;
goto UpdateVPos;
case SB_LINEUP:
if (vpos)
vpos --;
goto UpdateVPos;
case SB_PAGEDOWN:
vpos += 20;
goto UpdateVPos;
case SB_LINEDOWN:
vpos++;
goto UpdateVPos;
case SB_THUMBPOSITION:
vpos = HIWORD(wParam);
UpdateVPos:
// Need to update Scroll Bar
Sinfo.cbSize = sizeof(SCROLLINFO);
Sinfo.fMask = SIF_ALL;
Sinfo.nMin = 0;
Sinfo.nMax = wh + ymargin;
Sinfo.nPage = h;
Sinfo.nPos = vpos;
SetScrollInfo(hDlg, SB_VERT, &Sinfo, TRUE);
// Move Client Window
MoveWindow(hwndDisplay, xmargin - hpos , ymargin - vpos , ww, wh, TRUE);
return TRUE;
}
return TRUE;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case TCN_SELCHANGE:
OnSelChanged(hDlg);
// Check if scroll now needed
ret = GetWindowRect(hwndDisplay, &Rect);
ww = Rect.right - Rect.left;
wh = Rect.bottom - Rect.top;
if (ww <= w && (wh + 27) <= h)
{
ShowScrollBar(hDlg, SB_BOTH, FALSE); // Hide them till needed
return TRUE;
}
ShowScrollBar(hDlg, SB_BOTH, TRUE);
return TRUE;
// More cases on WM_NOTIFY switch.
case NM_CHAR:
return TRUE;
}
break;
case WM_CTLCOLORDLG:
return (LONG)bgBrush;
case WM_CTLCOLORSTATIC:
{
HDC hdcStatic = (HDC)wParam;
SetTextColor(hdcStatic, RGB(0, 0, 0));
SetBkMode(hdcStatic, TRANSPARENT);
return (LONG)bgBrush;
}
case WM_KEYUP:
if (wParam == VK_TAB)
return TRUE;
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDOK:
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
}
}
return FALSE;
}
INT_PTR CALLBACK InfoDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int Command;
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
SetDlgItemText(hDlg, 5050, InfoBoxText);
return (INT_PTR)TRUE;
case WM_COMMAND:
Command = LOWORD(wParam);
switch (Command)
{
case 0:
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
INT_PTR CALLBACK ChildDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
// This processes messages from controls on the tab subpages
int Command;
switch (message)
{
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case TCN_SELCHANGE:
OnSelChanged(hDlg);
return TRUE;
// More cases on WM_NOTIFY switch.
case NM_CHAR:
return TRUE;
}
break;
case WM_INITDIALOG:
OnChildDialogInit( hDlg);
return (INT_PTR)TRUE;
case WM_CTLCOLORDLG:
return (LONG)bgBrush;
case WM_CTLCOLORSTATIC:
{
HDC hdcStatic = (HDC)wParam;
SetTextColor(hdcStatic, RGB(0, 0, 0));
SetBkMode(hdcStatic, TRANSPARENT);
return (LONG)bgBrush;
}
case WM_COMMAND:
Command = LOWORD(wParam);
if (Command == 2002)
return TRUE;
switch (Command)
{
case IDOK:
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
case IDC_UICONFIG:
DialogBox(hInst, MAKEINTRESOURCE(IDD_UICONFIG), hWnd, UIDialogProc);
return TRUE;
case IDC_BBSSAVE:
SaveBBSConfig();
return TRUE;
case IDC_ISPSAVE:
SaveISPConfig();
return TRUE;
case IDM_MAINTSAVE:
SaveMAINTConfigFromDialog();
return TRUE;
case IDM_MSGSAVE:
SaveWelcomeMsgs();
return TRUE;
case IDM_PROMPTSAVE:
SavePrompts();
return TRUE;
case IDC_FILTERSAVE:
SaveFilters(hDlg);
return TRUE;
case IDC_WPSAVE:
SaveWPConfig(hDlg);
return TRUE;
}
break;
}
return (INT_PTR)FALSE;
}
//The following function processes the WM_INITDIALOG message for the main dialog box. The function allocates the DLGHDR structure, loads the dialog template resources for the child dialog boxes, and creates the tab control.
//The size of each child dialog box is specified by the DLGTEMPLATE structure. The function examines the size of each dialog box and uses the macro for the TCM_ADJUSTRECT message to calculate an appropriate size for the tab control. Then it sizes the dialog box and positions the two buttons accordingly. This example sends TCM_ADJUSTRECT by using the TabCtrl_AdjustRect macro.
VOID WINAPI OnTabbedDialogInit(HWND hDlg)
{
DLGHDR *pHdr = (DLGHDR *) LocalAlloc(LPTR, sizeof(DLGHDR));
DWORD dwDlgBase = GetDialogBaseUnits();
int cxMargin = LOWORD(dwDlgBase) / 4;
int cyMargin = HIWORD(dwDlgBase) / 8;
TC_ITEM tie;
RECT rcTab;
int i, pos;
INITCOMMONCONTROLSEX init;
hwndDlg = hDlg; // Save Window Handle
// Save a pointer to the DLGHDR structure.
SetWindowLong(hwndDlg, GWL_USERDATA, (LONG) pHdr);
// Create the tab control.
init.dwICC=ICC_STANDARD_CLASSES;
init.dwSize=sizeof(init);
i=InitCommonControlsEx(&init);
pHdr->hwndTab = CreateWindow(WC_TABCONTROL, "", WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
0, 0, 100, 100, hwndDlg, NULL, hInst, NULL);
if (pHdr->hwndTab == NULL) {
// handle error
}
// Add a tab for each of the child dialog boxes.
tie.mask = TCIF_TEXT | TCIF_IMAGE;
tie.iImage = -1;
tie.pszText = "BBS Params";
TabCtrl_InsertItem(pHdr->hwndTab, 0, &tie);
tie.pszText = "ISP Interface";
TabCtrl_InsertItem(pHdr->hwndTab, 1, &tie);
tie.pszText = "Housekeeping";
TabCtrl_InsertItem(pHdr->hwndTab, 2, &tie);
tie.pszText = "Welcome Msgs";
TabCtrl_InsertItem(pHdr->hwndTab, 3, &tie);
tie.pszText = "Prompts";
TabCtrl_InsertItem(pHdr->hwndTab, 4, &tie);
tie.pszText = "Msg Filters";
TabCtrl_InsertItem(pHdr->hwndTab, 5, &tie);
tie.pszText = "WP Update";
TabCtrl_InsertItem(pHdr->hwndTab, 6, &tie);
// Lock the resources for the three child dialog boxes.
pHdr->apRes[0] = DoLockDlgRes("BBS_CONFIG");
pHdr->apRes[1] = DoLockDlgRes("ISP_CONFIG");
pHdr->apRes[2] = DoLockDlgRes("MAINT");
pHdr->apRes[3] = DoLockDlgRes("WELCOMEMSG");
pHdr->apRes[4] = DoLockDlgRes("BBSPROMPTS");
pHdr->apRes[5] = DoLockDlgRes("FILTERS");
pHdr->apRes[6] = DoLockDlgRes("WPUPDATE");
// Determine the bounding rectangle for all child dialog boxes.
SetRectEmpty(&rcTab);
for (i = 0; i < C_PAGES-1; i++)
{
if (pHdr->apRes[i]->cx > rcTab.right)
rcTab.right = pHdr->apRes[i]->cx;
if (pHdr->apRes[i]->cy > rcTab.bottom)
rcTab.bottom = pHdr->apRes[i]->cy;
}
MapDialogRect(hwndDlg, &rcTab);
// rcTab.right = rcTab.right * LOWORD(dwDlgBase) / 4;
// rcTab.bottom = rcTab.bottom * HIWORD(dwDlgBase) / 8;
// Calculate how large to make the tab control, so
// the display area can accomodate all the child dialog boxes.
TabCtrl_AdjustRect(pHdr->hwndTab, TRUE, &rcTab);
OffsetRect(&rcTab, cxMargin - rcTab.left, cyMargin - rcTab.top);
// Calculate the display rectangle.
CopyRect(&pHdr->rcDisplay, &rcTab);
TabCtrl_AdjustRect(pHdr->hwndTab, FALSE, &pHdr->rcDisplay);
// Set the size and position of the tab control, buttons,
// and dialog box.
SetWindowPos(pHdr->hwndTab, NULL, rcTab.left, rcTab.top, rcTab.right - rcTab.left, rcTab.bottom - rcTab.top, SWP_NOZORDER);
// Move the Buttons to bottom of page
pos=rcTab.left+cxMargin;
// Size the dialog box.
SetWindowPos(hwndDlg, NULL, 0, 0, rcTab.right + cyMargin + 2 * GetSystemMetrics(SM_CXDLGFRAME),
rcTab.bottom + 2 * cyMargin + 2 * GetSystemMetrics(SM_CYDLGFRAME) + GetSystemMetrics(SM_CYCAPTION),
SWP_NOMOVE | SWP_NOZORDER);
// Simulate selection of the first item.
OnSelChanged(hwndDlg);
}
// DoLockDlgRes - loads and locks a dialog template resource.
// Returns a pointer to the locked resource.
// lpszResName - name of the resource
DLGTEMPLATE * WINAPI DoLockDlgRes(LPCSTR lpszResName)
{
HRSRC hrsrc = FindResource(NULL, lpszResName, RT_DIALOG);
HGLOBAL hglb = LoadResource(hInst, hrsrc);
return (DLGTEMPLATE *) LockResource(hglb);
}
//The following function processes the TCN_SELCHANGE notification message for the main dialog box. The function destroys the dialog box for the outgoing page, if any. Then it uses the CreateDialogIndirect function to create a modeless dialog box for the incoming page.
// OnSelChanged - processes the TCN_SELCHANGE notification.
// hwndDlg - handle of the parent dialog box
VOID WINAPI OnSelChanged(HWND hwndDlg)
{
char Nodes[1000]="";
char Text[10000]="";
char Line[80];
struct Override ** Call;
char Time[10];
DLGHDR *pHdr = (DLGHDR *) GetWindowLong(hwndDlg, GWL_USERDATA);
CurrentPage = TabCtrl_GetCurSel(pHdr->hwndTab);
// Destroy the current child dialog box, if any.
if (pHdr->hwndDisplay != NULL)
DestroyWindow(pHdr->hwndDisplay);
// Create the new child dialog box.
pHdr->hwndDisplay = CreateDialogIndirect(hInst, pHdr->apRes[CurrentPage], hwndDlg, ChildDialogProc);
hwndDisplay = pHdr->hwndDisplay; // Save
// Fill in the controls
switch (CurrentPage)
{
case BBSPARAMS:
SetDlgItemText(pHdr->hwndDisplay, IDC_BBSCall, BBSName);
SetDlgItemText(pHdr->hwndDisplay, IDC_SYSOPCALL, SYSOPCall);
CheckDlgButton(pHdr->hwndDisplay, IDC_SYSTOSYSOPCALL, SendSYStoSYSOPCall);
CheckDlgButton(pHdr->hwndDisplay, IDC_BBSTOSYSOPCALL, SendBBStoSYSOPCall);
CheckDlgButton(pHdr->hwndDisplay, IDC_DONTHOLDNEW, DontHoldNewUsers);
CheckDlgButton(pHdr->hwndDisplay, IDC_FORWARDTOBBS, ForwardToMe);
CheckDlgButton(pHdr->hwndDisplay, IDC_NONAME, AllowAnon);
CheckDlgButton(pHdr->hwndDisplay, IDC_USERRKILLT, !UserCantKillT); // Note negative logic
CheckDlgButton(pHdr->hwndDisplay, IDC_NOHOMEBBS, DontNeedHomeBBS);
CheckDlgButton(pHdr->hwndDisplay, IDC_DONTCHECKFROM, DontCheckFromCall);
CheckDlgButton(pHdr->hwndDisplay, IDC_DEFAULTNOWINLINK, DefaultNoWINLINK);
SetDlgItemText(pHdr->hwndDisplay, IDC_HRoute, HRoute);
SetDlgItemText(pHdr->hwndDisplay, IDC_BaseDir, BaseDirRaw);
SetDlgItemInt(pHdr->hwndDisplay, IDC_BBSAppl, BBSApplNum, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDC_BBSStreams, MaxStreams, FALSE);
CheckDlgButton(pHdr->hwndDisplay, IDC_ENABLEUI, EnableUI);
SetDlgItemInt(pHdr->hwndDisplay, MAILFOR_MINS, MailForInterval, FALSE);
CheckDlgButton(pHdr->hwndDisplay, IDC_REFUSEBULLS, RefuseBulls);
CheckDlgButton(pHdr->hwndDisplay, IDC_KNOWNUSERS, OnlyKnown);
SetDlgItemInt(pHdr->hwndDisplay, IDC_POP3Port, POP3InPort, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDC_NNTPPort, NNTPInPort, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDC_SMTPPort, SMTPInPort, FALSE);
CheckDlgButton(pHdr->hwndDisplay, IDC_REMOTEEMAIL, RemoteEmail);
SetDlgItemText(pHdr->hwndDisplay, IDC_AMPR, AMPRDomain);
CheckDlgButton(pHdr->hwndDisplay, IDC_FORWARDAMPR, SendAMPRDirect);
break;
case ISPPARAMS:
CheckDlgButton(pHdr->hwndDisplay, IDC_ISP_Gateway_Enabled, ISP_Gateway_Enabled);
SetDlgItemInt(pHdr->hwndDisplay, IDC_POP3Timer, ISPPOP3Interval, FALSE);
SetDlgItemText(pHdr->hwndDisplay, IDC_MyMailDomain, MyDomain);
SetDlgItemText(pHdr->hwndDisplay, IDC_ISPSMTPName, ISPSMTPName);
SetDlgItemText(pHdr->hwndDisplay, SMTP_EHELO, ISPEHLOName);
SetDlgItemInt(pHdr->hwndDisplay, IDC_ISPSMTPPort, ISPSMTPPort, FALSE);
SetDlgItemText(pHdr->hwndDisplay, IDC_ISPPOP3Name, ISPPOP3Name);
SetDlgItemInt(pHdr->hwndDisplay, IDC_ISPPOP3Port, ISPPOP3Port, FALSE);
SetDlgItemText(pHdr->hwndDisplay, IDC_ISPAccountName, ISPAccountName);
SetDlgItemText(pHdr->hwndDisplay, IDC_ISPAccountPass, ISPAccountPass);
CheckDlgButton(pHdr->hwndDisplay, ISP_SMTP_AUTH, SMTPAuthNeeded);
break;
case MAINTPARAMS:
SetDlgItemInt(pHdr->hwndDisplay, IDC_MAXMSG, MaxMsgno, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDC_BIDLIFETIME, BidLifetime, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDC_USERLIFETIME, UserLifetime, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDC_LOGLIFETIME, LogAge, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDC_MAINTINTERVAL, MaintInterval, FALSE);
sprintf(Time, "%04d", MaintTime);
SetDlgItemText(pHdr->hwndDisplay, IDC_MAINTTIME, Time);
SetDlgItemFloat(pHdr->hwndDisplay, IDM_PR, PR, FALSE);
SetDlgItemFloat(pHdr->hwndDisplay, IDM_PUR, PUR, FALSE);
SetDlgItemFloat(pHdr->hwndDisplay, IDM_PF, PF, FALSE);
SetDlgItemFloat(pHdr->hwndDisplay, IDM_PNF, PNF, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDM_BF, BF, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDM_BNF, BNF, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDM_NTSD, NTSD, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDM_NTSF, NTSF, FALSE);
SetDlgItemInt(pHdr->hwndDisplay, IDM_NTSU, NTSU, FALSE);
CheckDlgButton(pHdr->hwndDisplay, IDC_DELETETORECYCLE, DeletetoRecycleBin);
CheckDlgButton(pHdr->hwndDisplay, IDC_MAINTNOMAIL, SuppressMaintEmail);
CheckDlgButton(pHdr->hwndDisplay, IDC_MAINTSAVEREG, SaveRegDuringMaint);
CheckDlgButton(pHdr->hwndDisplay, IDC_OVERRIDEUNSENT, OverrideUnsent);
CheckDlgButton(pHdr->hwndDisplay, IDC_MAINTNONDELIVERY , SendNonDeliveryMsgs);
CheckDlgButton(pHdr->hwndDisplay, IDC_MAINTTRAFFIC, GenerateTrafficReport);
if (LTFROM)
{
Call = LTFROM;
while(Call[0])
{
sprintf(Line, "%s, %d\r\n", Call[0]->Call, Call[0]->Days);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDM_LTFROM, Text);
Text[0] = 0;
if (LTTO)
{
Call = LTTO;
while(Call[0])
{
sprintf(Line, "%s, %d\r\n", Call[0]->Call, Call[0]->Days);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDM_LTTO, Text);
Text[0] = 0;
if (LTAT)
{
Call = LTAT;
while(Call[0])
{
sprintf(Line, "%s, %d\r\n", Call[0]->Call, Call[0]->Days);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDM_LTAT, Text);
Text[0] = 0;
break;
case WELCOMEMSGS:
SetDlgItemText(pHdr->hwndDisplay, IDM_USERMSG, WelcomeMsg);
SetDlgItemText(pHdr->hwndDisplay, IDM_NEWUSERMSG, NewWelcomeMsg);
SetDlgItemText(pHdr->hwndDisplay, IDM_EXPERTUSERMSG, ExpertWelcomeMsg);
SetDlgItemText(pHdr->hwndDisplay, IDM_SIGNOFF, SignoffMsg);
break;
case PROMPTS:
SetDlgItemText(pHdr->hwndDisplay, IDM_USERMSG, Prompt);
SetDlgItemText(pHdr->hwndDisplay, IDM_NEWUSERMSG, NewPrompt);
SetDlgItemText(pHdr->hwndDisplay, IDM_EXPERTUSERMSG, ExpertPrompt);
break;
case FILTERS:
Text[0] = 0;
if (RejFrom)
{
char ** Call = RejFrom;
while(Call[0])
{
sprintf(Line, "%s\r\n", Call[0]);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDC_REJFROM, Text);
Text[0] = 0;
if (RejTo)
{
char ** Call = RejTo;
while(Call[0])
{
sprintf(Line, "%s\r\n", Call[0]);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDC_REJTO, Text);
Text[0] = 0;
if (RejAt)
{
char ** Call = RejAt;
while(Call[0])
{
sprintf(Line, "%s\r\n", Call[0]);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDC_REJAT, Text);
Text[0] = 0;
if (RejBID)
{
char ** Call = RejBID;
while(Call[0])
{
sprintf(Line, "%s\r\n", Call[0]);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDC_REJBID, Text);
Text[0] = 0;
if (HoldFrom)
{
char ** Call = HoldFrom;
while(Call[0])
{
sprintf(Line, "%s\r\n", Call[0]);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDC_HOLDFROM, Text);
Text[0] = 0;
if (HoldTo)
{
char ** Call = HoldTo;
while(Call[0])
{
sprintf(Line, "%s\r\n", Call[0]);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDC_HOLDTO, Text);
Text[0] = 0;
if (HoldAt)
{
char ** Call = HoldAt;
while(Call[0])
{
sprintf(Line, "%s\r\n", Call[0]);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDC_HOLDAT, Text);
Text[0] = 0;
if (HoldBID)
{
char ** Call = HoldBID;
while(Call[0])
{
sprintf(Line, "%s\r\n", Call[0]);
strcat(Text, Line);
Call++;
}
}
SetDlgItemText(pHdr->hwndDisplay, IDC_HOLDBID, Text);
break;
case WPUPDATE:
if (SendWPAddrs)
{
char ** Calls = SendWPAddrs;
char Text[10000]="";
while(Calls[0])
{
strcat(Text, Calls[0]);
strcat(Text, "\r\n");
Calls++;
}
SetDlgItemText(hwndDisplay, IDC_WPTO, Text);
}
SendDlgItemMessage(hwndDisplay, IDC_WPTYPE, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) "B");
SendDlgItemMessage(hwndDisplay, IDC_WPTYPE, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR) "P");
SendDlgItemMessage(hwndDisplay, IDC_WPTYPE, CB_SETCURSEL, SendWPType, 0);
CheckDlgButton(hwndDisplay, IDC_SENDWP, SendWP);
// CheckDlgButton(hwndDisplay, IDC_SENDWP, NoWPGuesses);
CheckDlgButton(hwndDisplay, IDC_FILTERWPB, FilterWPBulls);
break;
}
ShowWindow(pHdr->hwndDisplay, SW_SHOWNORMAL);
}
//The following function processes the WM_INITDIALOG message for each of the child dialog boxes. You cannot specify the position of a dialog box created using the CreateDialogIndirect function. This function uses the SetWindowPos function to position the child dialog within the tab control's display area.
// OnChildDialogInit - Positions the child dialog box to fall
// within the display area of the tab control.
VOID WINAPI OnChildDialogInit(HWND hwndDlg)
{
HWND hwndParent = GetParent(hwndDlg);
DLGHDR *pHdr = (DLGHDR *) GetWindowLong(hwndParent, GWL_USERDATA);
SetWindowPos(hwndDlg, HWND_TOP, pHdr->rcDisplay.left, pHdr->rcDisplay.top, 0, 0, SWP_NOSIZE);
}
void SetForwardingPage(HWND hDlg, struct UserInfo * user)
{
struct BBSForwardingInfo * ForwardingInfo = user->ForwardingInfo;
char ** Calls;
char Text[100000]="";
Calls = ForwardingInfo->TOCalls;
if (Calls)
{
while(Calls[0])
{
strcat(Text, Calls[0]);
strcat(Text, "\r\n");
Calls++;