|
|
1.1 root 1: /* scfgxfr1.c */
2:
3: /* $Id: scfgxfr1.c,v 1.13 2004/04/21 22:39:41 rswindell Exp $ */
4:
5: /****************************************************************************
6: * @format.tab-size 4 (Plain Text/Source Code File Header) *
7: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
8: * *
9: * Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html *
10: * *
11: * This program is free software; you can redistribute it and/or *
12: * modify it under the terms of the GNU General Public License *
13: * as published by the Free Software Foundation; either version 2 *
14: * of the License, or (at your option) any later version. *
15: * See the GNU General Public License for more details: gpl.txt or *
16: * http://www.fsf.org/copyleft/gpl.html *
17: * *
18: * Anonymous FTP access to the most recent released source is available at *
19: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
20: * *
21: * Anonymous CVS access to the development source and modification history *
22: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
23: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
24: * (just hit return, no password is necessary) *
25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
26: * *
27: * For Synchronet coding style and modification guidelines, see *
28: * http://www.synchro.net/source.html *
29: * *
30: * You are encouraged to submit any modifications (preferably in Unix diff *
31: * format) via e-mail to [email protected] *
32: * *
33: * Note: If this box doesn't appear square, then you need to fix your tabs. *
34: ****************************************************************************/
35:
36: #include "scfg.h"
37:
38: void xfer_opts()
39: {
40: char str[128],done;
41: int i,j,l;
42: static int xfr_dflt;
43: static int fextr_dflt;
44: static int fextr_opt;
45: static int fview_dflt;
46: static int fview_opt;
47: static int ftest_dflt;
48: static int ftest_opt;
49: static int fcomp_dflt;
50: static int fcomp_opt;
51: static int prot_dflt;
52: static int prot_opt;
53: static int dlevent_dflt;
54: static int dlevent_opt;
55: static int altpath_dflt;
56: static fextr_t savfextr;
57: static fview_t savfview;
58: static ftest_t savftest;
59: static fcomp_t savfcomp;
60: static prot_t savprot;
61: static dlevent_t savdlevent;
62: static char savaltpath[LEN_DIR+1];
63:
64: while(1) {
65: i=0;
66: sprintf(opt[i++],"%-33.33s%uk","Min Bytes Free Disk Space"
67: ,cfg.min_dspace);
68: sprintf(opt[i++],"%-33.33s%u","Max Files in Batch UL Queue"
69: ,cfg.max_batup);
70: sprintf(opt[i++],"%-33.33s%u","Max Files in Batch DL Queue"
71: ,cfg.max_batdn);
72: sprintf(opt[i++],"%-33.33s%u","Max Users in User Transfers"
73: ,cfg.max_userxfer);
74: sprintf(opt[i++],"%-33.33s%u%%","Default Credit on Upload"
75: ,cfg.cdt_up_pct);
76: sprintf(opt[i++],"%-33.33s%u%%","Default Credit on Download"
77: ,cfg.cdt_dn_pct);
78: if(cfg.leech_pct)
79: sprintf(str,"%u%% after %u seconds"
80: ,cfg.leech_pct,cfg.leech_sec);
81: else
82: strcpy(str,"Disabled");
83: sprintf(opt[i++],"%-33.33s%s","Long Filenames in Listings"
84: ,cfg.file_misc&FM_NO_LFN ? "No":"Yes");
85: sprintf(opt[i++],"%-33.33s%s","Leech Protocol Detection",str);
86: strcpy(opt[i++],"Viewable Files...");
87: strcpy(opt[i++],"Testable Files...");
88: strcpy(opt[i++],"Download Events...");
89: strcpy(opt[i++],"Extractable Files...");
90: strcpy(opt[i++],"Compressable Files...");
91: strcpy(opt[i++],"Transfer Protocols...");
92: strcpy(opt[i++],"Alternate File Paths...");
93: opt[i][0]=0;
94: SETHELP(WHERE);
95: /*
96: &File Transfer Configuration:&
97:
98: This menu has options and sub-menus that pertain specifically to the
99: file transfer section of the BBS.
100: */
101: switch(uifc.list(WIN_ORG|WIN_ACT|WIN_CHE,0,0,72,&xfr_dflt,0
102: ,"File Transfer Configuration",opt)) {
103: case -1:
104: i=save_changes(WIN_MID);
105: if(i==-1)
106: break;
107: if(!i) {
108: write_file_cfg(&cfg,backup_level);
109: refresh_cfg(&cfg);
110: }
111: return;
112: case 0:
113: SETHELP(WHERE);
114: /*
115: &Minimum Kilobytes Free Disk Space to Allow Uploads:&
116:
117: This is the minimum free space in a file directory to allow user
118: uploads.
119: */
120: uifc.input(WIN_MID,0,0
121: ,"Minimum Kilobytes Free Disk Space to Allow Uploads"
122: ,ultoa(cfg.min_dspace,tmp,10),5,K_EDIT|K_NUMBER);
123: cfg.min_dspace=atoi(tmp);
124: break;
125: case 1:
126: SETHELP(WHERE);
127: /*
128: &Maximum Files in Batch Upload Queue:&
129:
130: This is the maximum number of files that can be placed in the batch
131: upload queue.
132: */
133: uifc.input(WIN_MID,0,0,"Maximum Files in Batch Upload Queue"
134: ,ultoa(cfg.max_batup,tmp,10),5,K_EDIT|K_NUMBER);
135: cfg.max_batup=atoi(tmp);
136: break;
137: case 2:
138: SETHELP(WHERE);
139: /*
140: &Maximum Files in Batch Download Queue:&
141:
142: This is the maximum number of files that can be placed in the batch
143: download queue.
144: */
145: uifc.input(WIN_MID,0,0,"Maximum Files in Batch Download Queue"
146: ,ultoa(cfg.max_batdn,tmp,10),5,K_EDIT|K_NUMBER);
147: cfg.max_batdn=atoi(tmp);
148: break;
149: case 3:
150: SETHELP(WHERE);
151: /*
152: &Maximum Destination Users in User to User Transfer:&
153:
154: This is the maximum number of users allowed in the destination user list
155: of a user to user upload.
156: */
157: uifc.input(WIN_MID,0,0
158: ,"Maximum Destination Users in User to User Transfers"
159: ,ultoa(cfg.max_userxfer,tmp,10),5,K_EDIT|K_NUMBER);
160: cfg.max_userxfer=atoi(tmp);
161: break;
162: case 4:
163: SETHELP(WHERE);
164: /*
165: &Default Percentage of Credits to Credit Uploader on Upload:&
166:
167: This is the default setting that will be used when new file
168: directories are created.
169: */
170: uifc.input(WIN_MID,0,0
171: ,"Default Percentage of Credits to Credit Uploader on Upload"
172: ,ultoa(cfg.cdt_up_pct,tmp,10),4,K_EDIT|K_NUMBER);
173: cfg.cdt_up_pct=atoi(tmp);
174: break;
175: case 5:
176: SETHELP(WHERE);
177: /*
178: &Default Percentage of Credits to Credit Uploader on Download:&
179:
180: This is the default setting that will be used when new file
181: directories are created.
182: */
183: uifc.input(WIN_MID,0,0
184: ,"Default Percentage of Credits to Credit Uploader on Download"
185: ,ultoa(cfg.cdt_dn_pct,tmp,10),4,K_EDIT|K_NUMBER);
186: cfg.cdt_dn_pct=atoi(tmp);
187: break;
188: case 6:
189: strcpy(opt[0],"Yes");
190: strcpy(opt[1],"No");
191: opt[2][0]=0;
192: i=0;
193: SETHELP(WHERE);
194: /*
195: &Long Filenames in File Listings:&
196:
197: If you want long filenames to be displayed in the BBS file listings, set
198: this option to &Yes&. Note: This feature requires Windows 98, Windows 2000
199: or later.
200: */
201: i=uifc.list(WIN_MID|WIN_SAV,0,0,0,&i,0
202: ,"Long Filenames in Listings (Win98/Win2K)",opt);
203: if(!i && cfg.file_misc&FM_NO_LFN) {
204: cfg.file_misc&=~FM_NO_LFN;
205: uifc.changes=1;
206: } else if(i==1 && !(cfg.file_misc&FM_NO_LFN)) {
207: cfg.file_misc|=FM_NO_LFN;
208: uifc.changes=1;
209: }
210: break;
211:
212: case 7:
213: SETHELP(WHERE);
214: /*
215: &Leech Protocol Detection Percentage:&
216:
217: This value is the sensitivity of the leech protocol detection feature of
218: Synchronet. If the transfer is apparently unsuccessful, but the transfer
219: time was at least this percentage of the estimated transfer time (based
220: on the estimated CPS of the connection result code), then a leech
221: protocol error is issued and the user's leech download counter is
222: incremented. Setting this value to &0& disables leech protocol detection.
223: */
224: uifc.savnum=0;
225: uifc.input(WIN_MID|WIN_SAV,0,0
226: ,"Leech Protocol Detection Percentage (0=Disabled)"
227: ,ultoa(cfg.leech_pct,tmp,10),3,K_EDIT|K_NUMBER);
228: cfg.leech_pct=atoi(tmp);
229: if(!cfg.leech_pct)
230: break;
231: SETHELP(WHERE);
232: /*
233: &Leech Protocol Minimum Time (in Seconds):&
234:
235: This option allows you to adjust the sensitivity of the leech protocol
236: detection feature. This value is the minimum length of transfer time
237: (in seconds) that must elapse before an aborted tranfser will be
238: considered a possible leech attempt.
239: */
240: uifc.input(WIN_MID,0,0
241: ,"Leech Protocol Minimum Time (in Seconds)"
242: ,ultoa(cfg.leech_sec,tmp,10),3,K_EDIT|K_NUMBER);
243: cfg.leech_sec=atoi(tmp);
244: break;
245: case 8: /* Viewable file types */
246: while(1) {
247: for(i=0;i<cfg.total_fviews && i<MAX_OPTS;i++)
248: sprintf(opt[i],"%-3.3s %-40s",cfg.fview[i]->ext,cfg.fview[i]->cmd);
249: opt[i][0]=0;
250: i=WIN_ACT|WIN_SAV; /* save cause size can change */
251: if(cfg.total_fviews<MAX_OPTS)
252: i|=WIN_INS|WIN_XTR;
253: if(cfg.total_fviews)
254: i|=WIN_DEL|WIN_GET;
255: if(savfview.cmd[0])
256: i|=WIN_PUT;
257: uifc.savnum=0;
258: SETHELP(WHERE);
259: /*
260: &Viewable File Types:&
261:
262: This is a list of file types that have content information that can be
263: viewed through the execution of an external program. Here are a couple of
264: command line examples for a few file types.
265: */
266: i=uifc.list(i,0,0,50,&fview_dflt,NULL,"Viewable File Types",opt);
267: if(i==-1)
268: break;
269: if((i&MSK_ON)==MSK_DEL) {
270: i&=MSK_OFF;
271: FREE(cfg.fview[i]);
272: cfg.total_fviews--;
273: while(i<cfg.total_fviews) {
274: cfg.fview[i]=cfg.fview[i+1];
275: i++; }
276: uifc.changes=1;
277: continue; }
278: if((i&MSK_ON)==MSK_INS) {
279: i&=MSK_OFF;
280: if((cfg.fview=(fview_t **)REALLOC(cfg.fview
281: ,sizeof(fview_t *)*(cfg.total_fviews+1)))==NULL) {
282: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_fviews+1);
283: cfg.total_fviews=0;
284: bail(1);
285: continue; }
286: if(!cfg.total_fviews) {
287: if((cfg.fview[0]=(fview_t *)MALLOC(
288: sizeof(fview_t)))==NULL) {
289: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fview_t));
290: continue; }
291: memset(cfg.fview[0],0,sizeof(fview_t));
292: strcpy(cfg.fview[0]->ext,"ZIP");
293: strcpy(cfg.fview[0]->cmd,"%!pkunzip -v %f"); }
294: else {
295: for(j=cfg.total_fviews;j>i;j--)
296: cfg.fview[j]=cfg.fview[j-1];
297: if((cfg.fview[i]=(fview_t *)MALLOC(
298: sizeof(fview_t)))==NULL) {
299: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fview_t));
300: continue; }
301: if(i>=cfg.total_fviews)
302: j=i-1;
303: else
304: j=i+1;
305: *cfg.fview[i]=*cfg.fview[j]; }
306: cfg.total_fviews++;
307: uifc.changes=1;
308: continue; }
309: if((i&MSK_ON)==MSK_GET) {
310: i&=MSK_OFF;
311: savfview=*cfg.fview[i];
312: continue; }
313: if((i&MSK_ON)==MSK_PUT) {
314: i&=MSK_OFF;
315: *cfg.fview[i]=savfview;
316: uifc.changes=1;
317: continue; }
318: done=0;
319: while(!done) {
320: j=0;
321: sprintf(opt[j++],"%-22.22s%s","File Extension"
322: ,cfg.fview[i]->ext);
323: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
324: ,cfg.fview[i]->cmd);
325: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
326: ,cfg.fview[i]->arstr);
327: opt[j][0]=0;
328: uifc.savnum=1;
329: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&fview_opt,0
330: ,"Viewable File Type",opt)) {
331: case -1:
332: done=1;
333: break;
334: case 0:
335: uifc.input(WIN_MID|WIN_SAV,0,0
336: ,"Viewable File Type Extension"
337: ,cfg.fview[i]->ext,sizeof(cfg.fview[i]->ext)-1,K_EDIT);
338: break;
339: case 1:
340: uifc.input(WIN_MID|WIN_SAV,0,0
341: ,"Command"
342: ,cfg.fview[i]->cmd,sizeof(cfg.fview[i]->cmd)-1,K_EDIT);
343: break;
344: case 2:
345: uifc.savnum=2;
346: sprintf(str,"Viewable File Type %s"
347: ,cfg.fview[i]->ext);
348: getar(str,cfg.fview[i]->arstr);
349: break; } } }
350: break;
351: case 9: /* Testable file types */
352: while(1) {
353: for(i=0;i<cfg.total_ftests && i<MAX_OPTS;i++)
354: sprintf(opt[i],"%-3.3s %-40s",cfg.ftest[i]->ext,cfg.ftest[i]->cmd);
355: opt[i][0]=0;
356: i=WIN_ACT|WIN_SAV; /* save cause size can change */
357: if(cfg.total_ftests<MAX_OPTS)
358: i|=WIN_INS|WIN_XTR;
359: if(cfg.total_ftests)
360: i|=WIN_DEL|WIN_GET;
361: if(savftest.cmd[0])
362: i|=WIN_PUT;
363: uifc.savnum=0;
364: SETHELP(WHERE);
365: /*
366: &Testable File Types:&
367:
368: This is a list of file types that will have a command line executed to
369: test the file integrity upon their upload. The file types are specified
370: by &extension& and if one file extension is listed more than once, each
371: command line will be executed. The command lines must return a DOS error
372: code of 0 (no error) in order for the file to pass the test. This method
373: of file testing upon upload is also known as an upload event. This test
374: or event, can do more than just test the file, it can perform any
375: function that the sysop wishes. Such as adding comments to an archived
376: file, or extracting an archive and performing a virus scan. While the
377: external program is executing, a text string is displayed to the user.
378: This &working string& can be set for each file type and command line
379: listed.
380: */
381: i=uifc.list(i,0,0,50,&ftest_dflt,NULL,"Testable File Types",opt);
382: if(i==-1)
383: break;
384: if((i&MSK_ON)==MSK_DEL) {
385: i&=MSK_OFF;
386: FREE(cfg.ftest[i]);
387: cfg.total_ftests--;
388: while(i<cfg.total_ftests) {
389: cfg.ftest[i]=cfg.ftest[i+1];
390: i++; }
391: uifc.changes=1;
392: continue; }
393: if((i&MSK_ON)==MSK_INS) {
394: i&=MSK_OFF;
395: if((cfg.ftest=(ftest_t **)REALLOC(cfg.ftest
396: ,sizeof(ftest_t *)*(cfg.total_ftests+1)))==NULL) {
397: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_ftests+1);
398: cfg.total_ftests=0;
399: bail(1);
400: continue; }
401: if(!cfg.total_ftests) {
402: if((cfg.ftest[0]=(ftest_t *)MALLOC(
403: sizeof(ftest_t)))==NULL) {
404: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(ftest_t));
405: continue; }
406: memset(cfg.ftest[0],0,sizeof(ftest_t));
407: strcpy(cfg.ftest[0]->ext,"ZIP");
408: strcpy(cfg.ftest[0]->cmd,"%!pkunzip -t %f");
409: strcpy(cfg.ftest[0]->workstr,"Testing ZIP Integrity..."); }
410: else {
411:
412: for(j=cfg.total_ftests;j>i;j--)
413: cfg.ftest[j]=cfg.ftest[j-1];
414: if((cfg.ftest[i]=(ftest_t *)MALLOC(
415: sizeof(ftest_t)))==NULL) {
416: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(ftest_t));
417: continue; }
418: if(i>=cfg.total_ftests)
419: j=i-1;
420: else
421: j=i+1;
422: *cfg.ftest[i]=*cfg.ftest[j]; }
423: cfg.total_ftests++;
424: uifc.changes=1;
425: continue; }
426: if((i&MSK_ON)==MSK_GET) {
427: i&=MSK_OFF;
428: savftest=*cfg.ftest[i];
429: continue; }
430: if((i&MSK_ON)==MSK_PUT) {
431: i&=MSK_OFF;
432: *cfg.ftest[i]=savftest;
433: uifc.changes=1;
434: continue; }
435: done=0;
436: while(!done) {
437: j=0;
438: sprintf(opt[j++],"%-22.22s%s","File Extension"
439: ,cfg.ftest[i]->ext);
440: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
441: ,cfg.ftest[i]->cmd);
442: sprintf(opt[j++],"%-22.22s%s","Working String"
443: ,cfg.ftest[i]->workstr);
444: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
445: ,cfg.ftest[i]->arstr);
446: opt[j][0]=0;
447: uifc.savnum=1;
448: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&ftest_opt,0
449: ,"Testable File Type",opt)) {
450: case -1:
451: done=1;
452: break;
453: case 0:
454: uifc.input(WIN_MID|WIN_SAV,0,0
455: ,"Testable File Type Extension"
456: ,cfg.ftest[i]->ext,sizeof(cfg.ftest[i]->ext)-1,K_EDIT);
457: break;
458: case 1:
459: uifc.input(WIN_MID|WIN_SAV,0,0
460: ,"Command"
461: ,cfg.ftest[i]->cmd,sizeof(cfg.ftest[i]->cmd)-1,K_EDIT);
462: break;
463: case 2:
464: uifc.input(WIN_MID|WIN_SAV,0,0
465: ,"Working String"
466: ,cfg.ftest[i]->workstr,sizeof(cfg.ftest[i]->workstr)-1,K_EDIT|K_MSG);
467: break;
468: case 3:
469: uifc.savnum=2;
470: sprintf(str,"Testable File Type %s",cfg.ftest[i]->ext);
471: getar(str,cfg.ftest[i]->arstr);
472: break; } } }
473: break;
474: case 10: /* Download Events */
475: while(1) {
476: for(i=0;i<cfg.total_dlevents && i<MAX_OPTS;i++)
477: sprintf(opt[i],"%-3.3s %-40s",cfg.dlevent[i]->ext,cfg.dlevent[i]->cmd);
478: opt[i][0]=0;
479: i=WIN_ACT|WIN_SAV; /* save cause size can change */
480: if(cfg.total_dlevents<MAX_OPTS)
481: i|=WIN_INS|WIN_XTR;
482: if(cfg.total_dlevents)
483: i|=WIN_DEL|WIN_GET;
484: if(savdlevent.cmd[0])
485: i|=WIN_PUT;
486: uifc.savnum=0;
487: SETHELP(WHERE);
488: /*
489: &Download Events:&
490:
491: This is a list of file types that will have a command line executed to
492: perform an event upon their download (e.g. trigger a download event).
493: The file types are specified by &extension& and if one file extension
494: is listed more than once, each command line will be executed. The
495: command lines must return a DOS error code of 0 (no error) in order
496: for the file to pass the test. This test or event, can do more than
497: just test the file, it can perform any function that the sysop wishes.
498: Such as adding comments to an archived file, or extracting an archive
499: and performing a virus scan. While the external program is executing,
500: a text string is displayed to the user. This &working string& can be set
501: for each file type and command line listed.
502: */
503: i=uifc.list(i,0,0,50,&dlevent_dflt,NULL,"Download Events",opt);
504: if(i==-1)
505: break;
506: if((i&MSK_ON)==MSK_DEL) {
507: i&=MSK_OFF;
508: FREE(cfg.dlevent[i]);
509: cfg.total_dlevents--;
510: while(i<cfg.total_dlevents) {
511: cfg.dlevent[i]=cfg.dlevent[i+1];
512: i++; }
513: uifc.changes=1;
514: continue; }
515: if((i&MSK_ON)==MSK_INS) {
516: i&=MSK_OFF;
517: if((cfg.dlevent=(dlevent_t **)REALLOC(cfg.dlevent
518: ,sizeof(dlevent_t *)*(cfg.total_dlevents+1)))==NULL) {
519: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_dlevents+1);
520: cfg.total_dlevents=0;
521: bail(1);
522: continue; }
523: if(!cfg.total_dlevents) {
524: if((cfg.dlevent[0]=(dlevent_t *)MALLOC(
525: sizeof(dlevent_t)))==NULL) {
526: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(dlevent_t));
527: continue; }
528: memset(cfg.dlevent[0],0,sizeof(dlevent_t));
529: strcpy(cfg.dlevent[0]->ext,"ZIP");
530: strcpy(cfg.dlevent[0]->cmd,"%!pkzip -z %f "
531: "< ..\\text\\zipmsg.txt");
532: strcpy(cfg.dlevent[0]->workstr,"Adding ZIP Comment..."); }
533: else {
534:
535: for(j=cfg.total_dlevents;j>i;j--)
536: cfg.dlevent[j]=cfg.dlevent[j-1];
537: if((cfg.dlevent[i]=(dlevent_t *)MALLOC(
538: sizeof(dlevent_t)))==NULL) {
539: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(dlevent_t));
540: continue; }
541: if(i>=cfg.total_dlevents)
542: j=i-1;
543: else
544: j=i+1;
545: *cfg.dlevent[i]=*cfg.dlevent[j]; }
546: cfg.total_dlevents++;
547: uifc.changes=1;
548: continue; }
549: if((i&MSK_ON)==MSK_GET) {
550: i&=MSK_OFF;
551: savdlevent=*cfg.dlevent[i];
552: continue; }
553: if((i&MSK_ON)==MSK_PUT) {
554: i&=MSK_OFF;
555: *cfg.dlevent[i]=savdlevent;
556: uifc.changes=1;
557: continue; }
558: done=0;
559: while(!done) {
560: j=0;
561: sprintf(opt[j++],"%-22.22s%s","File Extension"
562: ,cfg.dlevent[i]->ext);
563: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
564: ,cfg.dlevent[i]->cmd);
565: sprintf(opt[j++],"%-22.22s%s","Working String"
566: ,cfg.dlevent[i]->workstr);
567: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
568: ,cfg.dlevent[i]->arstr);
569: opt[j][0]=0;
570: uifc.savnum=1;
571: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&dlevent_opt,0
572: ,"Download Event",opt)) {
573: case -1:
574: done=1;
575: break;
576: case 0:
577: uifc.input(WIN_MID|WIN_SAV,0,0
578: ,"Download Event Extension"
579: ,cfg.dlevent[i]->ext,sizeof(cfg.dlevent[i]->ext)-1,K_EDIT);
580: break;
581: case 1:
582: uifc.input(WIN_MID|WIN_SAV,0,0
583: ,"Command"
584: ,cfg.dlevent[i]->cmd,sizeof(cfg.dlevent[i]->cmd)-1,K_EDIT);
585: break;
586: case 2:
587: uifc.input(WIN_MID|WIN_SAV,0,0
588: ,"Working String"
589: ,cfg.dlevent[i]->workstr,sizeof(cfg.dlevent[i]->workstr)-1,K_EDIT|K_MSG);
590: break;
591: case 3:
592: uifc.savnum=2;
593: sprintf(str,"Download Event %s",cfg.dlevent[i]->ext);
594: getar(str,cfg.dlevent[i]->arstr);
595: break; } } }
596: break;
597: case 11: /* Extractable file types */
598: while(1) {
599: for(i=0;i<cfg.total_fextrs && i<MAX_OPTS;i++)
600: sprintf(opt[i],"%-3.3s %-40s"
601: ,cfg.fextr[i]->ext,cfg.fextr[i]->cmd);
602: opt[i][0]=0;
603: i=WIN_ACT|WIN_SAV; /* save cause size can change */
604: if(cfg.total_fextrs<MAX_OPTS)
605: i|=WIN_INS|WIN_XTR;
606: if(cfg.total_fextrs)
607: i|=WIN_DEL|WIN_GET;
608: if(savfextr.cmd[0])
609: i|=WIN_PUT;
610: uifc.savnum=0;
611: SETHELP(WHERE);
612: /*
613: &Extractable File Types:&
614:
615: This is a list of archive file types that can be extracted to the temp
616: directory by an external program. The file types are specified by their
617: extension. For each file type you must specify the command line used to
618: extract the file(s).
619: */
620: i=uifc.list(i,0,0,50,&fextr_dflt,NULL,"Extractable File Types",opt);
621: if(i==-1)
622: break;
623: if((i&MSK_ON)==MSK_DEL) {
624: i&=MSK_OFF;
625: FREE(cfg.fextr[i]);
626: cfg.total_fextrs--;
627: while(i<cfg.total_fextrs) {
628: cfg.fextr[i]=cfg.fextr[i+1];
629: i++; }
630: uifc.changes=1;
631: continue; }
632: if((i&MSK_ON)==MSK_INS) {
633: i&=MSK_OFF;
634: if((cfg.fextr=(fextr_t **)REALLOC(cfg.fextr
635: ,sizeof(fextr_t *)*(cfg.total_fextrs+1)))==NULL) {
636: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_fextrs+1);
637: cfg.total_fextrs=0;
638: bail(1);
639: continue; }
640: if(!cfg.total_fextrs) {
641: if((cfg.fextr[0]=(fextr_t *)MALLOC(
642: sizeof(fextr_t)))==NULL) {
643: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fextr_t));
644: continue; }
645: memset(cfg.fextr[0],0,sizeof(fextr_t));
646: strcpy(cfg.fextr[0]->ext,"ZIP");
647: strcpy(cfg.fextr[0]->cmd,"%!pkunzip -o %f %g %s"); }
648: else {
649:
650: for(j=cfg.total_fextrs;j>i;j--)
651: cfg.fextr[j]=cfg.fextr[j-1];
652: if((cfg.fextr[i]=(fextr_t *)MALLOC(
653: sizeof(fextr_t)))==NULL) {
654: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fextr_t));
655: continue; }
656: if(i>=cfg.total_fextrs)
657: j=i-1;
658: else
659: j=i+1;
660: *cfg.fextr[i]=*cfg.fextr[j]; }
661: cfg.total_fextrs++;
662: uifc.changes=1;
663: continue; }
664: if((i&MSK_ON)==MSK_GET) {
665: i&=MSK_OFF;
666: savfextr=*cfg.fextr[i];
667: continue; }
668: if((i&MSK_ON)==MSK_PUT) {
669: i&=MSK_OFF;
670: *cfg.fextr[i]=savfextr;
671: uifc.changes=1;
672: continue; }
673: done=0;
674: while(!done) {
675: j=0;
676: sprintf(opt[j++],"%-22.22s%s","File Extension"
677: ,cfg.fextr[i]->ext);
678: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
679: ,cfg.fextr[i]->cmd);
680: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
681: ,cfg.fextr[i]->arstr);
682: opt[j][0]=0;
683: uifc.savnum=1;
684: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&fextr_opt,0
685: ,"Extractable File Type",opt)) {
686: case -1:
687: done=1;
688: break;
689: case 0:
690: uifc.input(WIN_MID|WIN_SAV,0,0
691: ,"Extractable File Type Extension"
692: ,cfg.fextr[i]->ext,sizeof(cfg.fextr[i]->ext)-1,K_EDIT);
693: break;
694: case 1:
695: uifc.input(WIN_MID|WIN_SAV,0,0
696: ,"Command"
697: ,cfg.fextr[i]->cmd,sizeof(cfg.fextr[i]->cmd)-1,K_EDIT);
698: break;
699: case 2:
700: uifc.savnum=2;
701: sprintf(str,"Extractable File Type %s"
702: ,cfg.fextr[i]->ext);
703: getar(str,cfg.fextr[i]->arstr);
704: break; } } }
705: break;
706: case 12: /* Compressable file types */
707: while(1) {
708: for(i=0;i<cfg.total_fcomps && i<MAX_OPTS;i++)
709: sprintf(opt[i],"%-3.3s %-40s",cfg.fcomp[i]->ext,cfg.fcomp[i]->cmd);
710: opt[i][0]=0;
711: i=WIN_ACT|WIN_SAV; /* save cause size can change */
712: if(cfg.total_fcomps<MAX_OPTS)
713: i|=WIN_INS|WIN_XTR;
714: if(cfg.total_fcomps)
715: i|=WIN_DEL|WIN_GET;
716: if(savfcomp.cmd[0])
717: i|=WIN_PUT;
718: uifc.savnum=0;
719: SETHELP(WHERE);
720: /*
721: &Compressable File Types:&
722:
723: This is a list of compression methods available for different file types.
724: These will be used for items such as creating QWK packets, temporary
725: files from the transfer section, and more.
726: */
727: i=uifc.list(i,0,0,50,&fcomp_dflt,NULL,"Compressable File Types",opt);
728: if(i==-1)
729: break;
730: if((i&MSK_ON)==MSK_DEL) {
731: i&=MSK_OFF;
732: FREE(cfg.fcomp[i]);
733: cfg.total_fcomps--;
734: while(i<cfg.total_fcomps) {
735: cfg.fcomp[i]=cfg.fcomp[i+1];
736: i++; }
737: uifc.changes=1;
738: continue; }
739: if((i&MSK_ON)==MSK_INS) {
740: i&=MSK_OFF;
741: if((cfg.fcomp=(fcomp_t **)REALLOC(cfg.fcomp
742: ,sizeof(fcomp_t *)*(cfg.total_fcomps+1)))==NULL) {
743: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_fcomps+1);
744: cfg.total_fcomps=0;
745: bail(1);
746: continue; }
747: if(!cfg.total_fcomps) {
748: if((cfg.fcomp[0]=(fcomp_t *)MALLOC(
749: sizeof(fcomp_t)))==NULL) {
750: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fcomp_t));
751: continue; }
752: memset(cfg.fcomp[0],0,sizeof(fcomp_t));
753: strcpy(cfg.fcomp[0]->ext,"ZIP");
754: strcpy(cfg.fcomp[0]->cmd,"%!pkzip %f %s"); }
755: else {
756: for(j=cfg.total_fcomps;j>i;j--)
757: cfg.fcomp[j]=cfg.fcomp[j-1];
758: if((cfg.fcomp[i]=(fcomp_t *)MALLOC(
759: sizeof(fcomp_t)))==NULL) {
760: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fcomp_t));
761: continue; }
762: if(i>=cfg.total_fcomps)
763: j=i-1;
764: else
765: j=i+1;
766: *cfg.fcomp[i]=*cfg.fcomp[j]; }
767: cfg.total_fcomps++;
768: uifc.changes=1;
769: continue; }
770: if((i&MSK_ON)==MSK_GET) {
771: i&=MSK_OFF;
772: savfcomp=*cfg.fcomp[i];
773: continue; }
774: if((i&MSK_ON)==MSK_PUT) {
775: i&=MSK_OFF;
776: *cfg.fcomp[i]=savfcomp;
777: uifc.changes=1;
778: continue; }
779: done=0;
780: while(!done) {
781: j=0;
782: sprintf(opt[j++],"%-22.22s%s","File Extension"
783: ,cfg.fcomp[i]->ext);
784: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
785: ,cfg.fcomp[i]->cmd);
786: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
787: ,cfg.fcomp[i]->arstr);
788: opt[j][0]=0;
789: uifc.savnum=1;
790: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&fcomp_opt,0
791: ,"Compressable File Type",opt)) {
792: case -1:
793: done=1;
794: break;
795: case 0:
796: uifc.input(WIN_MID|WIN_SAV,0,0
797: ,"Compressable File Type Extension"
798: ,cfg.fcomp[i]->ext,sizeof(cfg.fcomp[i]->ext)-1,K_EDIT);
799: break;
800: case 1:
801: uifc.input(WIN_MID|WIN_SAV,0,0
802: ,"Command"
803: ,cfg.fcomp[i]->cmd,sizeof(cfg.fcomp[i]->cmd)-1,K_EDIT);
804: break;
805: case 2:
806: uifc.savnum=2;
807: sprintf(str,"Compressable File Type %s"
808: ,cfg.fcomp[i]->ext);
809: getar(str,cfg.fcomp[i]->arstr);
810: break; } } }
811: break;
812: case 13: /* Transfer protocols */
813: while(1) {
814: for(i=0;i<cfg.total_prots && i<MAX_OPTS;i++)
815: sprintf(opt[i],"%c %s"
816: ,cfg.prot[i]->mnemonic,cfg.prot[i]->name);
817: opt[i][0]=0;
818: i=WIN_ACT|WIN_SAV; /* save cause size can change */
819: if(cfg.total_prots<MAX_OPTS)
820: i|=WIN_INS|WIN_XTR;
821: if(cfg.total_prots)
822: i|=WIN_DEL|WIN_GET;
823: if(savprot.mnemonic)
824: i|=WIN_PUT;
825: uifc.savnum=0;
826: SETHELP(WHERE);
827: /*
828: &File Transfer Protocols:&
829:
830: This is a list of file transfer protocols that can be used to transfer
831: files either to or from a remote user. For each protocol, you can
832: specify the mnemonic (hot-key) to use to specify that protocol, the
833: command line to use for uploads, downloads, batch uploads, batch
834: downloads, bi-directional file transfers, and the support of DSZLOG. If
835: the protocol doesn't support a certain method of transfer, or you don't
836: wish it to be available for a certain method of transfer, leave the
837: command line for that method blank.
838: */
839: i=uifc.list(i,0,0,50,&prot_dflt,NULL,"File Transfer Protocols",opt);
840: if(i==-1)
841: break;
842: if((i&MSK_ON)==MSK_DEL) {
843: i&=MSK_OFF;
844: FREE(cfg.prot[i]);
845: cfg.total_prots--;
846: while(i<cfg.total_prots) {
847: cfg.prot[i]=cfg.prot[i+1];
848: i++; }
849: uifc.changes=1;
850: continue; }
851: if((i&MSK_ON)==MSK_INS) {
852: i&=MSK_OFF;
853: if((cfg.prot=(prot_t **)REALLOC(cfg.prot
854: ,sizeof(prot_t *)*(cfg.total_prots+1)))==NULL) {
855: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_prots+1);
856: cfg.total_prots=0;
857: bail(1);
858: continue; }
859: if(!cfg.total_prots) {
860: if((cfg.prot[0]=(prot_t *)MALLOC(
861: sizeof(prot_t)))==NULL) {
862: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(prot_t));
863: continue; }
864: memset(cfg.prot[0],0,sizeof(prot_t));
865: cfg.prot[0]->mnemonic='?';
866: } else {
867: for(j=cfg.total_prots;j>i;j--)
868: cfg.prot[j]=cfg.prot[j-1];
869: if((cfg.prot[i]=(prot_t *)MALLOC(
870: sizeof(prot_t)))==NULL) {
871: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(prot_t));
872: continue; }
873: if(i>=cfg.total_prots)
874: j=i-1;
875: else
876: j=i+1;
877: *cfg.prot[i]=*cfg.prot[j]; }
878: cfg.total_prots++;
879: uifc.changes=1;
880: continue; }
881: if((i&MSK_ON)==MSK_GET) {
882: i&=MSK_OFF;
883: savprot=*cfg.prot[i];
884: continue; }
885: if((i&MSK_ON)==MSK_PUT) {
886: i&=MSK_OFF;
887: *cfg.prot[i]=savprot;
888: uifc.changes=1;
889: continue; }
890: done=0;
891: while(!done) {
892: j=0;
893: sprintf(opt[j++],"%-30.30s%c","Mnemonic (Command Key)"
894: ,cfg.prot[i]->mnemonic);
895: sprintf(opt[j++],"%-30.30s%-40s","Protocol Name"
896: ,cfg.prot[i]->name);
897: sprintf(opt[j++],"%-30.30s%-40s","Access Requirements"
898: ,cfg.prot[i]->arstr);
899: sprintf(opt[j++],"%-30.30s%-40s","Upload Command Line"
900: ,cfg.prot[i]->ulcmd);
901: sprintf(opt[j++],"%-30.30s%-40s","Download Command Line"
902: ,cfg.prot[i]->dlcmd);
903: sprintf(opt[j++],"%-30.30s%-40s","Batch Upload Command Line"
904: ,cfg.prot[i]->batulcmd);
905: sprintf(opt[j++],"%-30.30s%-40s","Batch Download Command Line"
906: ,cfg.prot[i]->batdlcmd);
907: sprintf(opt[j++],"%-30.30s%-40s","Bi-dir Command Line"
908: ,cfg.prot[i]->bicmd);
909: sprintf(opt[j++],"%-30.30s%s", "Native (32-bit) Executable"
910: ,cfg.prot[i]->misc&PROT_NATIVE ? "Yes" : "No");
911: sprintf(opt[j++],"%-30.30s%s", "Supports DSZLOG"
912: ,cfg.prot[i]->misc&PROT_DSZLOG ? "Yes":"No");
913: opt[j][0]=0;
914: uifc.savnum=1;
915: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,70,&prot_opt,0
916: ,"File Transfer Protocol",opt)) {
917: case -1:
918: done=1;
919: break;
920: case 0:
921: str[0]=cfg.prot[i]->mnemonic;
922: str[1]=0;
923: uifc.input(WIN_MID|WIN_SAV,0,0
924: ,"Mnemonic (Command Key)"
925: ,str,1,K_UPPER|K_EDIT);
926: if(str[0])
927: cfg.prot[i]->mnemonic=str[0];
928: break;
929: case 1:
930: uifc.input(WIN_MID|WIN_SAV,0,0
931: ,"Protocol Name"
932: ,cfg.prot[i]->name,sizeof(cfg.prot[i]->name)-1,K_EDIT);
933: break;
934: case 2:
935: uifc.savnum=2;
936: sprintf(str,"Protocol %s",cfg.prot[i]->name);
937: getar(str,cfg.prot[i]->arstr);
938: break;
939: case 3:
940: uifc.input(WIN_MID|WIN_SAV,0,0
941: ,"Command"
942: ,cfg.prot[i]->ulcmd,sizeof(cfg.prot[i]->ulcmd)-1,K_EDIT);
943: break;
944: case 4:
945: uifc.input(WIN_MID|WIN_SAV,0,0
946: ,"Command"
947: ,cfg.prot[i]->dlcmd,sizeof(cfg.prot[i]->dlcmd)-1,K_EDIT);
948: break;
949: case 5:
950: uifc.input(WIN_MID|WIN_SAV,0,0
951: ,"Command"
952: ,cfg.prot[i]->batulcmd,sizeof(cfg.prot[i]->batulcmd)-1,K_EDIT);
953: break;
954: case 6:
955: uifc.input(WIN_MID|WIN_SAV,0,0
956: ,"Command"
957: ,cfg.prot[i]->batdlcmd,sizeof(cfg.prot[i]->batdlcmd)-1,K_EDIT);
958: break;
959: case 7:
960: uifc.input(WIN_MID|WIN_SAV,0,0
961: ,"Command"
962: ,cfg.prot[i]->bicmd,sizeof(cfg.prot[i]->bicmd)-1,K_EDIT);
963: break;
964: case 8:
965: l=cfg.prot[i]->misc&PROT_NATIVE ? 0:1;
966: strcpy(opt[0],"Yes");
967: strcpy(opt[1],"No");
968: opt[2][0]=0;
969: uifc.savnum=2;
970: l=uifc.list(WIN_MID|WIN_SAV,0,0,0,&l,0
971: ,"Native (32-bit) Executable",opt);
972: if((l==0 && !(cfg.prot[i]->misc&PROT_NATIVE))
973: || (l==1 && cfg.prot[i]->misc&PROT_NATIVE)) {
974: cfg.prot[i]->misc^=PROT_NATIVE;
975: uifc.changes=1;
976: }
977: break;
978: case 9:
979: l=cfg.prot[i]->misc&PROT_DSZLOG ? 0:1;
980: strcpy(opt[0],"Yes");
981: strcpy(opt[1],"No");
982: opt[2][0]=0;
983: uifc.savnum=2;
984: l=uifc.list(WIN_MID|WIN_SAV,0,0,0,&l,0
985: ,"Uses DSZLOG",opt);
986: if((l==0 && !(cfg.prot[i]->misc&PROT_DSZLOG))
987: || (l==1 && cfg.prot[i]->misc&PROT_DSZLOG)) {
988: cfg.prot[i]->misc^=PROT_DSZLOG;
989: uifc.changes=1;
990: }
991: break;
992: }
993: }
994: }
995: break;
996: case 14: /* Alternate file paths */
997: while(1) {
998: for(i=0;i<cfg.altpaths;i++)
999: sprintf(opt[i],"%3d: %-40s",i+1,cfg.altpath[i]);
1000: opt[i][0]=0;
1001: i=WIN_ACT|WIN_SAV; /* save cause size can change */
1002: if((int)cfg.altpaths<MAX_OPTS)
1003: i|=WIN_INS|WIN_XTR;
1004: if(cfg.altpaths)
1005: i|=WIN_DEL|WIN_GET;
1006: if(savaltpath[0])
1007: i|=WIN_PUT;
1008: uifc.savnum=0;
1009: SETHELP(WHERE);
1010: /*
1011: &Alternate File Paths:&
1012:
1013: This option allows the sysop to add and configure alternate file paths
1014: for files stored on drives and directories other than the configured
1015: storage path for a file directory. This command is useful for those who
1016: have file directories where they wish to have files listed from
1017: multiple CD-ROMs or hard disks.
1018: */
1019: i=uifc.list(i,0,0,50,&altpath_dflt,NULL,"Alternate File Paths",opt);
1020: if(i==-1)
1021: break;
1022: if((i&MSK_ON)==MSK_DEL) {
1023: i&=MSK_OFF;
1024: FREE(cfg.altpath[i]);
1025: cfg.altpaths--;
1026: while(i<cfg.altpaths) {
1027: cfg.altpath[i]=cfg.altpath[i+1];
1028: i++; }
1029: uifc.changes=1;
1030: continue; }
1031: if((i&MSK_ON)==MSK_INS) {
1032: i&=MSK_OFF;
1033: if((cfg.altpath=(char **)REALLOC(cfg.altpath
1034: ,sizeof(char *)*(cfg.altpaths+1)))==NULL) {
1035: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.altpaths+1);
1036: cfg.altpaths=0;
1037: bail(1);
1038: continue; }
1039: if(!cfg.altpaths) {
1040: if((cfg.altpath[0]=(char *)MALLOC(LEN_DIR+1))==NULL) {
1041: errormsg(WHERE,ERR_ALLOC,nulstr,LEN_DIR+1);
1042: continue; }
1043: memset(cfg.altpath[0],0,LEN_DIR+1); }
1044: else {
1045: for(j=cfg.altpaths;j>i;j--)
1046: cfg.altpath[j]=cfg.altpath[j-1];
1047: if((cfg.altpath[i]=(char *)MALLOC(LEN_DIR+1))==NULL) {
1048: errormsg(WHERE,ERR_ALLOC,nulstr,LEN_DIR+1);
1049: continue; }
1050: if(i>=cfg.altpaths)
1051: j=i-1;
1052: else
1053: j=i+1;
1054: memcpy(cfg.altpath[i],cfg.altpath[j],LEN_DIR+1); }
1055: cfg.altpaths++;
1056: uifc.changes=1;
1057: continue; }
1058: if((i&MSK_ON)==MSK_GET) {
1059: i&=MSK_OFF;
1060: memcpy(savaltpath,cfg.altpath[i],LEN_DIR+1);
1061: continue; }
1062: if((i&MSK_ON)==MSK_PUT) {
1063: i&=MSK_OFF;
1064: memcpy(cfg.altpath[i],savaltpath,LEN_DIR+1);
1065: uifc.changes=1;
1066: continue; }
1067: sprintf(str,"Path %d",i+1);
1068: uifc.input(WIN_MID|WIN_SAV,0,0,str,cfg.altpath[i],sizeof(cfg.altpath[i])-1,K_EDIT);
1069: }
1070: break;
1071: }
1072: }
1073: }
1074:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.