|
|
1.1 root 1: /* SCBCFG.C */
2:
3: /* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */
4:
5: #include <uifc.h>
6: #include <sys\stat.h>
7: #include "scb.h"
8:
9: #define MAX_PRFX 500
10: #define LEN_PRFX 20
11:
12: char **opt;
13: char **prfx;
14:
15: int add();
16: void bail(int code);
17: void main();
18: char fexist(char *filespec);
19:
20: unsigned _stklen=16000; /* Set stack size in code, not header */
21:
22: void bail(int code)
23: {
24:
25: if(code)
26: getch();
27: uifcbail();
28: exit(code);
29: }
30:
31: int add()
32: {
33: int i;
34:
35: i=0;
36: strcpy(opt[0],"Add these to the user account");
37: strcpy(opt[1],"Remove these from the user account");
38: opt[2][0]=0;
39: /*
40: &Add/Remove Flags/Restricts/Exempts:&
41:
42: Select &ADD& if you want these flags/restricts/exempts added to the
43: user upon validation, or select &REMOVE& to take them away upon
44: validation.
45:
46: */
47: i=ulist(WIN_MID|WIN_SAV,0,0,0,&i,0,"Add or Remove From Account",opt);
48: return(i);
49: }
50:
51: void main()
52: {
53: char str[128],canfile[256],addfile[256],flags1[81]={NULL},
54: flags2[81]={NULL},flags3[81]={NULL},flags4[81]={NULL},
55: exempt[81]={NULL},restrict[81]={NULL},expiration[81]={NULL},
56: credits[81]={NULL},minutes[81]={NULL},level[81]={NULL},
57: callout_attempts[81]={NULL},sysop[81]={NULL},bbs_ac[81],*p;
58: int file,i,j,k,options=0,ldstart[7]={NULL},ldend[7]={NULL},min_phone_len=7,
59: max_phone_len=11,total_prfxs,dflt,b,hangup_time;
60: FILE *stream;
61:
62: savnum=0;
63: if((opt=(char **)MALLOC(sizeof(char *)*300))==NULL) {
64: cputs("memory allocation error\r\n");
65: bail(1); }
66: for(i=0;i<300;i++)
67: if((opt[i]=(char *)MALLOC(MAX_OPLN))==NULL) {
68: cputs("memory allocation error\r\n");
69: bail(1); }
70: uifcini();
71: sprintf(str,"Synchronet Callback v%s",VERSION);
72: uscrn(str);
73:
74: if(!(fexist("SCB.CFG"))) {
75: strcpy(callout_attempts,"5");
76: strcpy(canfile,"\\SBBS\\TEXT\\PHONE.CAN");
77: strcpy(addfile,canfile);
78: options|=MODIFY_USER_NOTE; }
79: else {
80: if((file=open("SCB.CFG",O_RDONLY|O_BINARY|O_DENYNONE))==-1) {
81: textattr(LIGHTGRAY);
82: clrscr();
83: lprintf("Error opening SCB.CFG\r\n");
84: bail(1); }
85: if((stream=fdopen(file,"rb"))==NULL) {
86: textattr(LIGHTGRAY);
87: clrscr();
88: lprintf("Error fdopen SCB.CFG\r\n");
89: bail(1); }
90: fgets(callout_attempts,81,stream); truncsp(callout_attempts);
91: fgets(str,81,stream); truncsp(str);
92: if(str[0]=='Y') options|=ALWAYS_VALIDATE;
93: if(str[1]=='Y') options|=MODIFY_USER_NOTE;
94: if(str[2]=='Y') options|=START_WITH_0;
95: if(str[3]=='Y') options|=START_WITH_1;
96: if(str[4]=='Y') options|=STAY_CONNECTED;
97: if(str[5]=='Y') options|=SC_LOCAL_ONLY;
98: if(str[6]=='Y') options|=US_PHONE_FORMAT;
99: if(str[7]=='Y') options|=ALLOWED_ONLY;
100: if(str[8]!='N') options|=SAME_AREA_LD;
101: fgets(canfile,81,stream); truncsp(canfile);
102: fgets(addfile,81,stream); truncsp(addfile);
103: fgets(credits,81,stream); truncsp(credits);
104: fgets(sysop,81,stream); truncsp(sysop);
105: fgets(level,81,stream); truncsp(level);
106: fgets(flags1,81,stream); truncsp(flags1);
107: fgets(flags2,81,stream); truncsp(flags2);
108: fgets(exempt,81,stream); truncsp(exempt);
109: fgets(restrict,81,stream); truncsp(restrict);
110: fgets(expiration,81,stream); truncsp(expiration);
111: fgets(minutes,81,stream); truncsp(minutes);
112: fgets(flags3,81,stream); truncsp(flags3);
113: fgets(flags4,81,stream); truncsp(flags4);
114: for(i=0;i<7;i++) {
115: fgets(str,81,stream); ldstart[i]=atoi(str); /* min since midnight */
116: fgets(str,81,stream); ldend[i]=atoi(str); }
117: fgets(str,81,stream); min_phone_len=atoi(str);
118: fgets(str,81,stream); max_phone_len=atoi(str);
119: fgets(bbs_ac,81,stream); truncsp(bbs_ac);
120: if(fgets(str,81,stream)) {
121: hangup_time=atoi(str);
122: if(hangup_time>90)
123: hangup_time=90; }
124: else
125: hangup_time=30;
126: str[0]=0;
127: fgets(str,81,stream); // regnum
128: fclose(stream); }
129: dflt=0;
130: while(1) {
131: helpbuf=
132: " Synchronet Callback Configuration \r\n\r\n"
133: "Move through the various options using the arrow keys. Select the\r\n"
134: "highlighted options by pressing ENTER.\r\n\r\n";
135: j=0;
136: sprintf(opt[j++],"Toggle Options...");
137: sprintf(opt[j++],"Validation Values...");
138: sprintf(opt[j++],"Allowed Prefix List...");
139: sprintf(opt[j++],"Long Distance Prefix List...");
140: sprintf(opt[j++],"Long Distance Calling Times...");
141: sprintf(opt[j++],"Phone Number Trash Can %-30.30s",canfile);
142: sprintf(opt[j++],"Validated Phone List %-30.30s",addfile);
143: sprintf(opt[j++],"Callback Attempts %-2.2s",callout_attempts);
144: sprintf(opt[j++],"Minimum Phone Length %u",min_phone_len);
145: sprintf(opt[j++],"Maximum Phone Length %u",max_phone_len);
146: sprintf(opt[j++],"Wait Before Dialing %u seconds",hangup_time);
147: sprintf(opt[j++],"BBS Area Code %-3.3s",bbs_ac);
148: if(sysop[0])
149: sprintf(str,"User #%s",sysop);
150: else
151: sprintf(str,"Disabled");
152: sprintf(opt[j++],"Send Message to Sysop %-30.30s",str);
153: opt[j][0]=NULL;
154: switch(ulist(WIN_ORG|WIN_MID|WIN_ACT|WIN_ESC,0,0,60,&dflt,0
155: ,"Synchronet Callback Configuration",opt)) {
156: case 0:
157: j=0;
158: while(1) {
159: k=0;
160: sprintf(opt[k++],"%-40.40s%-3s","Validate if Unable to Verify"
161: ,options&ALWAYS_VALIDATE ? "Yes":"No");
162: sprintf(opt[k++],"%-40.40s%-3s","Put Result in User Note"
163: ,options&MODIFY_USER_NOTE ? "Yes":"No");
164: sprintf(opt[k++],"%-40.40s%-3s"
165: ,"Long Distance if not an Allowed Prefix"
166: ,options&ALLOWED_ONLY ? "Yes":"No");
167: sprintf(opt[k++],"%-40.40s%-3s"
168: ,"Allow Long Distance (Starting with 0)"
169: ,options&START_WITH_0 ? "Yes":"No");
170: sprintf(opt[k++],"%-40.40s%-3s"
171: ,"Allow Long Distance (Starting with 1)"
172: ,options&START_WITH_1 ? "Yes":"No");
173: sprintf(opt[k++],"%-40.40s%-3s"
174: ,"Allow Long Distance (Same Area Code)"
175: ,options&SAME_AREA_LD ? "Yes":"No");
176: sprintf(opt[k++],"%-40.40s%-3s"
177: ,"U.S. Style Phone Format (AAA-PPP-SSSS)"
178: ,options&US_PHONE_FORMAT ? "Yes":"No");
179: sprintf(opt[k++],"%-40.40s%-10s","Stay Connected After Callback"
180: ,options&STAY_CONNECTED && options&SC_LOCAL_ONLY ?
181: "Local Only" : options&STAY_CONNECTED ? "Yes":"No");
182: opt[k][0]=NULL;
183: helpbuf=
184: " Toggle Options \r\n\r\n"
185: "&Validate if Unable to Call Back&\r\n"
186: " Setting this to &Yes& will validate the user even if the board is unable "
187: "\r\n"
188: " to call the user back.\r\n"
189: "&Put Result in User Note&\r\n"
190: " When set to &Yes&, this option will place the phone number, and\r\n"
191: " information pertaining to the call into the user's note.\r\n"
192: "&Allow Numbers that Start with 0 / Allow Numbers that Start with 1&\r\n"
193: " Set these options to &Yes& to allow SCB to call phone numbers which\r\n"
194: " start with a 0 or a 1 (respectively).\r\n"
195: "&U.S. Style Phone Format&\r\n"
196: " Toggle this option to &Yes& if you live in an area that uses a phone\r\n"
197: " number format of (AAA) PPP-SSSS.\r\n"
198: "&Stay Connected After Callback&\r\n"
199: " Toggle this option to &Yes& to allow SCB to stay connected after a\r\n"
200: " callback, &Local Only& for local numbers, or &No& to disconnect.";
201:
202: j=ulist(0,0,0,0,&j,0,"Toggle Options",opt);
203: if(j==-1)
204: break;
205: switch(j) {
206: case 0:
207: options^=ALWAYS_VALIDATE;
208: break;
209: case 1:
210: options^=MODIFY_USER_NOTE;
211: break;
212: case 2:
213: options^=ALLOWED_ONLY;
214: break;
215: case 3:
216: options^=START_WITH_0;
217: break;
218: case 4:
219: options^=START_WITH_1;
220: break;
221: case 5:
222: options^=SAME_AREA_LD;
223: break;
224: case 6:
225: options^=US_PHONE_FORMAT;
226: break;
227: case 7:
228: if(options&STAY_CONNECTED && options&SC_LOCAL_ONLY) {
229: options^=STAY_CONNECTED;
230: options^=SC_LOCAL_ONLY;
231: } else if(options&STAY_CONNECTED)
232: options^=SC_LOCAL_ONLY;
233: else options^=STAY_CONNECTED;
234: break; } }
235: break;
236: case 1:
237: j=0;
238: while(1) {
239: k=0;
240: sprintf(opt[k++],"%-30.30s %-27.27s","Security Level"
241: ,level);
242: sprintf(opt[k++],"%-30.30s %-27.27s","Flag Set 1"
243: ,flags1);
244: sprintf(opt[k++],"%-30.30s %-27.27s","Flag Set 2"
245: ,flags2);
246: sprintf(opt[k++],"%-30.30s %-27.27s","Flag Set 3"
247: ,flags3);
248: sprintf(opt[k++],"%-30.30s %-27.27s","Flag Set 4"
249: ,flags4);
250: sprintf(opt[k++],"%-30.30s %-27.27s","Exemptions"
251: ,exempt);
252: sprintf(opt[k++],"%-30.30s %-27.27s","Restrictions"
253: ,restrict);
254: sprintf(opt[k++],"%-30.30s %-27.27s"
255: ,"Days to Extend Expiration"
256: ,expiration);
257: sprintf(opt[k++],"%-30.30s %-27.27s","Credits to Add"
258: ,credits);
259: sprintf(opt[k++],"%-30.30s %-27.27s","Minutes to Add"
260: ,minutes);
261: opt[k][0]=NULL;
262: helpbuf=
263: " Validation Values \r\n\r\n"
264: "These are the values that will be placed into user accounts that have\r\n"
265: "been successfully verified through the Synchronet Callback.";
266:
267:
268: j=ulist(WIN_ACT,0,0,0,&j,0,"Validation Values",opt);
269: if(j==-1)
270: break;
271: switch(j) {
272: case 0:
273: helpbuf=
274: " Security Level \r\n\r\n"
275: "This is the Security level that will be given to users that are called\r\n"
276: "back successfully.";
277: uinput(WIN_L2R|WIN_MID|WIN_SAV,0,0,
278: "Security Level",level,2,K_EDIT|K_NUMBER);
279: break;
280: case 1:
281: helpbuf=
282: " Flag Set 1 \r\n\r\n"
283: "These are the different flags to be added to (or removed from) the\r\n"
284: "user account.";
285: p=strstr(flags1,"-");
286: if(p!=NULL) sprintf(str,"%s",p+1);
287: else
288: sprintf(str,"%s",flags1);
289: if(uinput(WIN_L2R|WIN_MID|WIN_SAV,0,0,"Flag Set 1",str
290: ,26,K_EDIT|K_UPPER|K_ALPHA)<0)
291: break;
292: if(str[0] && add()>0) sprintf(flags1,"-%s",str);
293: else
294: sprintf(flags1,"%s",str);
295: break;
296: case 2:
297: helpbuf=
298: " Flag Set 2 \r\n\r\n"
299: "These are the different flags to be added to (or removed from) the\r\n"
300: "user account.";
301: p=strstr(flags2,"-");
302: if(p!=NULL) sprintf(str,"%s",p+1);
303: else
304: sprintf(str,"%s",flags2);
305: if(uinput(WIN_L2R|WIN_MID|WIN_SAV,0,0,"Flag Set 2",str
306: ,26,K_EDIT|K_UPPER|K_ALPHA)<0)
307: break;
308: if(str[0] && add()>0) sprintf(flags2,"-%s",str);
309: else
310: sprintf(flags2,"%s",str);
311: break;
312: case 3:
313: helpbuf=
314: " Flag Set 3 \r\n\r\n"
315: "These are the different flags to be added to (or removed from) the\r\n"
316: "user account.";
317: p=strstr(flags3,"-");
318: if(p!=NULL) sprintf(str,"%s",p+1);
319: else
320: sprintf(str,"%s",flags3);
321: if(uinput(WIN_L2R|WIN_MID|WIN_SAV,0,0,"Flag Set 3",str
322: ,26,K_EDIT|K_UPPER|K_ALPHA)<0)
323: break;
324: if(str[0] && add()>0) sprintf(flags3,"-%s",str);
325: else
326: sprintf(flags3,"%s",str);
327: break;
328: case 4:
329: helpbuf=
330: " Flag Set 4 \r\n\r\n"
331: "These are the different flags to be added to (or removed from) the\r\n"
332: "user account.";
333: p=strstr(flags4,"-");
334: if(p!=NULL) sprintf(str,"%s",p+1);
335: else
336: sprintf(str,"%s",flags4);
337: if(uinput(WIN_L2R|WIN_MID|WIN_SAV,0,0,"Flag Set 4",str
338: ,26,K_EDIT|K_UPPER|K_ALPHA)<0)
339: break;
340: if(str[0] && add()>0) sprintf(flags4,"-%s",str);
341: else
342: sprintf(flags4,"%s",str);
343: break;
344: case 5:
345: helpbuf=
346: " Exemptions \r\n\r\n"
347: "These are the exemption flags that will be added to (or removed from)\r\n"
348: "the user account.";
349: p=strstr(exempt,"-");
350: if(p!=NULL) sprintf(str,"%s",p+1);
351: else
352: sprintf(str,"%s",exempt);
353: if(uinput(WIN_MID|WIN_SAV,0,0,"Exemptions",str
354: ,26,K_EDIT|K_UPPER|K_ALPHA)<0)
355: break;
356: if(str[0] && add()>0) sprintf(exempt,"-%s",str);
357: else
358: sprintf(exempt,"%s",str);
359: break;
360: case 6:
361: helpbuf=
362: " Restrictions \r\n\r\n"
363: "These are the restriction flags that will be added to (or removed\r\n"
364: "from) the user account.";
365: p=strstr(restrict,"-");
366: if(p!=NULL) sprintf(str,"%s",p+1);
367: else
368: sprintf(str,"%s",restrict);
369: if(uinput(WIN_MID|WIN_SAV,0,0,"Restrictions",str
370: ,26,K_EDIT|K_UPPER|K_ALPHA)<0)
371: break;
372: if(str[0] && add()>0) sprintf(restrict,"-%s",str);
373: else
374: sprintf(restrict,"%s",str);
375: break;
376: case 7:
377: helpbuf=
378: " Days to Extend Expiration \r\n\r\n"
379: "This is the number of days to extend the expiration date of a user\r\n"
380: "account.";
381: uinput(WIN_MID|WIN_SAV,0,0,"Expiration"
382: ,expiration,8,K_EDIT|K_UPPER|K_NUMBER);
383: break;
384: case 8:
385: helpbuf=
386: " Credits to Add \r\n\r\n"
387: "This is the number of credits to add to a user account.";
388: uinput(WIN_MID|WIN_SAV,0,0,"Credits",credits
389: ,10,K_EDIT|K_UPPER|K_NUMBER);
390: break;
391: case 9:
392: helpbuf=
393: " Minutes to Add \r\n\r\n"
394: "This is the number of minutes to add to a user account.";
395: uinput(WIN_MID|WIN_SAV,0,0,"Minutes",minutes
396: ,3,K_EDIT|K_UPPER|K_NUMBER);
397: break; } }
398: break;
399: case 2:
400: helpbuf=
401: " Allowed Prefix List \r\n\r\n"
402: "Any phone numbers entered whose prefix matches a number contained\r\n"
403: "in this list, will not be affected by long distance restrictions.\r\n"
404: "For example, if you are in the 714 code, and you wish to SCB to\r\n"
405: "consider all prefixes in the 310 area code local, you would enter 1310\r\n"
406: "in the list.";
407:
408: total_prfxs=0;
409: if((prfx=(char **)MALLOC(sizeof(char *)*MAX_PRFX))==NULL) {
410: cputs("memory allocation error\r\n");
411: bail(1); }
412: for(i=0;i<MAX_PRFX;i++)
413: if((prfx[i]=(char *)MALLOC(LEN_PRFX+1))==NULL) {
414: cputs("memory allocation error\r\n");
415: bail(1); }
416:
417: if(fexist("ALLOWED.DAT")) {
418: if((file=open("ALLOWED.DAT",
419: O_RDONLY|O_BINARY|O_DENYNONE))==-1) {
420: textattr(LIGHTGRAY);
421: clrscr();
422: lprintf("Error opening ALLOWED.DAT\r\n");
423: bail(1); }
424: if((stream=fdopen(file,"rb"))==NULL) {
425: textattr(LIGHTGRAY);
426: clrscr();
427: lprintf("Error fdopen ALLOWED.DAT\r\n");
428: bail(1); }
429: while(!feof(stream) && total_prfxs<MAX_PRFX) {
430: if(!fgets(str,81,stream))
431: break;
432: truncsp(str);
433: sprintf(prfx[total_prfxs++],"%.*s",LEN_PRFX,str); }
434: fclose(stream); }
435: i=b=0;
436: while(1) {
437: for(j=0;j<total_prfxs;j++)
438: strcpy(opt[j],prfx[j]);
439: opt[j][0]=NULL;
440: j=WIN_ACT|WIN_SAV;
441: if(total_prfxs)
442: j|=WIN_DEL;
443: if(total_prfxs<MAX_PRFX)
444: j|=WIN_INS|WIN_INSACT|WIN_XTR;
445: i=ulist(j,0,0,30,&i,&b,"Allowed Prefix List",opt);
446: if((i&0xf000)==MSK_DEL) {
447: i&=0xfff;
448: total_prfxs--;
449: for(j=i;j<total_prfxs;j++)
450: strcpy(prfx[j],prfx[j+1]);
451: strcpy(prfx[j+1],"");
452: continue; }
453: if((i&0xf000)==MSK_INS) {
454: i&=0xfff;
455: if(uinput(WIN_MID|WIN_SAV,0,0,"Enter Prefix",str,LEN_PRFX
456: ,K_NUMBER)<1)
457: continue;
458: ++total_prfxs;
459: if(total_prfxs)
460: for(j=total_prfxs;j>i;j--)
461: strcpy(prfx[j],prfx[j-1]);
462: strcpy(prfx[i],str);
463: continue; }
464: if(i==-1) {
465: if((file=open("ALLOWED.DAT",
466: O_WRONLY|O_BINARY|O_CREAT|O_TRUNC|O_DENYALL,
467: S_IREAD|S_IWRITE))==-1) {
468: textattr(LIGHTGRAY);
469: clrscr();
470: lprintf("Error opening ALLOWED.DAT\r\n");
471: bail(1); }
472: if((stream=fdopen(file,"wb"))==NULL) {
473: textattr(LIGHTGRAY);
474: clrscr();
475: lprintf("Error fdopen ALLOWED.DAT\r\n");
476: bail(1); }
477: for(i=0;i<total_prfxs;i++) {
478: fprintf(stream,"%s\r\n",prfx[i]); }
479: fclose(stream);
480: for(i=0;i<MAX_PRFX;i++)
481: FREE(prfx[i]);
482: FREE(prfx);
483: break; }
484: /* else CR was hit */
485: uinput(WIN_MID|WIN_SAV,0,0,"Edit Prefix"
486: ,prfx[i],LEN_PRFX,K_EDIT|K_NUMBER); }
487: break;
488: case 3:
489: helpbuf=
490: " Long Distance Prefix List \r\n\r\n"
491: "Any phone numbers entered whose prefixes matches a number contained\r\n"
492: "in this list, will be considered a long distance number. For example,\r\n"
493: "in the same area code, the phone number 234-5678 is long distance to you,\r\n"
494: "so placing 234 in this list will make SCB view calls to that prefix as\r\n"
495: "long distance.\r\n"
496: "\r\n"
497: "If the &Long Distance if not an Allowed Prefix& toggle option is set to\r\n"
498: "&Yes&, then this list is not used.\r\n";
499:
500: total_prfxs=0;
501: if((prfx=(char **)MALLOC(sizeof(char *)*MAX_PRFX))==NULL) {
502: cputs("memory allocation error\r\n");
503: bail(1); }
504: for(i=0;i<MAX_PRFX;i++)
505: if((prfx[i]=(char *)MALLOC(LEN_PRFX+1))==NULL) {
506: cputs("memory allocation error\r\n");
507: bail(1); }
508:
509: if(fexist("LDPREFIX.DAT")) {
510: if((file=open("LDPREFIX.DAT",
511: O_RDONLY|O_BINARY|O_DENYNONE))==-1) {
512: textattr(LIGHTGRAY);
513: clrscr();
514: lprintf("Error opening LDPREFIX.DAT\r\n");
515: bail(1); }
516: if((stream=fdopen(file,"rb"))==NULL) {
517: textattr(LIGHTGRAY);
518: clrscr();
519: lprintf("Error fdopen LDPREFIX.DAT\r\n");
520: bail(1); }
521: while(!feof(stream) && total_prfxs<MAX_PRFX) {
522: if(!fgets(str,81,stream))
523: break;
524: truncsp(str);
525: sprintf(prfx[total_prfxs++],"%.*s",LEN_PRFX,str); }
526: fclose(stream); }
527: i=b=0;
528: while(1) {
529: for(j=0;j<total_prfxs;j++)
530: strcpy(opt[j],prfx[j]);
531: opt[j][0]=NULL;
532: j=WIN_ACT|WIN_SAV;
533: if(total_prfxs)
534: j|=WIN_DEL;
535: if(total_prfxs<MAX_PRFX)
536: j|=WIN_INS|WIN_INSACT|WIN_XTR;
537: i=ulist(j,0,0,30,&i,&b,"Long Distance Prefix List",opt);
538: if((i&0xf000)==MSK_DEL) {
539: i&=0xfff;
540: total_prfxs--;
541: for(j=i;j<total_prfxs;j++)
542: strcpy(prfx[j],prfx[j+1]);
543: strcpy(prfx[j+1],"");
544: continue; }
545: if((i&0xf000)==MSK_INS) {
546: i&=0xfff;
547: if(uinput(WIN_MID|WIN_SAV,0,0,"Enter Prefix",str,LEN_PRFX
548: ,K_NUMBER)<1)
549: continue;
550: ++total_prfxs;
551: if(total_prfxs)
552: for(j=total_prfxs;j>i;j--)
553: strcpy(prfx[j],prfx[j-1]);
554: strcpy(prfx[i],str);
555: continue; }
556: if(i==-1) {
557: if((file=open("LDPREFIX.DAT",
558: O_WRONLY|O_BINARY|O_CREAT|O_TRUNC|O_DENYALL,
559: S_IREAD|S_IWRITE))==-1) {
560: textattr(LIGHTGRAY);
561: clrscr();
562: lprintf("Error opening LDPREFIX.DAT\r\n");
563: bail(1); }
564: if((stream=fdopen(file,"wb"))==NULL) {
565: textattr(LIGHTGRAY);
566: clrscr();
567: lprintf("Error fdopen LDPREFIX.DAT\r\n");
568: bail(1); }
569: for(i=0;i<total_prfxs;i++) {
570: fprintf(stream,"%s\r\n",prfx[i]); }
571: fclose(stream);
572: for(i=0;i<MAX_PRFX;i++)
573: FREE(prfx[i]);
574: FREE(prfx);
575: break; }
576: /* else CR was hit */
577: uinput(WIN_MID|WIN_SAV,0,0,"Edit Prefix"
578: ,prfx[i],LEN_PRFX,K_EDIT|K_NUMBER); }
579: break;
580: case 4:
581: helpbuf=
582: " Long Distance Calling Times \r\n\r\n"
583: "You are being prompted to specify the beginning and ending times to\r\n"
584: "allow long distance verification calls (in military 24-hour format).\r\n"
585: "If you wish to allow long distance calls continuously, set both times\r\n"
586: "to 00:00.\r\n"
587: "\r\n"
588: "To disable long distance calls entirely, set the &Allow Long Distance&\r\n"
589: "toggle options to &No&.";
590:
591: j=0;
592: while(1) {
593: k=0;
594: sprintf(opt[k++],"Sunday From %02d:%02d to %02d:%02d"
595: ,ldstart[0]/60,ldstart[0]%60
596: ,ldend[0]/60,ldend[0]%60);
597: sprintf(opt[k++],"Monday From %02d:%02d to %02d:%02d"
598: ,ldstart[1]/60,ldstart[1]%60
599: ,ldend[1]/60,ldend[1]%60);
600: sprintf(opt[k++],"Tuesday From %02d:%02d to %02d:%02d"
601: ,ldstart[2]/60,ldstart[2]%60
602: ,ldend[2]/60,ldend[2]%60);
603: sprintf(opt[k++],"Wednesday From %02d:%02d to %02d:%02d"
604: ,ldstart[3]/60,ldstart[3]%60
605: ,ldend[3]/60,ldend[3]%60);
606: sprintf(opt[k++],"Thursday From %02d:%02d to %02d:%02d"
607: ,ldstart[4]/60,ldstart[4]%60
608: ,ldend[4]/60,ldend[4]%60);
609: sprintf(opt[k++],"Friday From %02d:%02d to %02d:%02d"
610: ,ldstart[5]/60,ldstart[5]%60
611: ,ldend[5]/60,ldend[5]%60);
612: sprintf(opt[k++],"Saturday From %02d:%02d to %02d:%02d"
613: ,ldstart[6]/60,ldstart[6]%60
614: ,ldend[6]/60,ldend[6]%60);
615: opt[k][0]=NULL;
616:
617: j=ulist(WIN_ACT|WIN_SAV,0,0,0,&j,0
618: ,"Long Distance Calling Times",opt);
619: if(j==-1)
620: break;
621: sprintf(str,"%02d:%02d",ldstart[j]/60,ldstart[j]%60);
622: if(uinput(WIN_MID|WIN_SAV,0,0,"Long Distance Start "
623: "Time",str,5,K_EDIT|K_UPPER)) {
624: ldstart[j]=atoi(str)*60;
625: p=strchr(str,':');
626: if(p)
627: ldstart[j]+=atoi(p+1); }
628: sprintf(str,"%02d:%02d",ldend[j]/60,ldend[j]%60);
629: if(uinput(WIN_MID|WIN_SAV,0,0,"Long Distance End Time",
630: str,5,K_EDIT|K_UPPER)) {
631: ldend[j]=atoi(str)*60;
632: p=strchr(str,':');
633: if(p)
634: ldend[j]+=atoi(p+1); } }
635: break;
636: case 5:
637: helpbuf=
638: " Phone Can \r\n\r\n"
639: "This is the complete path (drive, directory, and filename) where a\r\n"
640: "&trashcan& file of phone numbers will be kept. Any numbers inside of this\r\n"
641: "trashcan will not be accepted for callback verification by SCB.";
642: uinput(WIN_MID,0,0,"Phone Can",canfile
643: ,30,K_EDIT|K_UPPER);
644: break;
645: case 6:
646: helpbuf=
647: " Validated Phone List \r\n\r\n"
648: "This is the complete path (drive, directory, and filename) where SCB\r\n"
649: "will write a list of numbers that have been verified.\r\n"
650: "\r\n"
651: "Setting this option to the same file as &Phone Can& will keep users from\r\n"
652: "being validated with an already validated phone number.";
653: uinput(WIN_MID|WIN_BOT,0,0,"Phone List",addfile
654: ,30,K_EDIT|K_UPPER);
655: break;
656: case 7:
657: helpbuf=
658: " Callback Attempts \r\n\r\n"
659: "This is the number of times SCB will attempt to dial out to a phone\r\n"
660: "number.";
661: uinput(WIN_MID|WIN_BOT,0,0,"Callback Attempts",callout_attempts
662: ,2,K_EDIT|K_NUMBER);
663: break;
664: case 8:
665: helpbuf=
666: " Minimum Phone Number Length \r\n\r\n"
667: "This is the minimum number of digits SCB will allow for a phone number.";
668: sprintf(str,"%u",min_phone_len);
669: uinput(WIN_MID|WIN_BOT,0,0,"Minimum Phone Length",str
670: ,2,K_EDIT|K_NUMBER);
671: min_phone_len=atoi(str);
672: break;
673: case 9:
674: helpbuf=
675: " Maximum Phone Number Length \r\n\r\n"
676: "This is the maximum number of digits SCB will allow for a phone number.";
677: sprintf(str,"%u",max_phone_len);
678: uinput(WIN_MID|WIN_BOT,0,0,"Maximum Phone Length",str
679: ,2,K_EDIT|K_NUMBER);
680: max_phone_len=atoi(str);
681: break;
682: case 10:
683: helpbuf=
684: " Wait Before Dialing \r\n\r\n"
685: "When the BBS hangs up prior to calling a user, this is the amount of\r\n"
686: "time (in seconds) that the modem will remain hung up before dialing.\r\n"
687: "This is used to insure that the user has completely disconnected.\r\n"
688: "The default setting here is 30 seconds, maximum is 90 seconds.";
689: sprintf(str,"%u",hangup_time);
690: uinput(WIN_MID|WIN_BOT,0,0,"Wait Before Dialing (in seconds)",str
691: ,3,K_EDIT|K_NUMBER);
692: hangup_time=atoi(str);
693: if(hangup_time>90)
694: hangup_time=90;
695: break;
696: case 11:
697: helpbuf=
698: " BBS Area Code \r\n\r\n"
699: "Enter the area code for YOUR BBS here. A user enters a phone number\r\n"
700: "with this area code, SCB will strip off the area code before attempting\r\n"
701: "to call the user back (setting this to 0 disables it).";
702: uinput(WIN_MID|WIN_BOT,0,0,"BBS Area Code",bbs_ac
703: ,3,K_EDIT|K_NUMBER);
704: break;
705: case 12:
706: helpbuf=
707: " Send Message to Sysop \r\n\r\n"
708: "If you wish for SCB to send a message to a Sysop when a user has been\r\n"
709: "verified, set this to the number of the user who is to receive the\r\n"
710: "messages, or set it to 0 to disable this function.";
711: uinput(WIN_MID|WIN_BOT,0,0,"Send Message to Sysop - User #",sysop
712: ,4,K_EDIT|K_NUMBER);
713: break;
714:
715: case -1:
716: helpbuf=
717: " Save Configuration File \r\n\r\n"
718: "Select &Yes& to save the config file, &No& to quit without saving,\r\n"
719: "or hit ESC to go back to the menu.\r\n\r\n";
720: i=0;
721: strcpy(opt[0],"Yes");
722: strcpy(opt[1],"No");
723: opt[2][0]=0;
724: i=ulist(WIN_MID,0,0,0,&i,0,"Save Config File",opt);
725: if(i==-1) break;
726: if(i) bail(0);
727: if((file=open("SCB.CFG"
728: ,O_WRONLY|O_BINARY|O_CREAT|O_DENYALL|O_TRUNC))==-1) {
729: textattr(LIGHTGRAY);
730: clrscr();
731: lprintf("Error opening SCB.CFG\r\n");
732: bail(1); }
733: if((stream=fdopen(file,"wb"))==NULL) {
734: textattr(LIGHTGRAY);
735: clrscr();
736: lprintf("Error fdopen SCB.CFG\r\n");
737: bail(1); }
738: str[0]=0;
739: fprintf(stream,"%s\r\n",callout_attempts);
740: if(options&ALWAYS_VALIDATE) strcat(str,"Y"); else strcat(str,"N");
741: if(options&MODIFY_USER_NOTE) strcat(str,"Y"); else strcat(str,"N");
742: if(options&START_WITH_0) strcat(str,"Y"); else strcat(str,"N");
743: if(options&START_WITH_1) strcat(str,"Y"); else strcat(str,"N");
744: if(options&STAY_CONNECTED) strcat(str,"Y"); else strcat(str,"N");
745: if(options&SC_LOCAL_ONLY) strcat(str,"Y"); else strcat(str,"N");
746: if(options&US_PHONE_FORMAT) strcat(str,"Y"); else strcat(str,"N");
747: if(options&ALLOWED_ONLY) strcat(str,"Y"); else strcat(str,"N");
748: if(options&SAME_AREA_LD) strcat(str,"Y"); else strcat(str,"N");
749: fprintf(stream,"%s\r\n",str);
750: fprintf(stream,"%s\r\n",canfile);
751: fprintf(stream,"%s\r\n",addfile);
752: fprintf(stream,"%s\r\n",credits);
753: fprintf(stream,"%s\r\n",sysop);
754: fprintf(stream,"%s\r\n",level);
755: fprintf(stream,"%s\r\n",flags1);
756: fprintf(stream,"%s\r\n",flags2);
757: fprintf(stream,"%s\r\n",exempt);
758: fprintf(stream,"%s\r\n",restrict);
759: fprintf(stream,"%s\r\n",expiration);
760: fprintf(stream,"%s\r\n",minutes);
761: fprintf(stream,"%s\r\n",flags3);
762: fprintf(stream,"%s\r\n",flags4);
763: for(i=0;i<7;i++) {
764: fprintf(stream,"%u\r\n",ldstart[i]);
765: fprintf(stream,"%u\r\n",ldend[i]); }
766: fprintf(stream,"%u\r\n",min_phone_len);
767: fprintf(stream,"%u\r\n",max_phone_len);
768: fprintf(stream,"%s\r\n",bbs_ac);
769: fprintf(stream,"%u\r\n",hangup_time);
770: fprintf(stream,"%s\r\n",""); // regnum
771: fclose(stream);
772: bail(0);
773: }
774: }
775: }
776: /****************************************************************************/
777: /* Checks the disk drive for the existance of a file. Returns 1 if it */
778: /* exists, 0 if it doesn't. */
779: /* Called from upload */
780: /****************************************************************************/
781: char fexist(char *filespec)
782: {
783: struct ffblk f;
784:
785: if(findfirst(filespec,&f,0)==NULL)
786: return(1);
787: return(0);
788: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.