|
|
1.1 root 1: /* scfgxfr1.c */
2:
3: /* $Id: scfgxfr1.c,v 1.18 2006/01/26 04:14:18 deuce 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.input(WIN_MID|WIN_SAV,0,0
225: ,"Leech Protocol Detection Percentage (0=Disabled)"
226: ,ultoa(cfg.leech_pct,tmp,10),3,K_EDIT|K_NUMBER);
227: cfg.leech_pct=atoi(tmp);
228: if(!cfg.leech_pct)
229: break;
230: SETHELP(WHERE);
231: /*
232: &Leech Protocol Minimum Time (in Seconds):&
233:
234: This option allows you to adjust the sensitivity of the leech protocol
235: detection feature. This value is the minimum length of transfer time
236: (in seconds) that must elapse before an aborted tranfser will be
237: considered a possible leech attempt.
238: */
239: uifc.input(WIN_MID,0,0
240: ,"Leech Protocol Minimum Time (in Seconds)"
241: ,ultoa(cfg.leech_sec,tmp,10),3,K_EDIT|K_NUMBER);
242: cfg.leech_sec=atoi(tmp);
243: break;
244: case 8: /* Viewable file types */
245: while(1) {
246: for(i=0;i<cfg.total_fviews && i<MAX_OPTS;i++)
247: sprintf(opt[i],"%-3.3s %-40s",cfg.fview[i]->ext,cfg.fview[i]->cmd);
248: opt[i][0]=0;
249: i=WIN_ACT|WIN_SAV; /* save cause size can change */
250: if(cfg.total_fviews<MAX_OPTS)
251: i|=WIN_INS|WIN_XTR;
252: if(cfg.total_fviews)
253: i|=WIN_DEL|WIN_GET;
254: if(savfview.cmd[0])
255: i|=WIN_PUT;
256: SETHELP(WHERE);
257: /*
258: &Viewable File Types:&
259:
260: This is a list of file types that have content information that can be
261: viewed through the execution of an external program. Here are a couple of
262: command line examples for a few file types.
263: */
264: i=uifc.list(i,0,0,50,&fview_dflt,NULL,"Viewable File Types",opt);
265: if(i==-1)
266: break;
267: if((i&MSK_ON)==MSK_DEL) {
268: i&=MSK_OFF;
269: free(cfg.fview[i]);
270: cfg.total_fviews--;
271: while(i<cfg.total_fviews) {
272: cfg.fview[i]=cfg.fview[i+1];
273: i++; }
274: uifc.changes=1;
275: continue; }
276: if((i&MSK_ON)==MSK_INS) {
277: i&=MSK_OFF;
278: if((cfg.fview=(fview_t **)realloc(cfg.fview
279: ,sizeof(fview_t *)*(cfg.total_fviews+1)))==NULL) {
280: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_fviews+1);
281: cfg.total_fviews=0;
282: bail(1);
283: continue; }
284: if(!cfg.total_fviews) {
285: if((cfg.fview[0]=(fview_t *)malloc(
286: sizeof(fview_t)))==NULL) {
287: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fview_t));
288: continue; }
289: memset(cfg.fview[0],0,sizeof(fview_t));
290: strcpy(cfg.fview[0]->ext,"ZIP");
291: strcpy(cfg.fview[0]->cmd,"%@unzip -vq %s"); }
292: else {
293: for(j=cfg.total_fviews;j>i;j--)
294: cfg.fview[j]=cfg.fview[j-1];
295: if((cfg.fview[i]=(fview_t *)malloc(
296: sizeof(fview_t)))==NULL) {
297: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fview_t));
298: continue; }
299: if(i>=cfg.total_fviews)
300: j=i-1;
301: else
302: j=i+1;
303: *cfg.fview[i]=*cfg.fview[j]; }
304: cfg.total_fviews++;
305: uifc.changes=1;
306: continue; }
307: if((i&MSK_ON)==MSK_GET) {
308: i&=MSK_OFF;
309: savfview=*cfg.fview[i];
310: continue; }
311: if((i&MSK_ON)==MSK_PUT) {
312: i&=MSK_OFF;
313: *cfg.fview[i]=savfview;
314: uifc.changes=1;
315: continue; }
316: done=0;
317: while(!done) {
318: j=0;
319: sprintf(opt[j++],"%-22.22s%s","File Extension"
320: ,cfg.fview[i]->ext);
321: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
322: ,cfg.fview[i]->cmd);
323: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
324: ,cfg.fview[i]->arstr);
325: opt[j][0]=0;
326: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&fview_opt,0
327: ,"Viewable File Type",opt)) {
328: case -1:
329: done=1;
330: break;
331: case 0:
332: uifc.input(WIN_MID|WIN_SAV,0,0
333: ,"Viewable File Type Extension"
334: ,cfg.fview[i]->ext,sizeof(cfg.fview[i]->ext)-1,K_EDIT);
335: break;
336: case 1:
337: uifc.input(WIN_MID|WIN_SAV,0,0
338: ,"Command"
339: ,cfg.fview[i]->cmd,sizeof(cfg.fview[i]->cmd)-1,K_EDIT);
340: break;
341: case 2:
342: sprintf(str,"Viewable File Type %s"
343: ,cfg.fview[i]->ext);
344: getar(str,cfg.fview[i]->arstr);
345: break; } } }
346: break;
347: case 9: /* Testable file types */
348: while(1) {
349: for(i=0;i<cfg.total_ftests && i<MAX_OPTS;i++)
350: sprintf(opt[i],"%-3.3s %-40s",cfg.ftest[i]->ext,cfg.ftest[i]->cmd);
351: opt[i][0]=0;
352: i=WIN_ACT|WIN_SAV; /* save cause size can change */
353: if(cfg.total_ftests<MAX_OPTS)
354: i|=WIN_INS|WIN_XTR;
355: if(cfg.total_ftests)
356: i|=WIN_DEL|WIN_GET;
357: if(savftest.cmd[0])
358: i|=WIN_PUT;
359: SETHELP(WHERE);
360: /*
361: &Testable File Types:&
362:
363: This is a list of file types that will have a command line executed to
364: test the file integrity upon their upload. The file types are specified
365: by &extension& and if one file extension is listed more than once, each
366: command line will be executed. The command lines must return a DOS error
367: code of 0 (no error) in order for the file to pass the test. This method
368: of file testing upon upload is also known as an upload event. This test
369: or event, can do more than just test the file, it can perform any
370: function that the sysop wishes. Such as adding comments to an archived
371: file, or extracting an archive and performing a virus scan. While the
372: external program is executing, a text string is displayed to the user.
373: This &working string& can be set for each file type and command line
374: listed.
375: */
376: i=uifc.list(i,0,0,50,&ftest_dflt,NULL,"Testable File Types",opt);
377: if(i==-1)
378: break;
379: if((i&MSK_ON)==MSK_DEL) {
380: i&=MSK_OFF;
381: free(cfg.ftest[i]);
382: cfg.total_ftests--;
383: while(i<cfg.total_ftests) {
384: cfg.ftest[i]=cfg.ftest[i+1];
385: i++; }
386: uifc.changes=1;
387: continue; }
388: if((i&MSK_ON)==MSK_INS) {
389: i&=MSK_OFF;
390: if((cfg.ftest=(ftest_t **)realloc(cfg.ftest
391: ,sizeof(ftest_t *)*(cfg.total_ftests+1)))==NULL) {
392: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_ftests+1);
393: cfg.total_ftests=0;
394: bail(1);
395: continue; }
396: if(!cfg.total_ftests) {
397: if((cfg.ftest[0]=(ftest_t *)malloc(
398: sizeof(ftest_t)))==NULL) {
399: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(ftest_t));
400: continue; }
401: memset(cfg.ftest[0],0,sizeof(ftest_t));
402: strcpy(cfg.ftest[0]->ext,"ZIP");
403: strcpy(cfg.ftest[0]->cmd,"%@unzip -tqq %f");
404: strcpy(cfg.ftest[0]->workstr,"Testing ZIP Integrity..."); }
405: else {
406:
407: for(j=cfg.total_ftests;j>i;j--)
408: cfg.ftest[j]=cfg.ftest[j-1];
409: if((cfg.ftest[i]=(ftest_t *)malloc(
410: sizeof(ftest_t)))==NULL) {
411: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(ftest_t));
412: continue; }
413: if(i>=cfg.total_ftests)
414: j=i-1;
415: else
416: j=i+1;
417: *cfg.ftest[i]=*cfg.ftest[j]; }
418: cfg.total_ftests++;
419: uifc.changes=1;
420: continue; }
421: if((i&MSK_ON)==MSK_GET) {
422: i&=MSK_OFF;
423: savftest=*cfg.ftest[i];
424: continue; }
425: if((i&MSK_ON)==MSK_PUT) {
426: i&=MSK_OFF;
427: *cfg.ftest[i]=savftest;
428: uifc.changes=1;
429: continue; }
430: done=0;
431: while(!done) {
432: j=0;
433: sprintf(opt[j++],"%-22.22s%s","File Extension"
434: ,cfg.ftest[i]->ext);
435: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
436: ,cfg.ftest[i]->cmd);
437: sprintf(opt[j++],"%-22.22s%s","Working String"
438: ,cfg.ftest[i]->workstr);
439: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
440: ,cfg.ftest[i]->arstr);
441: opt[j][0]=0;
442: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&ftest_opt,0
443: ,"Testable File Type",opt)) {
444: case -1:
445: done=1;
446: break;
447: case 0:
448: uifc.input(WIN_MID|WIN_SAV,0,0
449: ,"Testable File Type Extension"
450: ,cfg.ftest[i]->ext,sizeof(cfg.ftest[i]->ext)-1,K_EDIT);
451: break;
452: case 1:
453: uifc.input(WIN_MID|WIN_SAV,0,0
454: ,"Command"
455: ,cfg.ftest[i]->cmd,sizeof(cfg.ftest[i]->cmd)-1,K_EDIT);
456: break;
457: case 2:
458: uifc.input(WIN_MID|WIN_SAV,0,0
459: ,"Working String"
460: ,cfg.ftest[i]->workstr,sizeof(cfg.ftest[i]->workstr)-1,K_EDIT|K_MSG);
461: break;
462: case 3:
463: sprintf(str,"Testable File Type %s",cfg.ftest[i]->ext);
464: getar(str,cfg.ftest[i]->arstr);
465: break; } } }
466: break;
467: case 10: /* Download Events */
468: while(1) {
469: for(i=0;i<cfg.total_dlevents && i<MAX_OPTS;i++)
470: sprintf(opt[i],"%-3.3s %-40s",cfg.dlevent[i]->ext,cfg.dlevent[i]->cmd);
471: opt[i][0]=0;
472: i=WIN_ACT|WIN_SAV; /* save cause size can change */
473: if(cfg.total_dlevents<MAX_OPTS)
474: i|=WIN_INS|WIN_XTR;
475: if(cfg.total_dlevents)
476: i|=WIN_DEL|WIN_GET;
477: if(savdlevent.cmd[0])
478: i|=WIN_PUT;
479: SETHELP(WHERE);
480: /*
481: &Download Events:&
482:
483: This is a list of file types that will have a command line executed to
484: perform an event upon their download (e.g. trigger a download event).
485: The file types are specified by &extension& and if one file extension
486: is listed more than once, each command line will be executed. The
487: command lines must return a DOS error code of 0 (no error) in order
488: for the file to pass the test. This test or event, can do more than
489: just test the file, it can perform any function that the sysop wishes.
490: Such as adding comments to an archived file, or extracting an archive
491: and performing a virus scan. While the external program is executing,
492: a text string is displayed to the user. This &working string& can be set
493: for each file type and command line listed.
494: */
495: i=uifc.list(i,0,0,50,&dlevent_dflt,NULL,"Download Events",opt);
496: if(i==-1)
497: break;
498: if((i&MSK_ON)==MSK_DEL) {
499: i&=MSK_OFF;
500: free(cfg.dlevent[i]);
501: cfg.total_dlevents--;
502: while(i<cfg.total_dlevents) {
503: cfg.dlevent[i]=cfg.dlevent[i+1];
504: i++; }
505: uifc.changes=1;
506: continue; }
507: if((i&MSK_ON)==MSK_INS) {
508: i&=MSK_OFF;
509: if((cfg.dlevent=(dlevent_t **)realloc(cfg.dlevent
510: ,sizeof(dlevent_t *)*(cfg.total_dlevents+1)))==NULL) {
511: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_dlevents+1);
512: cfg.total_dlevents=0;
513: bail(1);
514: continue; }
515: if(!cfg.total_dlevents) {
516: if((cfg.dlevent[0]=(dlevent_t *)malloc(
517: sizeof(dlevent_t)))==NULL) {
518: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(dlevent_t));
519: continue; }
520: memset(cfg.dlevent[0],0,sizeof(dlevent_t));
521: strcpy(cfg.dlevent[0]->ext,"ZIP");
522: strcpy(cfg.dlevent[0]->cmd,"%@zip -z %f < %zzipmsg.txt");
523: strcpy(cfg.dlevent[0]->workstr,"Adding ZIP Comment..."); }
524: else {
525:
526: for(j=cfg.total_dlevents;j>i;j--)
527: cfg.dlevent[j]=cfg.dlevent[j-1];
528: if((cfg.dlevent[i]=(dlevent_t *)malloc(
529: sizeof(dlevent_t)))==NULL) {
530: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(dlevent_t));
531: continue; }
532: if(i>=cfg.total_dlevents)
533: j=i-1;
534: else
535: j=i+1;
536: *cfg.dlevent[i]=*cfg.dlevent[j]; }
537: cfg.total_dlevents++;
538: uifc.changes=1;
539: continue; }
540: if((i&MSK_ON)==MSK_GET) {
541: i&=MSK_OFF;
542: savdlevent=*cfg.dlevent[i];
543: continue; }
544: if((i&MSK_ON)==MSK_PUT) {
545: i&=MSK_OFF;
546: *cfg.dlevent[i]=savdlevent;
547: uifc.changes=1;
548: continue; }
549: done=0;
550: while(!done) {
551: j=0;
552: sprintf(opt[j++],"%-22.22s%s","File Extension"
553: ,cfg.dlevent[i]->ext);
554: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
555: ,cfg.dlevent[i]->cmd);
556: sprintf(opt[j++],"%-22.22s%s","Working String"
557: ,cfg.dlevent[i]->workstr);
558: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
559: ,cfg.dlevent[i]->arstr);
560: opt[j][0]=0;
561: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&dlevent_opt,0
562: ,"Download Event",opt)) {
563: case -1:
564: done=1;
565: break;
566: case 0:
567: uifc.input(WIN_MID|WIN_SAV,0,0
568: ,"Download Event Extension"
569: ,cfg.dlevent[i]->ext,sizeof(cfg.dlevent[i]->ext)-1,K_EDIT);
570: break;
571: case 1:
572: uifc.input(WIN_MID|WIN_SAV,0,0
573: ,"Command"
574: ,cfg.dlevent[i]->cmd,sizeof(cfg.dlevent[i]->cmd)-1,K_EDIT);
575: break;
576: case 2:
577: uifc.input(WIN_MID|WIN_SAV,0,0
578: ,"Working String"
579: ,cfg.dlevent[i]->workstr,sizeof(cfg.dlevent[i]->workstr)-1,K_EDIT|K_MSG);
580: break;
581: case 3:
582: sprintf(str,"Download Event %s",cfg.dlevent[i]->ext);
583: getar(str,cfg.dlevent[i]->arstr);
584: break; } } }
585: break;
586: case 11: /* Extractable file types */
587: while(1) {
588: for(i=0;i<cfg.total_fextrs && i<MAX_OPTS;i++)
589: sprintf(opt[i],"%-3.3s %-40s"
590: ,cfg.fextr[i]->ext,cfg.fextr[i]->cmd);
591: opt[i][0]=0;
592: i=WIN_ACT|WIN_SAV; /* save cause size can change */
593: if(cfg.total_fextrs<MAX_OPTS)
594: i|=WIN_INS|WIN_XTR;
595: if(cfg.total_fextrs)
596: i|=WIN_DEL|WIN_GET;
597: if(savfextr.cmd[0])
598: i|=WIN_PUT;
599: SETHELP(WHERE);
600: /*
601: &Extractable File Types:&
602:
603: This is a list of archive file types that can be extracted to the temp
604: directory by an external program. The file types are specified by their
605: extension. For each file type you must specify the command line used to
606: extract the file(s).
607: */
608: i=uifc.list(i,0,0,50,&fextr_dflt,NULL,"Extractable File Types",opt);
609: if(i==-1)
610: break;
611: if((i&MSK_ON)==MSK_DEL) {
612: i&=MSK_OFF;
613: free(cfg.fextr[i]);
614: cfg.total_fextrs--;
615: while(i<cfg.total_fextrs) {
616: cfg.fextr[i]=cfg.fextr[i+1];
617: i++; }
618: uifc.changes=1;
619: continue; }
620: if((i&MSK_ON)==MSK_INS) {
621: i&=MSK_OFF;
622: if((cfg.fextr=(fextr_t **)realloc(cfg.fextr
623: ,sizeof(fextr_t *)*(cfg.total_fextrs+1)))==NULL) {
624: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_fextrs+1);
625: cfg.total_fextrs=0;
626: bail(1);
627: continue; }
628: if(!cfg.total_fextrs) {
629: if((cfg.fextr[0]=(fextr_t *)malloc(
630: sizeof(fextr_t)))==NULL) {
631: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fextr_t));
632: continue; }
633: memset(cfg.fextr[0],0,sizeof(fextr_t));
634: strcpy(cfg.fextr[0]->ext,"ZIP");
635: strcpy(cfg.fextr[0]->cmd,"%@unzip -Cojqq %f %s -d %g"); }
636: else {
637:
638: for(j=cfg.total_fextrs;j>i;j--)
639: cfg.fextr[j]=cfg.fextr[j-1];
640: if((cfg.fextr[i]=(fextr_t *)malloc(
641: sizeof(fextr_t)))==NULL) {
642: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fextr_t));
643: continue; }
644: if(i>=cfg.total_fextrs)
645: j=i-1;
646: else
647: j=i+1;
648: *cfg.fextr[i]=*cfg.fextr[j]; }
649: cfg.total_fextrs++;
650: uifc.changes=1;
651: continue; }
652: if((i&MSK_ON)==MSK_GET) {
653: i&=MSK_OFF;
654: savfextr=*cfg.fextr[i];
655: continue; }
656: if((i&MSK_ON)==MSK_PUT) {
657: i&=MSK_OFF;
658: *cfg.fextr[i]=savfextr;
659: uifc.changes=1;
660: continue; }
661: done=0;
662: while(!done) {
663: j=0;
664: sprintf(opt[j++],"%-22.22s%s","File Extension"
665: ,cfg.fextr[i]->ext);
666: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
667: ,cfg.fextr[i]->cmd);
668: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
669: ,cfg.fextr[i]->arstr);
670: opt[j][0]=0;
671: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&fextr_opt,0
672: ,"Extractable File Type",opt)) {
673: case -1:
674: done=1;
675: break;
676: case 0:
677: uifc.input(WIN_MID|WIN_SAV,0,0
678: ,"Extractable File Type Extension"
679: ,cfg.fextr[i]->ext,sizeof(cfg.fextr[i]->ext)-1,K_EDIT);
680: break;
681: case 1:
682: uifc.input(WIN_MID|WIN_SAV,0,0
683: ,"Command"
684: ,cfg.fextr[i]->cmd,sizeof(cfg.fextr[i]->cmd)-1,K_EDIT);
685: break;
686: case 2:
687: sprintf(str,"Extractable File Type %s"
688: ,cfg.fextr[i]->ext);
689: getar(str,cfg.fextr[i]->arstr);
690: break; } } }
691: break;
692: case 12: /* Compressable file types */
693: while(1) {
694: for(i=0;i<cfg.total_fcomps && i<MAX_OPTS;i++)
695: sprintf(opt[i],"%-3.3s %-40s",cfg.fcomp[i]->ext,cfg.fcomp[i]->cmd);
696: opt[i][0]=0;
697: i=WIN_ACT|WIN_SAV; /* save cause size can change */
698: if(cfg.total_fcomps<MAX_OPTS)
699: i|=WIN_INS|WIN_XTR;
700: if(cfg.total_fcomps)
701: i|=WIN_DEL|WIN_GET;
702: if(savfcomp.cmd[0])
703: i|=WIN_PUT;
704: SETHELP(WHERE);
705: /*
706: &Compressable File Types:&
707:
708: This is a list of compression methods available for different file types.
709: These will be used for items such as creating QWK packets, temporary
710: files from the transfer section, and more.
711: */
712: i=uifc.list(i,0,0,50,&fcomp_dflt,NULL,"Compressable File Types",opt);
713: if(i==-1)
714: break;
715: if((i&MSK_ON)==MSK_DEL) {
716: i&=MSK_OFF;
717: free(cfg.fcomp[i]);
718: cfg.total_fcomps--;
719: while(i<cfg.total_fcomps) {
720: cfg.fcomp[i]=cfg.fcomp[i+1];
721: i++; }
722: uifc.changes=1;
723: continue; }
724: if((i&MSK_ON)==MSK_INS) {
725: i&=MSK_OFF;
726: if((cfg.fcomp=(fcomp_t **)realloc(cfg.fcomp
727: ,sizeof(fcomp_t *)*(cfg.total_fcomps+1)))==NULL) {
728: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_fcomps+1);
729: cfg.total_fcomps=0;
730: bail(1);
731: continue; }
732: if(!cfg.total_fcomps) {
733: if((cfg.fcomp[0]=(fcomp_t *)malloc(
734: sizeof(fcomp_t)))==NULL) {
735: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fcomp_t));
736: continue; }
737: memset(cfg.fcomp[0],0,sizeof(fcomp_t));
738: strcpy(cfg.fcomp[0]->ext,"ZIP");
739: strcpy(cfg.fcomp[0]->cmd,"%@zip -jD %f %s"); }
740: else {
741: for(j=cfg.total_fcomps;j>i;j--)
742: cfg.fcomp[j]=cfg.fcomp[j-1];
743: if((cfg.fcomp[i]=(fcomp_t *)malloc(
744: sizeof(fcomp_t)))==NULL) {
745: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(fcomp_t));
746: continue; }
747: if(i>=cfg.total_fcomps)
748: j=i-1;
749: else
750: j=i+1;
751: *cfg.fcomp[i]=*cfg.fcomp[j]; }
752: cfg.total_fcomps++;
753: uifc.changes=1;
754: continue; }
755: if((i&MSK_ON)==MSK_GET) {
756: i&=MSK_OFF;
757: savfcomp=*cfg.fcomp[i];
758: continue; }
759: if((i&MSK_ON)==MSK_PUT) {
760: i&=MSK_OFF;
761: *cfg.fcomp[i]=savfcomp;
762: uifc.changes=1;
763: continue; }
764: done=0;
765: while(!done) {
766: j=0;
767: sprintf(opt[j++],"%-22.22s%s","File Extension"
768: ,cfg.fcomp[i]->ext);
769: sprintf(opt[j++],"%-22.22s%-40s","Command Line"
770: ,cfg.fcomp[i]->cmd);
771: sprintf(opt[j++],"%-22.22s%s","Access Requirements"
772: ,cfg.fcomp[i]->arstr);
773: opt[j][0]=0;
774: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,0,&fcomp_opt,0
775: ,"Compressable File Type",opt)) {
776: case -1:
777: done=1;
778: break;
779: case 0:
780: uifc.input(WIN_MID|WIN_SAV,0,0
781: ,"Compressable File Type Extension"
782: ,cfg.fcomp[i]->ext,sizeof(cfg.fcomp[i]->ext)-1,K_EDIT);
783: break;
784: case 1:
785: uifc.input(WIN_MID|WIN_SAV,0,0
786: ,"Command"
787: ,cfg.fcomp[i]->cmd,sizeof(cfg.fcomp[i]->cmd)-1,K_EDIT);
788: break;
789: case 2:
790: sprintf(str,"Compressable File Type %s"
791: ,cfg.fcomp[i]->ext);
792: getar(str,cfg.fcomp[i]->arstr);
793: break; } } }
794: break;
795: case 13: /* Transfer protocols */
796: while(1) {
797: for(i=0;i<cfg.total_prots && i<MAX_OPTS;i++)
798: sprintf(opt[i],"%c %s"
799: ,cfg.prot[i]->mnemonic,cfg.prot[i]->name);
800: opt[i][0]=0;
801: i=WIN_ACT|WIN_SAV; /* save cause size can change */
802: if(cfg.total_prots<MAX_OPTS)
803: i|=WIN_INS|WIN_XTR;
804: if(cfg.total_prots)
805: i|=WIN_DEL|WIN_GET;
806: if(savprot.mnemonic)
807: i|=WIN_PUT;
808: SETHELP(WHERE);
809: /*
810: &File Transfer Protocols:&
811:
812: This is a list of file transfer protocols that can be used to transfer
813: files either to or from a remote user. For each protocol, you can
814: specify the mnemonic (hot-key) to use to specify that protocol, the
815: command line to use for uploads, downloads, batch uploads, batch
816: downloads, bi-directional file transfers, support of DSZLOG, and (for
817: *nix only) if it uses socket I/O or the more common stdio.
818:
819: If the protocol doesn't support a certain method of transfer, or you
820: don't wish it to be available for a certain method of transfer, leave
821: the command line for that method blank.
822: */
823: i=uifc.list(i,0,0,50,&prot_dflt,NULL,"File Transfer Protocols",opt);
824: if(i==-1)
825: break;
826: if((i&MSK_ON)==MSK_DEL) {
827: i&=MSK_OFF;
828: free(cfg.prot[i]);
829: cfg.total_prots--;
830: while(i<cfg.total_prots) {
831: cfg.prot[i]=cfg.prot[i+1];
832: i++; }
833: uifc.changes=1;
834: continue; }
835: if((i&MSK_ON)==MSK_INS) {
836: i&=MSK_OFF;
837: if((cfg.prot=(prot_t **)realloc(cfg.prot
838: ,sizeof(prot_t *)*(cfg.total_prots+1)))==NULL) {
839: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_prots+1);
840: cfg.total_prots=0;
841: bail(1);
842: continue; }
843: if(!cfg.total_prots) {
844: if((cfg.prot[0]=(prot_t *)malloc(
845: sizeof(prot_t)))==NULL) {
846: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(prot_t));
847: continue; }
848: memset(cfg.prot[0],0,sizeof(prot_t));
849: cfg.prot[0]->mnemonic='?';
850: } else {
851: for(j=cfg.total_prots;j>i;j--)
852: cfg.prot[j]=cfg.prot[j-1];
853: if((cfg.prot[i]=(prot_t *)malloc(
854: sizeof(prot_t)))==NULL) {
855: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(prot_t));
856: continue; }
857: if(i>=cfg.total_prots)
858: j=i-1;
859: else
860: j=i+1;
861: *cfg.prot[i]=*cfg.prot[j]; }
862: cfg.total_prots++;
863: uifc.changes=1;
864: continue; }
865: if((i&MSK_ON)==MSK_GET) {
866: i&=MSK_OFF;
867: savprot=*cfg.prot[i];
868: continue; }
869: if((i&MSK_ON)==MSK_PUT) {
870: i&=MSK_OFF;
871: *cfg.prot[i]=savprot;
872: uifc.changes=1;
873: continue; }
874: done=0;
875: while(!done) {
876: j=0;
877: sprintf(opt[j++],"%-30.30s%c","Mnemonic (Command Key)"
878: ,cfg.prot[i]->mnemonic);
879: sprintf(opt[j++],"%-30.30s%-40s","Protocol Name"
880: ,cfg.prot[i]->name);
881: sprintf(opt[j++],"%-30.30s%-40s","Access Requirements"
882: ,cfg.prot[i]->arstr);
883: sprintf(opt[j++],"%-30.30s%-40s","Upload Command Line"
884: ,cfg.prot[i]->ulcmd);
885: sprintf(opt[j++],"%-30.30s%-40s","Download Command Line"
886: ,cfg.prot[i]->dlcmd);
887: sprintf(opt[j++],"%-30.30s%-40s","Batch Upload Command Line"
888: ,cfg.prot[i]->batulcmd);
889: sprintf(opt[j++],"%-30.30s%-40s","Batch Download Command Line"
890: ,cfg.prot[i]->batdlcmd);
891: sprintf(opt[j++],"%-30.30s%-40s","Bi-dir Command Line"
892: ,cfg.prot[i]->bicmd);
893: sprintf(opt[j++],"%-30.30s%s", "Native (32-bit) Executable"
894: ,cfg.prot[i]->misc&PROT_NATIVE ? "Yes" : "No");
895: sprintf(opt[j++],"%-30.30s%s", "Supports DSZLOG"
896: ,cfg.prot[i]->misc&PROT_DSZLOG ? "Yes":"No");
897: sprintf(opt[j++],"%-30.30s%s", "Socket I/O"
898: ,cfg.prot[i]->misc&PROT_SOCKET ? "Yes":"No");
899: opt[j][0]=0;
900: switch(uifc.list(WIN_RHT|WIN_BOT|WIN_SAV|WIN_ACT,0,0,70,&prot_opt,0
901: ,"File Transfer Protocol",opt)) {
902: case -1:
903: done=1;
904: break;
905: case 0:
906: str[0]=cfg.prot[i]->mnemonic;
907: str[1]=0;
908: uifc.input(WIN_MID|WIN_SAV,0,0
909: ,"Mnemonic (Command Key)"
910: ,str,1,K_UPPER|K_EDIT);
911: if(str[0])
912: cfg.prot[i]->mnemonic=str[0];
913: break;
914: case 1:
915: uifc.input(WIN_MID|WIN_SAV,0,0
916: ,"Protocol Name"
917: ,cfg.prot[i]->name,sizeof(cfg.prot[i]->name)-1,K_EDIT);
918: break;
919: case 2:
920: sprintf(str,"Protocol %s",cfg.prot[i]->name);
921: getar(str,cfg.prot[i]->arstr);
922: break;
923: case 3:
924: uifc.input(WIN_MID|WIN_SAV,0,0
925: ,"Command"
926: ,cfg.prot[i]->ulcmd,sizeof(cfg.prot[i]->ulcmd)-1,K_EDIT);
927: break;
928: case 4:
929: uifc.input(WIN_MID|WIN_SAV,0,0
930: ,"Command"
931: ,cfg.prot[i]->dlcmd,sizeof(cfg.prot[i]->dlcmd)-1,K_EDIT);
932: break;
933: case 5:
934: uifc.input(WIN_MID|WIN_SAV,0,0
935: ,"Command"
936: ,cfg.prot[i]->batulcmd,sizeof(cfg.prot[i]->batulcmd)-1,K_EDIT);
937: break;
938: case 6:
939: uifc.input(WIN_MID|WIN_SAV,0,0
940: ,"Command"
941: ,cfg.prot[i]->batdlcmd,sizeof(cfg.prot[i]->batdlcmd)-1,K_EDIT);
942: break;
943: case 7:
944: uifc.input(WIN_MID|WIN_SAV,0,0
945: ,"Command"
946: ,cfg.prot[i]->bicmd,sizeof(cfg.prot[i]->bicmd)-1,K_EDIT);
947: break;
948: case 8:
949: l=cfg.prot[i]->misc&PROT_NATIVE ? 0:1;
950: strcpy(opt[0],"Yes");
951: strcpy(opt[1],"No");
952: opt[2][0]=0;
953: l=uifc.list(WIN_MID|WIN_SAV,0,0,0,&l,0
954: ,"Native (32-bit) Executable",opt);
955: if((l==0 && !(cfg.prot[i]->misc&PROT_NATIVE))
956: || (l==1 && cfg.prot[i]->misc&PROT_NATIVE)) {
957: cfg.prot[i]->misc^=PROT_NATIVE;
958: uifc.changes=1;
959: }
960: break;
961: case 9:
962: l=cfg.prot[i]->misc&PROT_DSZLOG ? 0:1;
963: strcpy(opt[0],"Yes");
964: strcpy(opt[1],"No");
965: opt[2][0]=0;
966: l=uifc.list(WIN_MID|WIN_SAV,0,0,0,&l,0
967: ,"Uses DSZLOG",opt);
968: if((l==0 && !(cfg.prot[i]->misc&PROT_DSZLOG))
969: || (l==1 && cfg.prot[i]->misc&PROT_DSZLOG)) {
970: cfg.prot[i]->misc^=PROT_DSZLOG;
971: uifc.changes=1;
972: }
973: break;
974: case 10:
975: l=cfg.prot[i]->misc&PROT_SOCKET ? 0:1l;
976: strcpy(opt[0],"Yes");
977: strcpy(opt[1],"No");
978: opt[2][0]=0;
979: l=uifc.list(WIN_MID|WIN_SAV,0,0,0,&l,0
980: ,"Uses Socket I/O",opt);
981: if((l==0 && !(cfg.prot[i]->misc&PROT_SOCKET))
982: || (l==1 && cfg.prot[i]->misc&PROT_SOCKET)) {
983: cfg.prot[i]->misc^=PROT_SOCKET;
984: uifc.changes=1;
985: }
986: break;
987: }
988: }
989: }
990: break;
991: case 14: /* Alternate file paths */
992: while(1) {
993: for(i=0;i<cfg.altpaths;i++)
994: sprintf(opt[i],"%3d: %-40s",i+1,cfg.altpath[i]);
995: opt[i][0]=0;
996: i=WIN_ACT|WIN_SAV; /* save cause size can change */
997: if((int)cfg.altpaths<MAX_OPTS)
998: i|=WIN_INS|WIN_XTR;
999: if(cfg.altpaths)
1000: i|=WIN_DEL|WIN_GET;
1001: if(savaltpath[0])
1002: i|=WIN_PUT;
1003: SETHELP(WHERE);
1004: /*
1005: &Alternate File Paths:&
1006:
1007: This option allows the sysop to add and configure alternate file paths
1008: for files stored on drives and directories other than the configured
1009: storage path for a file directory. This command is useful for those who
1010: have file directories where they wish to have files listed from
1011: multiple CD-ROMs or hard disks.
1012: */
1013: i=uifc.list(i,0,0,50,&altpath_dflt,NULL,"Alternate File Paths",opt);
1014: if(i==-1)
1015: break;
1016: if((i&MSK_ON)==MSK_DEL) {
1017: i&=MSK_OFF;
1018: free(cfg.altpath[i]);
1019: cfg.altpaths--;
1020: while(i<cfg.altpaths) {
1021: cfg.altpath[i]=cfg.altpath[i+1];
1022: i++; }
1023: uifc.changes=1;
1024: continue; }
1025: if((i&MSK_ON)==MSK_INS) {
1026: i&=MSK_OFF;
1027: if((cfg.altpath=(char **)realloc(cfg.altpath
1028: ,sizeof(char *)*(cfg.altpaths+1)))==NULL) {
1029: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.altpaths+1);
1030: cfg.altpaths=0;
1031: bail(1);
1032: continue; }
1033: if(!cfg.altpaths) {
1034: if((cfg.altpath[0]=(char *)malloc(LEN_DIR+1))==NULL) {
1035: errormsg(WHERE,ERR_ALLOC,nulstr,LEN_DIR+1);
1036: continue; }
1037: memset(cfg.altpath[0],0,LEN_DIR+1); }
1038: else {
1039: for(j=cfg.altpaths;j>i;j--)
1040: cfg.altpath[j]=cfg.altpath[j-1];
1041: if((cfg.altpath[i]=(char *)malloc(LEN_DIR+1))==NULL) {
1042: errormsg(WHERE,ERR_ALLOC,nulstr,LEN_DIR+1);
1043: continue; }
1044: if(i>=cfg.altpaths)
1045: j=i-1;
1046: else
1047: j=i+1;
1048: memcpy(cfg.altpath[i],cfg.altpath[j],LEN_DIR+1); }
1049: cfg.altpaths++;
1050: uifc.changes=1;
1051: continue; }
1052: if((i&MSK_ON)==MSK_GET) {
1053: i&=MSK_OFF;
1054: memcpy(savaltpath,cfg.altpath[i],LEN_DIR+1);
1055: continue; }
1056: if((i&MSK_ON)==MSK_PUT) {
1057: i&=MSK_OFF;
1058: memcpy(cfg.altpath[i],savaltpath,LEN_DIR+1);
1059: uifc.changes=1;
1060: continue; }
1061: sprintf(str,"Path %d",i+1);
1062: uifc.input(WIN_MID|WIN_SAV,0,0,str,cfg.altpath[i],LEN_DIR,K_EDIT);
1063: }
1064: break;
1065: }
1066: }
1067: }
1068:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.