|
|
1.1 root 1: /* scfgxfr2.c */
2:
3: /* $Id: scfgxfr2.c,v 1.23 2004/05/30 06:56:06 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 2002 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: #define DEFAULT_DIR_OPTIONS (DIR_FCHK|DIR_MULT|DIR_DUPES|DIR_CDTUL|DIR_CDTDL|DIR_DIZ)
39:
40: void xfer_cfg()
41: {
42: static int libs_dflt,libs_bar,dflt;
43: char str[256],str2[81],done=0,*p;
44: char tmp_code[16];
45: int file,j,k,q;
46: uint i;
47: long ported;
48: static lib_t savlib;
49: dir_t tmpdir;
50: FILE *stream;
51:
52: while(1) {
53: for(i=0;i<cfg.total_libs && i<MAX_OPTS;i++)
54: sprintf(opt[i],"%-25s",cfg.lib[i]->lname);
55: opt[i][0]=0;
56: j=WIN_ACT|WIN_CHE|WIN_ORG;
57: if(cfg.total_libs)
58: j|=WIN_DEL|WIN_GET|WIN_DELACT;
59: if(cfg.total_libs<MAX_OPTS)
60: j|=WIN_INS|WIN_INSACT|WIN_XTR;
61: if(savlib.sname[0])
62: j|=WIN_PUT;
63: SETHELP(WHERE);
64: /*
65: &File Libraries:&
66:
67: This is a listing of file libraries for your BBS. File Libraries are
68: used to logically separate your file &directories& into groups. Every
69: directory belongs to a file library.
70:
71: One popular use for file libraries is to separate CD-ROM and hard disk
72: directories. One might have an &Uploads& file library that contains
73: uploads to the hard disk directories and also have a &PC-SIG& file
74: library that contains directories from a PC-SIG CD-ROM. Some sysops
75: separate directories into more specific areas such as &Main&, &Graphics&,
76: or &Adult&. If you have many directories that have a common subject
77: denominator, you may want to have a separate file library for those
78: directories for a more organized file structure.
79: */
80: i=uifc.list(j,0,0,45,&libs_dflt,&libs_bar,"File Libraries",opt);
81: if((signed)i==-1) {
82: j=save_changes(WIN_MID);
83: if(j==-1)
84: continue;
85: if(!j) {
86: write_file_cfg(&cfg,backup_level);
87: refresh_cfg(&cfg);
88: }
89: return; }
90: if((i&MSK_ON)==MSK_INS) {
91: i&=MSK_OFF;
92: strcpy(str,"Main");
93: SETHELP(WHERE);
94: /*
95: &Library Long Name:&
96:
97: This is a description of the file library which is displayed when a
98: user of the system uses the &/*& command from the file transfer menu.
99: */
100: if(uifc.input(WIN_MID|WIN_SAV,0,0,"Library Long Name",str,LEN_GLNAME
101: ,K_EDIT)<1)
102: continue;
103: sprintf(str2,"%.*s",LEN_GSNAME,str);
104: SETHELP(WHERE);
105: /*
106: &Library Short Name:&
107:
108: This is a short description of the file library which is used for the
109: file transfer menu prompt.
110: */
111: if(uifc.input(WIN_MID|WIN_SAV,0,0,"Library Short Name",str2,LEN_GSNAME
112: ,K_EDIT)<1)
113: continue;
114: if((cfg.lib=(lib_t **)REALLOC(cfg.lib,sizeof(lib_t *)*(cfg.total_libs+1)))==NULL) {
115: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_libs+1);
116: cfg.total_libs=0;
117: bail(1);
118: continue; }
119:
120: if(cfg.total_libs) {
121: for(j=cfg.total_libs;j>i;j--)
122: cfg.lib[j]=cfg.lib[j-1];
123: for(j=0;j<cfg.total_dirs;j++)
124: if(cfg.dir[j]->lib>=i)
125: cfg.dir[j]->lib++; }
126: if((cfg.lib[i]=(lib_t *)MALLOC(sizeof(lib_t)))==NULL) {
127: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(lib_t));
128: continue; }
129: memset((lib_t *)cfg.lib[i],0,sizeof(lib_t));
130: strcpy(cfg.lib[i]->lname,str);
131: strcpy(cfg.lib[i]->sname,str2);
132: cfg.total_libs++;
133: uifc.changes=1;
134: continue; }
135: if((i&MSK_ON)==MSK_DEL) {
136: i&=MSK_OFF;
137: SETHELP(WHERE);
138: /*
139: &Delete All Data in Library:&
140:
141: If you wish to delete the database files for all directories in this
142: library, select &Yes&.
143: */
144: j=1;
145: strcpy(opt[0],"Yes");
146: strcpy(opt[1],"No");
147: opt[2][0]=0;
148: j=uifc.list(WIN_MID|WIN_SAV,0,0,0,&j,0
149: ,"Delete All Library Data Files",opt);
150: if(j==-1)
151: continue;
152: if(j==0)
153: for(j=0;j<cfg.total_dirs;j++)
154: if(cfg.dir[j]->lib==i) {
155: sprintf(str,"%s%s.*"
156: ,cfg.lib[cfg.dir[j]->lib]->code_prefix
157: ,cfg.dir[j]->code_suffix);
158: strlwr(str);
159: if(!cfg.dir[j]->data_dir[0])
160: sprintf(tmp,"%sdirs/",cfg.data_dir);
161: else
162: strcpy(tmp,cfg.dir[j]->data_dir);
163: delfiles(tmp,str); }
164: FREE(cfg.lib[i]);
165: for(j=0;j<cfg.total_dirs;) {
166: if(cfg.dir[j]->lib==i) {
167: FREE(cfg.dir[j]);
168: cfg.total_dirs--;
169: k=j;
170: while(k<cfg.total_dirs) {
171: cfg.dir[k]=cfg.dir[k+1];
172: k++; } }
173: else j++; }
174: for(j=0;j<cfg.total_dirs;j++)
175: if(cfg.dir[j]->lib>i)
176: cfg.dir[j]->lib--;
177: cfg.total_libs--;
178: while(i<cfg.total_libs) {
179: cfg.lib[i]=cfg.lib[i+1];
180: i++; }
181: uifc.changes=1;
182: continue; }
183: if((i&MSK_ON)==MSK_GET) {
184: i&=MSK_OFF;
185: savlib=*cfg.lib[i];
186: continue; }
187: if((i&MSK_ON)==MSK_PUT) {
188: i&=MSK_OFF;
189: *cfg.lib[i]=savlib;
190: uifc.changes=1;
191: continue; }
192: done=0;
193: while(!done) {
194: j=0;
195: sprintf(opt[j++],"%-27.27s%s","Long Name",cfg.lib[i]->lname);
196: sprintf(opt[j++],"%-27.27s%s","Short Name",cfg.lib[i]->sname);
197: sprintf(opt[j++],"%-27.27s%s","Internal Code Prefix",cfg.lib[i]->code_prefix);
198: sprintf(opt[j++],"%-27.27s%.40s","Parent Directory"
199: ,cfg.lib[i]->parent_path);
200: sprintf(opt[j++],"%-27.27s%.40s","Access Requirements"
201: ,cfg.lib[i]->arstr);
202: strcpy(opt[j++],"Clone Options");
203: strcpy(opt[j++],"Export Areas...");
204: strcpy(opt[j++],"Import Areas...");
205: strcpy(opt[j++],"File Directories...");
206: opt[j][0]=0;
207: uifc.savnum=0;
208: sprintf(str,"%s Library",cfg.lib[i]->sname);
209: SETHELP(WHERE);
210: /*
211: &File Library Configuration:&
212:
213: This menu allows you to configure the security requirments for access
214: to this file library. You can also add, delete, and configure the
215: directories of this library by selecting the &File Directories...& option.
216: */
217: switch(uifc.list(WIN_ACT,6,4,60,&dflt,0,str,opt)) {
218: case -1:
219: done=1;
220: break;
221: case 0:
222: SETHELP(WHERE);
223: /*
224: &Library Long Name:&
225:
226: This is a description of the file library which is displayed when a
227: user of the system uses the &/*& command from the file transfer menu.
228: */
229: strcpy(str,cfg.lib[i]->lname); /* save */
230: if(!uifc.input(WIN_MID|WIN_SAV,0,0,"Name to use for Listings"
231: ,cfg.lib[i]->lname,LEN_GLNAME,K_EDIT))
232: strcpy(cfg.lib[i]->lname,str); /* restore */
233: break;
234: case 1:
235: SETHELP(WHERE);
236: /*
237: &Library Short Name:&
238:
239: This is a short description of the file librarly which is used for the
240: file transfer menu prompt.
241: */
242: uifc.input(WIN_MID|WIN_SAV,0,0,"Name to use for Prompts"
243: ,cfg.lib[i]->sname,LEN_GSNAME,K_EDIT);
244: break;
245: case 2:
246: SETHELP(WHERE);
247: /*
248: `Internal Code Prefix:`
249:
250: This is an `optional` code prefix that may be used to help generate unique
251: internal codes for the directories in this file library. If this option
252: is used, directory internal codes will be made up of this prefix and the
253: specified code suffix for each directory.
254: */
255: uifc.input(WIN_MID|WIN_SAV,0,17,"Internal Code Prefix"
256: ,cfg.lib[i]->code_prefix,LEN_CODE,K_EDIT|K_UPPER);
257: break;
258: case 3:
259: SETHELP(WHERE);
260: /*
261: &Parent Directory:&
262:
263: This an optional path to be used as the physical "parent" directory for
264: all logical directories in this library. This parent directory will be
265: used in combination with each directory's storage path to create the
266: full physical storage path for files in this directory.
267:
268: This option is convenient for adding libraries with many directories
269: that share a common parent directory (e.g. CD-ROMs) and gives you the
270: option of easily changing the common parent directory location later, if
271: desired.
272: */
273: uifc.input(WIN_MID|WIN_SAV,0,0,"Parent Directory"
274: ,cfg.lib[i]->parent_path,sizeof(cfg.lib[i]->parent_path)-1,K_EDIT);
275: break;
276: case 4:
277: sprintf(str,"%s Library",cfg.lib[i]->sname);
278: getar(str,cfg.lib[i]->arstr);
279: break;
280: case 5: /* clone options */
281: j=0;
282: strcpy(opt[0],"Yes");
283: strcpy(opt[1],"No");
284: opt[2][0]=0;
285: SETHELP(WHERE);
286: /*
287: &Clone Directory Options:&
288:
289: If you want to clone the options of the first directory of this library
290: into all directories of this library, select &Yes&.
291:
292: The options cloned are upload requirments, download requirments,
293: operator requirements, exempted user requirements, toggle options,
294: maximum number of files, allowed file extensions, default file
295: extension, and sort type.
296: */
297: j=uifc.list(WIN_MID|WIN_SAV,0,0,0,&j,0
298: ,"Clone Options of First Directory into All of Library"
299: ,opt);
300: if(j==0) {
301: k=-1;
302: for(j=0;j<cfg.total_dirs;j++)
303: if(cfg.dir[j]->lib==i) {
304: if(k==-1)
305: k=j;
306: else {
307: uifc.changes=1;
308: cfg.dir[j]->misc=cfg.dir[k]->misc;
309: strcpy(cfg.dir[j]->ul_arstr,cfg.dir[k]->ul_arstr);
310: strcpy(cfg.dir[j]->dl_arstr,cfg.dir[k]->dl_arstr);
311: strcpy(cfg.dir[j]->op_arstr,cfg.dir[k]->op_arstr);
312: strcpy(cfg.dir[j]->ex_arstr,cfg.dir[k]->ex_arstr);
313: strcpy(cfg.dir[j]->exts,cfg.dir[k]->exts);
314: strcpy(cfg.dir[j]->data_dir,cfg.dir[k]->data_dir);
315: strcpy(cfg.dir[j]->upload_sem,cfg.dir[k]->upload_sem);
316: cfg.dir[j]->maxfiles=cfg.dir[k]->maxfiles;
317: cfg.dir[j]->maxage=cfg.dir[k]->maxage;
318: cfg.dir[j]->up_pct=cfg.dir[k]->up_pct;
319: cfg.dir[j]->dn_pct=cfg.dir[k]->dn_pct;
320: cfg.dir[j]->seqdev=cfg.dir[k]->seqdev;
321: cfg.dir[j]->sort=cfg.dir[k]->sort; } } }
322: break;
323: case 6:
324: k=0;
325: ported=0;
326: q=uifc.changes;
327: strcpy(opt[k++],"DIRS.TXT (Synchronet)");
328: strcpy(opt[k++],"FILEBONE.NA (Fido)");
329: opt[k][0]=0;
330: SETHELP(WHERE);
331: /*
332: &Export Area File Format:&
333:
334: This menu allows you to choose the format of the area file you wish to
335: export to.
336: */
337: k=0;
338: k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
339: ,"Export Area File Format",opt);
340: if(k==-1)
341: break;
342: if(k==0)
343: sprintf(str,"%sDIRS.TXT",cfg.ctrl_dir);
344: else if(k==1)
345: sprintf(str,"FILEBONE.NA");
346: if(uifc.input(WIN_MID|WIN_SAV,0,0,"Filename"
347: ,str,sizeof(str)-1,K_EDIT)<=0) {
348: uifc.changes=q;
349: break; }
350: if(fexist(str)) {
351: strcpy(opt[0],"Overwrite");
352: strcpy(opt[1],"Append");
353: opt[2][0]=0;
354: j=0;
355: j=uifc.list(WIN_MID|WIN_SAV,0,0,0,&j,0
356: ,"File Exists",opt);
357: if(j==-1)
358: break;
359: if(j==0) j=O_WRONLY|O_TRUNC;
360: else j=O_WRONLY|O_APPEND; }
361: else
362: j=O_WRONLY|O_CREAT;
363: if((stream=fnopen(&file,str,j))==NULL) {
364: uifc.msg("Open Failure");
365: break; }
366: uifc.pop("Exporting Areas...");
367: for(j=0;j<cfg.total_dirs;j++) {
368: if(cfg.dir[j]->lib!=i)
369: continue;
370: ported++;
371: if(k==1) {
372: fprintf(stream,"Area %-8s 0 ! %s\r\n"
373: ,cfg.dir[j]->code_suffix,cfg.dir[j]->lname);
374: continue; }
375: fprintf(stream,"%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n"
376: "%s\r\n%s\r\n"
377: ,cfg.dir[j]->lname
378: ,cfg.dir[j]->sname
379: ,cfg.dir[j]->code_suffix
380: ,cfg.dir[j]->data_dir
381: ,cfg.dir[j]->arstr
382: ,cfg.dir[j]->ul_arstr
383: ,cfg.dir[j]->dl_arstr
384: ,cfg.dir[j]->op_arstr
385: );
386: fprintf(stream,"%s\r\n%s\r\n%u\r\n%s\r\n%lX\r\n%u\r\n"
387: "%u\r\n"
388: ,cfg.dir[j]->path
389: ,cfg.dir[j]->upload_sem
390: ,cfg.dir[j]->maxfiles
391: ,cfg.dir[j]->exts
392: ,cfg.dir[j]->misc
393: ,cfg.dir[j]->seqdev
394: ,cfg.dir[j]->sort
395: );
396: fprintf(stream,"%s\r\n%u\r\n%u\r\n%u\r\n"
397: ,cfg.dir[j]->ex_arstr
398: ,cfg.dir[j]->maxage
399: ,cfg.dir[j]->up_pct
400: ,cfg.dir[j]->dn_pct
401: );
402: fprintf(stream,"***END-OF-DIR***\r\n\r\n"); }
403: fclose(stream);
404: uifc.pop(0);
405: sprintf(str,"%lu File Areas Exported Successfully",ported);
406: uifc.msg(str);
407: uifc.changes=q;
408: break;
409:
410: case 7:
411: ported=0;
412: k=0;
413: SETHELP(WHERE);
414: /*
415: &Import Area File Format:&
416:
417: This menu allows you to choose the format of the area file you wish to
418: import into the current file library.
419:
420: A "raw" directory listing can be created in DOS with the following
421: command: &DIR /ON /AD /B > DIRS.RAW&
422: */
423: strcpy(opt[k++],"DIRS.TXT (Synchronet)");
424: strcpy(opt[k++],"FILEBONE.NA (Fido)");
425: strcpy(opt[k++],"DIRS.RAW (Raw)");
426: opt[k][0]=0;
427: k=0;
428: k=uifc.list(WIN_MID|WIN_SAV,0,0,0,&k,0
429: ,"Import Area File Format",opt);
430: if(k==-1)
431: break;
432: if(k==0)
433: sprintf(str,"%sDIRS.TXT",cfg.ctrl_dir);
434: else if(k==1)
435: sprintf(str,"FILEBONE.NA");
436: else {
437: strcpy(str,cfg.lib[i]->parent_path);
438: backslash(str);
439: strcat(str,"dirs.raw");
440: }
441: if(uifc.input(WIN_MID|WIN_SAV,0,0,"Filename"
442: ,str,sizeof(str)-1,K_EDIT)<=0)
443: break;
444: if((stream=fnopen(&file,str,O_RDONLY))==NULL) {
445: uifc.msg("Open Failure");
446: break; }
447: uifc.pop("Importing Areas...");
448: while(!feof(stream)) {
449: if(!fgets(str,128,stream)) break;
450: truncsp(str);
451: if(!str[0])
452: continue;
453: memset(&tmpdir,0,sizeof(dir_t));
454: tmpdir.misc=DEFAULT_DIR_OPTIONS;
455: tmpdir.maxfiles=1000;
456: tmpdir.up_pct=cfg.cdt_up_pct;
457: tmpdir.dn_pct=cfg.cdt_dn_pct;
458:
459: p=str;
460: while(*p && *p<=' ') p++;
461:
462: if(k==2) { /* raw */
463: SAFECOPY(tmp_code,p);
464: SAFECOPY(tmpdir.lname,p);
465: SAFECOPY(tmpdir.sname,p);
466: SAFECOPY(tmpdir.path,p);
467: ported++;
468: }
469: else if(k==1) {
470: if(strnicmp(p,"AREA ",5))
471: continue;
472: p+=5;
473: while(*p && *p<=' ') p++;
474: SAFECOPY(tmp_code,p);
475: while(*p>' ') p++; /* Skip areaname */
476: while(*p && *p<=' ') p++; /* Skip space */
477: while(*p>' ') p++; /* Skip level */
478: while(*p && *p<=' ') p++; /* Skip space */
479: while(*p>' ') p++; /* Skip flags */
480: while(*p && *p<=' ') p++; /* Skip space */
481: SAFECOPY(tmpdir.sname,p);
482: SAFECOPY(tmpdir.lname,p);
483: ported++;
484: }
485: else {
486: sprintf(tmpdir.lname,"%.*s",LEN_SLNAME,str);
487: if(!fgets(str,128,stream)) break;
488: truncsp(str);
489: sprintf(tmpdir.sname,"%.*s",LEN_SSNAME,str);
490: if(!fgets(str,128,stream)) break;
491: truncsp(str);
492: SAFECOPY(tmp_code,str);
493: if(!fgets(str,128,stream)) break;
494: truncsp(str);
495: sprintf(tmpdir.data_dir,"%.*s",LEN_DIR,str);
496: if(!fgets(str,128,stream)) break;
497: truncsp(str);
498: sprintf(tmpdir.arstr,"%.*s",LEN_ARSTR,str);
499: if(!fgets(str,128,stream)) break;
500: truncsp(str);
501: sprintf(tmpdir.ul_arstr,"%.*s",LEN_ARSTR,str);
502: if(!fgets(str,128,stream)) break;
503: truncsp(str);
504: sprintf(tmpdir.dl_arstr,"%.*s",LEN_ARSTR,str);
505: if(!fgets(str,128,stream)) break;
506: truncsp(str);
507: sprintf(tmpdir.op_arstr,"%.*s",LEN_ARSTR,str);
508: if(!fgets(str,128,stream)) break;
509: truncsp(str);
510: sprintf(tmpdir.path,"%.*s",LEN_DIR,str);
511: if(!fgets(str,128,stream)) break;
512: truncsp(str);
513: sprintf(tmpdir.upload_sem,"%.*s",LEN_DIR,str);
514: if(!fgets(str,128,stream)) break;
515: truncsp(str);
516: tmpdir.maxfiles=atoi(str);
517: if(!fgets(str,128,stream)) break;
518: truncsp(str);
519: sprintf(tmpdir.exts,"%.*s",40,str);
520: if(!fgets(str,128,stream)) break;
521: truncsp(str);
522: tmpdir.misc=ahtoul(str);
523: if(!fgets(str,128,stream)) break;
524: truncsp(str);
525: tmpdir.seqdev=atoi(str);
526: if(!fgets(str,128,stream)) break;
527: truncsp(str);
528: tmpdir.sort=atoi(str);
529: if(!fgets(str,128,stream)) break;
530: truncsp(str);
531: sprintf(tmpdir.ex_arstr,"%.*s",LEN_ARSTR,str);
532: if(!fgets(str,128,stream)) break;
533: truncsp(str);
534: tmpdir.maxage=atoi(str);
535: if(!fgets(str,128,stream)) break;
536: truncsp(str);
537: tmpdir.up_pct=atoi(str);
538: if(!fgets(str,128,stream)) break;
539: truncsp(str);
540: tmpdir.dn_pct=atoi(str);
541:
542: ported++;
543: while(!feof(stream)
544: && strcmp(str,"***END-OF-DIR***")) {
545: if(!fgets(str,128,stream)) break;
546: truncsp(str);
547: }
548: }
549:
550: prep_code(tmp_code); /* Strip invalid chars */
551: SAFECOPY(tmpdir.code_suffix,tmp_code); /* THEN truncate to valid length */
552:
553: for(j=0;j<cfg.total_dirs;j++) {
554: if(cfg.dir[j]->lib!=i)
555: continue;
556: if(!stricmp(cfg.dir[j]->code_suffix,tmpdir.code_suffix))
557: break; }
558: if(j==cfg.total_dirs) {
559:
560: if((cfg.dir=(dir_t **)REALLOC(cfg.dir
561: ,sizeof(dir_t *)*(cfg.total_dirs+1)))==NULL) {
562: errormsg(WHERE,ERR_ALLOC,"dir",cfg.total_dirs+1);
563: cfg.total_dirs=0;
564: bail(1);
565: break; }
566:
567: if((cfg.dir[j]=(dir_t *)MALLOC(sizeof(dir_t)))
568: ==NULL) {
569: errormsg(WHERE,ERR_ALLOC,"dir",sizeof(dir_t));
570: break; }
571: memset(cfg.dir[j],0,sizeof(dir_t)); }
572: if(k==1) {
573: SAFECOPY(cfg.dir[j]->code_suffix,tmpdir.code_suffix);
574: SAFECOPY(cfg.dir[j]->sname,tmpdir.code_suffix);
575: SAFECOPY(cfg.dir[j]->lname,tmpdir.lname);
576: if(j==cfg.total_dirs) {
577: cfg.dir[j]->maxfiles=1000;
578: cfg.dir[j]->up_pct=cfg.cdt_up_pct;
579: cfg.dir[j]->dn_pct=cfg.cdt_dn_pct;
580: }
581: } else
582: memcpy(cfg.dir[j],&tmpdir,sizeof(dir_t));
583: cfg.dir[j]->lib=i;
584: if(j==cfg.total_dirs) {
585: cfg.dir[j]->misc=tmpdir.misc;
586: cfg.total_dirs++;
587: }
588: uifc.changes=1;
589: }
590: fclose(stream);
591: uifc.pop(0);
592: sprintf(str,"%lu File Areas Imported Successfully",ported);
593: uifc.msg(str);
594: break;
595:
596: case 8:
597: dir_cfg(i);
598: break; } } }
599:
600: }
601:
602: void dir_cfg(uint libnum)
603: {
604: static int dflt,bar,tog_dflt,tog_bar,adv_dflt,opt_dflt;
605: char str[81],str2[81],code[9],path[128],done=0,*p;
606: int j,n;
607: uint i,dirnum[MAX_OPTS+1];
608: static dir_t savdir;
609:
610: while(1) {
611: for(i=0,j=0;i<cfg.total_dirs && j<MAX_OPTS;i++)
612: if(cfg.dir[i]->lib==libnum) {
613: sprintf(opt[j],"%-25s",cfg.dir[i]->lname);
614: dirnum[j++]=i; }
615: dirnum[j]=cfg.total_dirs;
616: opt[j][0]=0;
617: sprintf(str,"%s Directories",cfg.lib[libnum]->sname);
618: uifc.savnum=0;
619: i=WIN_SAV|WIN_ACT;
620: if(j)
621: i|=WIN_DEL|WIN_GET|WIN_DELACT;
622: if(j<MAX_OPTS)
623: i|=WIN_INS|WIN_INSACT|WIN_XTR;
624: if(savdir.sname[0])
625: i|=WIN_PUT;
626: SETHELP(WHERE);
627: /*
628: &File Directories:&
629:
630: This is a list of file directories that have been configured for the
631: selected file library.
632:
633: To add a directory, select the desired position with the arrow keys and
634: hit INS .
635:
636: To delete a directory, select it with the arrow keys and hit DEL .
637:
638: To configure a directory, select it with the arrow keys and hit ENTER .
639: */
640: i=uifc.list(i,24,1,45,&dflt,&bar,str,opt);
641: uifc.savnum=1;
642: if((signed)i==-1)
643: return;
644: if((i&MSK_ON)==MSK_INS) {
645: i&=MSK_OFF;
646: strcpy(str,"Games");
647: SETHELP(WHERE);
648: /*
649: &Directory Long Name:&
650:
651: This is a description of the file directory which is displayed in all
652: directory listings.
653: */
654: if(uifc.input(WIN_MID|WIN_SAV,0,0,"Directory Long Name",str,LEN_SLNAME
655: ,K_EDIT)<1)
656: continue;
657: sprintf(str2,"%.*s",LEN_SSNAME,str);
658: SETHELP(WHERE);
659: /*
660: &Directory Short Name:&
661:
662: This is a short description of the file directory which is displayed at
663: the file transfer prompt.
664: */
665: if(uifc.input(WIN_MID|WIN_SAV,0,0,"Directory Short Name",str2,LEN_SSNAME
666: ,K_EDIT)<1)
667: continue;
668: sprintf(code,"%.8s",str2);
669: p=strchr(code,' ');
670: if(p) *p=0;
671: strupr(code);
672: SETHELP(WHERE);
673: /*
674: &Directory Internal Code Suffix:&
675:
676: Every directory must have its own unique code for Synchronet to refer to
677: it internally. This code should be descriptive of the directory's
678: contents, usually an abreviation of the directory's name.
679: */
680: if(uifc.input(WIN_MID|WIN_SAV,0,0,"Directory Internal Code Suffix",code,LEN_CODE
681: ,K_EDIT|K_UPPER)<1)
682: continue;
683: if(!code_ok(code)) {
684: uifc.helpbuf=invalid_code;
685: uifc.msg("Invalid Code");
686: uifc.helpbuf=0;
687: continue; }
688: if(cfg.lib[libnum]->parent_path[0])
689: SAFECOPY(path,code);
690: else
691: sprintf(path,"%sdirs/%s",cfg.data_dir,code);
692: SETHELP(WHERE);
693: /*
694: &Directory File Path:&
695:
696: This is the drive and directory where your uploads to and downloads from
697: this directory will be stored. Example: &C:\XFER\GAMES&
698: */
699: if(uifc.input(WIN_MID|WIN_SAV,0,0,"Directory File Path",path,50
700: ,K_EDIT)<1)
701: continue;
702: if((cfg.dir=(dir_t **)REALLOC(cfg.dir,sizeof(dir_t *)*(cfg.total_dirs+1)))==NULL) {
703: errormsg(WHERE,ERR_ALLOC,nulstr,cfg.total_dirs+1);
704: cfg.total_dirs=0;
705: bail(1);
706: continue; }
707:
708: if(j)
709: for(n=cfg.total_dirs;n>dirnum[i];n--)
710: cfg.dir[n]=cfg.dir[n-1];
711: if((cfg.dir[dirnum[i]]=(dir_t *)MALLOC(sizeof(dir_t)))==NULL) {
712: errormsg(WHERE,ERR_ALLOC,nulstr,sizeof(dir_t));
713: continue; }
714: memset((dir_t *)cfg.dir[dirnum[i]],0,sizeof(dir_t));
715: cfg.dir[dirnum[i]]->lib=libnum;
716: cfg.dir[dirnum[i]]->maxfiles=MAX_FILES<500 ? MAX_FILES:500;
717: if(stricmp(str2,"OFFLINE"))
718: cfg.dir[dirnum[i]]->misc=DEFAULT_DIR_OPTIONS;
719: strcpy(cfg.dir[dirnum[i]]->code_suffix,code);
720: strcpy(cfg.dir[dirnum[i]]->lname,str);
721: strcpy(cfg.dir[dirnum[i]]->sname,str2);
722: strcpy(cfg.dir[dirnum[i]]->path,path);
723: cfg.dir[dirnum[i]]->up_pct=cfg.cdt_up_pct;
724: cfg.dir[dirnum[i]]->dn_pct=cfg.cdt_dn_pct;
725: cfg.total_dirs++;
726: uifc.changes=1;
727: continue; }
728: if((i&MSK_ON)==MSK_DEL) {
729: i&=MSK_OFF;
730: SETHELP(WHERE);
731: /*
732: &Delete Directory Data Files:&
733:
734: If you want to delete all the database files for this directory,
735: select &Yes&.
736: */
737: j=1;
738: strcpy(opt[0],"Yes");
739: strcpy(opt[1],"No");
740: opt[2][0]=0;
741: j=uifc.list(WIN_MID|WIN_SAV,0,0,0,&j,0
742: ,"Delete Data in Sub-board",opt);
743: if(j==-1)
744: continue;
745: if(j==0) {
746: sprintf(str,"%s%s.*"
747: ,cfg.lib[cfg.dir[dirnum[i]]->lib]->code_prefix
748: ,cfg.dir[dirnum[i]]->code_suffix);
749: strlwr(str);
750: if(!cfg.dir[dirnum[i]]->data_dir[0])
751: sprintf(tmp,"%sdirs/",cfg.data_dir);
752: else
753: strcpy(tmp,cfg.dir[dirnum[i]]->data_dir);
754: delfiles(tmp,str); }
755: FREE(cfg.dir[dirnum[i]]);
756: cfg.total_dirs--;
757: for(j=dirnum[i];j<cfg.total_dirs;j++)
758: cfg.dir[j]=cfg.dir[j+1];
759: uifc.changes=1;
760: continue; }
761: if((i&MSK_ON)==MSK_GET) {
762: i&=MSK_OFF;
763: savdir=*cfg.dir[dirnum[i]];
764: continue; }
765: if((i&MSK_ON)==MSK_PUT) {
766: i&=MSK_OFF;
767: *cfg.dir[dirnum[i]]=savdir;
768: cfg.dir[dirnum[i]]->lib=libnum;
769: uifc.changes=1;
770: continue; }
771: i=dirnum[dflt];
772: j=0;
773: done=0;
774: while(!done) {
775: n=0;
776: sprintf(opt[n++],"%-27.27s%s","Long Name",cfg.dir[i]->lname);
777: sprintf(opt[n++],"%-27.27s%s","Short Name",cfg.dir[i]->sname);
778: sprintf(opt[n++],"%-27.27s%s%s","Internal Code"
779: ,cfg.lib[cfg.dir[i]->lib]->code_prefix, cfg.dir[i]->code_suffix);
780: sprintf(opt[n++],"%-27.27s%.40s","Access Requirements"
781: ,cfg.dir[i]->arstr);
782: sprintf(opt[n++],"%-27.27s%.40s","Upload Requirements"
783: ,cfg.dir[i]->ul_arstr);
784: sprintf(opt[n++],"%-27.27s%.40s","Download Requirements"
785: ,cfg.dir[i]->dl_arstr);
786: sprintf(opt[n++],"%-27.27s%.40s","Operator Requirements"
787: ,cfg.dir[i]->op_arstr);
788: sprintf(opt[n++],"%-27.27s%.40s","Exemption Requirements"
789: ,cfg.dir[i]->ex_arstr);
790: sprintf(opt[n++],"%-27.27s%.40s","Transfer File Path"
791: ,cfg.dir[i]->path);
792: sprintf(opt[n++],"%-27.27s%u","Maximum Number of Files"
793: ,cfg.dir[i]->maxfiles);
794: if(cfg.dir[i]->maxage)
795: sprintf(str,"Enabled (%u days old)",cfg.dir[i]->maxage);
796: else
797: strcpy(str,"Disabled");
798: sprintf(opt[n++],"%-27.27s%s","Purge by Age",str);
799: sprintf(opt[n++],"%-27.27s%u%%","Credit on Upload"
800: ,cfg.dir[i]->up_pct);
801: sprintf(opt[n++],"%-27.27s%u%%","Credit on Download"
802: ,cfg.dir[i]->dn_pct);
803: strcpy(opt[n++],"Toggle Options...");
804: strcpy(opt[n++],"Advanced Options...");
805: opt[n][0]=0;
806: sprintf(str,"%s Directory",cfg.dir[i]->sname);
807: SETHELP(WHERE);
808: /*
809: &Directory Configuration:&
810:
811: This menu allows you to configure the individual selected directory.
812: Options with a trailing &...& provide a sub-menu of more options.
813: */
814: uifc.savnum=1;
815: switch(uifc.list(WIN_SAV|WIN_ACT|WIN_RHT|WIN_BOT
816: ,0,0,60,&opt_dflt,0,str,opt)) {
817: case -1:
818: done=1;
819: break;
820: case 0:
821: SETHELP(WHERE);
822: /*
823: &Directory Long Name:&
824:
825: This is a description of the file directory which is displayed in all
826: directory listings.
827: */
828: strcpy(str,cfg.dir[i]->lname); /* save */
829: if(!uifc.input(WIN_L2R|WIN_SAV,0,17,"Name to use for Listings"
830: ,cfg.dir[i]->lname,LEN_SLNAME,K_EDIT))
831: strcpy(cfg.dir[i]->lname,str);
832: break;
833: case 1:
834: SETHELP(WHERE);
835: /*
836: &Directory Short Name:&
837:
838: This is a short description of the file directory which is displayed at
839: the file transfer prompt.
840: */
841: uifc.input(WIN_L2R|WIN_SAV,0,17,"Name to use for Prompts"
842: ,cfg.dir[i]->sname,LEN_SSNAME,K_EDIT);
843: break;
844: case 2:
845: SETHELP(WHERE);
846: /*
847: &Directory Internal Code Suffix:&
848:
849: Every directory must have its own unique code for Synchronet to refer to
850: it internally. This code should be descriptive of the directory's
851: contents, usually an abreviation of the directory's name.
852: */
853: strcpy(str,cfg.dir[i]->code_suffix);
854: uifc.input(WIN_L2R|WIN_SAV,0,17,"Internal Code Suffix (unique)"
855: ,str,LEN_CODE,K_EDIT|K_UPPER);
856: if(code_ok(str))
857: strcpy(cfg.dir[i]->code_suffix,str);
858: else {
859: uifc.helpbuf=invalid_code;
860: uifc.msg("Invalid Code");
861: uifc.helpbuf=0;
862: }
863: break;
864: case 3:
865: uifc.savnum=2;
866: sprintf(str,"%s Access",cfg.dir[i]->sname);
867: getar(str,cfg.dir[i]->arstr);
868: break;
869: case 4:
870: uifc.savnum=2;
871: sprintf(str,"%s Upload",cfg.dir[i]->sname);
872: getar(str,cfg.dir[i]->ul_arstr);
873: break;
874: case 5:
875: uifc.savnum=2;
876: sprintf(str,"%s Download",cfg.dir[i]->sname);
877: getar(str,cfg.dir[i]->dl_arstr);
878: break;
879: case 6:
880: uifc.savnum=2;
881: sprintf(str,"%s Operator",cfg.dir[i]->sname);
882: getar(str,cfg.dir[i]->op_arstr);
883: break;
884: case 7:
885: uifc.savnum=2;
886: sprintf(str,"%s Exemption",cfg.dir[i]->sname);
887: getar(str,cfg.dir[i]->ex_arstr);
888: break;
889: case 8:
890: SETHELP(WHERE);
891: /*
892: &File Path:&
893:
894: This is the default storage path for files uploaded to this directory.
895: If this path is blank, files are stored in a directory off of the
896: DATA\DIRS directory using the internal code of this directory as the
897: name of the dirdirectory (i.e. DATA\DIRS\<CODE>).
898:
899: This path can be overridden on a per file basis using &Alternate File
900: Paths&.
901: */
902: uifc.input(WIN_L2R|WIN_SAV,0,17,"File Path"
903: ,cfg.dir[i]->path,sizeof(cfg.dir[i]->path)-1,K_EDIT);
904: break;
905: case 9:
906: SETHELP(WHERE);
907: /*
908: &Maximum Number of Files:&
909:
910: This value is the maximum number of files allowed in this directory.
911: */
912: sprintf(str,"%u",cfg.dir[i]->maxfiles);
913: uifc.input(WIN_L2R|WIN_SAV,0,17,"Maximum Number of Files"
914: ,str,5,K_EDIT|K_NUMBER);
915: n=atoi(str);
916: if(n>MAX_FILES) {
917: sprintf(str,"Maximum Files is %u",MAX_FILES);
918: uifc.msg(str); }
919: else
920: cfg.dir[i]->maxfiles=n;
921: break;
922: case 10:
923: sprintf(str,"%u",cfg.dir[i]->maxage);
924: SETHELP(WHERE);
925: /*
926: &Maximum Age of Files:&
927:
928: This value is the maximum number of days that files will be kept in
929: the directory based on the date the file was uploaded or last
930: downloaded (If the &Purge by Last Download& toggle option is used).
931:
932: The Synchronet file base maintenance program (&DELFILES&) must be used
933: to automatically remove files based on age.
934: */
935: uifc.input(WIN_MID|WIN_SAV,0,17,"Maximum Age of Files (in days)"
936: ,str,5,K_EDIT|K_NUMBER);
937: cfg.dir[i]->maxage=atoi(str);
938: break;
939: case 11:
940: SETHELP(WHERE);
941: /*
942: &Percentage of Credits to Credit Uploader on Upload:&
943:
944: This is the percentage of a file's credit value that is given to users
945: when they upload files. Most often, this value will be set to &100& to
946: give full credit value (100%) for uploads.
947:
948: If you want uploaders to receive no credits upon upload, set this value
949: to &0&.
950: */
951: uifc.input(WIN_MID|WIN_SAV,0,0
952: ,"Percentage of Credits to Credit Uploader on Upload"
953: ,ultoa(cfg.dir[i]->up_pct,tmp,10),4,K_EDIT|K_NUMBER);
954: cfg.dir[i]->up_pct=atoi(tmp);
955: break;
956: case 12:
957: SETHELP(WHERE);
958: /*
959: &Percentage of Credits to Credit Uploader on Download:&
960:
961: This is the percentage of a file's credit value that is given to users
962: who upload a file that is later downloaded by another user. This is an
963: award type system where more popular files will generate more credits
964: for the uploader.
965:
966: If you do not want uploaders to receive credit when files they upload
967: are later downloaded, set this value to &0&.
968: */
969: uifc.input(WIN_MID|WIN_SAV,0,0
970: ,"Percentage of Credits to Credit Uploader on Download"
971: ,ultoa(cfg.dir[i]->dn_pct,tmp,10),4,K_EDIT|K_NUMBER);
972: cfg.dir[i]->dn_pct=atoi(tmp);
973: break;
974: case 13:
975: while(1) {
976: n=0;
977: sprintf(opt[n++],"%-27.27s%s","Check for File Existence"
978: ,cfg.dir[i]->misc&DIR_FCHK ? "Yes":"No");
979: strcpy(str,"Slow Media Device");
980: if(cfg.dir[i]->seqdev) {
981: sprintf(tmp," #%u",cfg.dir[i]->seqdev);
982: strcat(str,tmp); }
983: sprintf(opt[n++],"%-27.27s%s",str
984: ,cfg.dir[i]->seqdev ? "Yes":"No");
985: sprintf(opt[n++],"%-27.27s%s","Force Content Ratings"
986: ,cfg.dir[i]->misc&DIR_RATE ? "Yes":"No");
987: sprintf(opt[n++],"%-27.27s%s","Upload Date in Listings"
988: ,cfg.dir[i]->misc&DIR_ULDATE ? "Yes":"No");
989: sprintf(opt[n++],"%-27.27s%s","Multiple File Numberings"
990: ,cfg.dir[i]->misc&DIR_MULT ? "Yes":"No");
991: sprintf(opt[n++],"%-27.27s%s","Search for Duplicates"
992: ,cfg.dir[i]->misc&DIR_DUPES ? "Yes":"No");
993: sprintf(opt[n++],"%-27.27s%s","Search for New Files"
994: ,cfg.dir[i]->misc&DIR_NOSCAN ? "No":"Yes");
995: sprintf(opt[n++],"%-27.27s%s","Search for Auto-ADDFILES"
996: ,cfg.dir[i]->misc&DIR_NOAUTO ? "No":"Yes");
997: sprintf(opt[n++],"%-27.27s%s","Import FILE_ID.DIZ"
998: ,cfg.dir[i]->misc&DIR_DIZ ? "Yes":"No");
999: sprintf(opt[n++],"%-27.27s%s","Free Downloads"
1000: ,cfg.dir[i]->misc&DIR_FREE ? "Yes":"No");
1001: sprintf(opt[n++],"%-27.27s%s","Free Download Time"
1002: ,cfg.dir[i]->misc&DIR_TFREE ? "Yes":"No");
1003: sprintf(opt[n++],"%-27.27s%s","Deduct Upload Time"
1004: ,cfg.dir[i]->misc&DIR_ULTIME ? "Yes":"No");
1005: sprintf(opt[n++],"%-27.27s%s","Credit Uploads"
1006: ,cfg.dir[i]->misc&DIR_CDTUL ? "Yes":"No");
1007: sprintf(opt[n++],"%-27.27s%s","Credit Downloads"
1008: ,cfg.dir[i]->misc&DIR_CDTDL ? "Yes":"No");
1009: sprintf(opt[n++],"%-27.27s%s","Credit with Minutes"
1010: ,cfg.dir[i]->misc&DIR_CDTMIN ? "Yes":"No");
1011: sprintf(opt[n++],"%-27.27s%s","Download Notifications"
1012: ,cfg.dir[i]->misc&DIR_QUIET ? "No":"Yes");
1013: sprintf(opt[n++],"%-27.27s%s","Anonymous Uploads"
1014: ,cfg.dir[i]->misc&DIR_ANON ? cfg.dir[i]->misc&DIR_AONLY
1015: ? "Only":"Yes":"No");
1016: sprintf(opt[n++],"%-27.27s%s","Purge by Last Download"
1017: ,cfg.dir[i]->misc&DIR_SINCEDL ? "Yes":"No");
1018: sprintf(opt[n++],"%-27.27s%s","Mark Moved Files as New"
1019: ,cfg.dir[i]->misc&DIR_MOVENEW ? "Yes":"No");
1020: sprintf(opt[n++],"%-27.27s%s","Include Transfers In Stats"
1021: ,cfg.dir[i]->misc&DIR_NOSTAT ? "No":"Yes");
1022: opt[n][0]=0;
1023: uifc.savnum=2;
1024: SETHELP(WHERE);
1025: /*
1026: &Directory Toggle Options:&
1027:
1028: This is the toggle options menu for the selected file directory.
1029:
1030: The available options from this menu can all be toggled between two or
1031: more states, such as &Yes& and &No&.
1032: */
1033: n=uifc.list(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,3,2,36,&tog_dflt
1034: ,&tog_bar,"Toggle Options",opt);
1035: if(n==-1)
1036: break;
1037: uifc.savnum=3;
1038: switch(n) {
1039: case 0:
1040: n=cfg.dir[i]->misc&DIR_FCHK ? 0:1;
1041: strcpy(opt[0],"Yes");
1042: strcpy(opt[1],"No");
1043: opt[2][0]=0;
1044: SETHELP(WHERE);
1045: /*
1046: &Check for File Existence When Listing:&
1047:
1048: If you want the actual existence of files to be verified while listing
1049: directories, set this value to &Yes&.
1050:
1051: Directories with files located on CD-ROM or other slow media should have
1052: this option set to &No&.
1053: */
1054: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1055: ,"Check for File Existence When Listing",opt);
1056: if(n==0 && !(cfg.dir[i]->misc&DIR_FCHK)) {
1057: cfg.dir[i]->misc|=DIR_FCHK;
1058: uifc.changes=1; }
1059: else if(n==1 && (cfg.dir[i]->misc&DIR_FCHK)) {
1060: cfg.dir[i]->misc&=~DIR_FCHK;
1061: uifc.changes=1; }
1062: break;
1063: case 1:
1064: n=cfg.dir[i]->seqdev ? 0:1;
1065: strcpy(opt[0],"Yes");
1066: strcpy(opt[1],"No");
1067: opt[2][0]=0;
1068: SETHELP(WHERE);
1069: /*
1070: &Slow Media Device:&
1071:
1072: If this directory contains files located on CD-ROM or other slow media
1073: device, you should set this option to &Yes&. Each slow media device on
1074: your system should have a unique &Device Number&. If you only have one
1075: slow media device, then this number should be set to &1&.
1076:
1077: &CD-ROM multidisk changers& are considered &one& device and all the
1078: directories on all the CD-ROMs in each changer should be set to the same
1079: device number.
1080: */
1081: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1082: ,"Slow Media Device"
1083: ,opt);
1084: if(n==0) {
1085: if(!cfg.dir[i]->seqdev) {
1086: uifc.changes=1;
1087: strcpy(str,"1"); }
1088: else
1089: sprintf(str,"%u",cfg.dir[i]->seqdev);
1090: uifc.input(WIN_MID|WIN_SAV,0,0
1091: ,"Device Number"
1092: ,str,2,K_EDIT|K_UPPER);
1093: cfg.dir[i]->seqdev=atoi(str); }
1094: else if(n==1 && cfg.dir[i]->seqdev) {
1095: cfg.dir[i]->seqdev=0;
1096: uifc.changes=1; }
1097: break;
1098: case 2:
1099: n=cfg.dir[i]->misc&DIR_RATE ? 0:1;
1100: strcpy(opt[0],"Yes");
1101: strcpy(opt[1],"No");
1102: opt[2][0]=0;
1103: SETHELP(WHERE);
1104: /*
1105: &Force Content Ratings in Descriptions:&
1106:
1107: If you would like all uploads to this directory to be prompted for
1108: content rating (G, R, or X), set this value to &Yes&.
1109: */
1110: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1111: ,"Force Content Ratings in Descriptions",opt);
1112: if(n==0 && !(cfg.dir[i]->misc&DIR_RATE)) {
1113: cfg.dir[i]->misc|=DIR_RATE;
1114: uifc.changes=1; }
1115: else if(n==1 && (cfg.dir[i]->misc&DIR_RATE)) {
1116: cfg.dir[i]->misc&=~DIR_RATE;
1117: uifc.changes=1; }
1118: break;
1119: case 3:
1120: n=cfg.dir[i]->misc&DIR_ULDATE ? 0:1;
1121: strcpy(opt[0],"Yes");
1122: strcpy(opt[1],"No");
1123: opt[2][0]=0;
1124: SETHELP(WHERE);
1125: /*
1126: &Include Upload Date in File Descriptions:&
1127:
1128: If you wish the upload date of each file in this directory to be
1129: automatically included in the file description, set this option to
1130: &Yes&.
1131: */
1132: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1133: ,"Include Upload Date in Descriptions",opt);
1134: if(n==0 && !(cfg.dir[i]->misc&DIR_ULDATE)) {
1135: cfg.dir[i]->misc|=DIR_ULDATE;
1136: uifc.changes=1; }
1137: else if(n==1 && (cfg.dir[i]->misc&DIR_ULDATE)) {
1138: cfg.dir[i]->misc&=~DIR_ULDATE;
1139: uifc.changes=1; }
1140: break;
1141: case 4:
1142: n=cfg.dir[i]->misc&DIR_MULT ? 0:1;
1143: strcpy(opt[0],"Yes");
1144: strcpy(opt[1],"No");
1145: opt[2][0]=0;
1146: SETHELP(WHERE);
1147: /*
1148: &Ask for Multiple File Numberings:&
1149:
1150: If you would like uploads to this directory to be prompted for multiple
1151: file (disk) numbers, set this value to &Yes&.
1152: */
1153: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1154: ,"Ask for Multiple File Numberings",opt);
1155: if(n==0 && !(cfg.dir[i]->misc&DIR_MULT)) {
1156: cfg.dir[i]->misc|=DIR_MULT;
1157: uifc.changes=1; }
1158: else if(n==1 && (cfg.dir[i]->misc&DIR_MULT)) {
1159: cfg.dir[i]->misc&=~DIR_MULT;
1160: uifc.changes=1; }
1161: break;
1162: case 5:
1163: n=cfg.dir[i]->misc&DIR_DUPES ? 0:1;
1164: strcpy(opt[0],"Yes");
1165: strcpy(opt[1],"No");
1166: opt[2][0]=0;
1167: SETHELP(WHERE);
1168: /*
1169: &Search Directory for Duplicate Filenames:&
1170:
1171: If you would like to have this directory searched for duplicate
1172: filenames when a user attempts to upload a file, set this option to &Yes&.
1173: */
1174: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1175: ,"Search for Duplicate Filenames",opt);
1176: if(n==0 && !(cfg.dir[i]->misc&DIR_DUPES)) {
1177: cfg.dir[i]->misc|=DIR_DUPES;
1178: uifc.changes=1; }
1179: else if(n==1 && (cfg.dir[i]->misc&DIR_DUPES)) {
1180: cfg.dir[i]->misc&=~DIR_DUPES;
1181: uifc.changes=1; }
1182: break;
1183: case 6:
1184: n=cfg.dir[i]->misc&DIR_NOSCAN ? 1:0;
1185: strcpy(opt[0],"Yes");
1186: strcpy(opt[1],"No");
1187: opt[2][0]=0;
1188: SETHELP(WHERE);
1189: /*
1190: &Search Directory for New Files:&
1191:
1192: If you would like to have this directory searched for newly uploaded
1193: files when a user scans &All& libraries for new files, set this option to
1194: &Yes&.
1195:
1196: If this directory is located on &CD-ROM& or other read only media
1197: (where uploads are unlikely to occur), it will improve new file scans
1198: if this option is set to &No&.
1199: */
1200: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1201: ,"Search for New files",opt);
1202: if(n==0 && cfg.dir[i]->misc&DIR_NOSCAN) {
1203: cfg.dir[i]->misc&=~DIR_NOSCAN;
1204: uifc.changes=1; }
1205: else if(n==1 && !(cfg.dir[i]->misc&DIR_NOSCAN)) {
1206: cfg.dir[i]->misc|=DIR_NOSCAN;
1207: uifc.changes=1; }
1208: break;
1209: case 7:
1210: n=cfg.dir[i]->misc&DIR_NOAUTO ? 1:0;
1211: strcpy(opt[0],"Yes");
1212: strcpy(opt[1],"No");
1213: opt[2][0]=0;
1214: SETHELP(WHERE);
1215: /*
1216: &Search Directory for Auto-ADDFILES:&
1217:
1218: If you would like to have this directory searched for a file list to
1219: import automatically when using the &ADDFILES *& (Auto-ADD) feature,
1220: set this option to &Yes&.
1221: */
1222: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1223: ,"Search for Auto-ADDFILES",opt);
1224: if(n==0 && cfg.dir[i]->misc&DIR_NOAUTO) {
1225: cfg.dir[i]->misc&=~DIR_NOAUTO;
1226: uifc.changes=1; }
1227: else if(n==1 && !(cfg.dir[i]->misc&DIR_NOAUTO)) {
1228: cfg.dir[i]->misc|=DIR_NOAUTO;
1229: uifc.changes=1; }
1230: break;
1231: case 8:
1232: n=cfg.dir[i]->misc&DIR_DIZ ? 0:1;
1233: strcpy(opt[0],"Yes");
1234: strcpy(opt[1],"No");
1235: opt[2][0]=0;
1236: SETHELP(WHERE);
1237: /*
1238: &Import FILE_ID.DIZ and DESC.SDI Descriptions:&
1239:
1240: If you would like archived descriptions (&FILE_ID.DIZ& and &DESC.SDI&)
1241: of uploaded files to be automatically imported as the extended
1242: description, set this option to &Yes&.
1243: */
1244: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1245: ,"Import FILE_ID.DIZ and DESC.SDI",opt);
1246: if(n==0 && !(cfg.dir[i]->misc&DIR_DIZ)) {
1247: cfg.dir[i]->misc|=DIR_DIZ;
1248: uifc.changes=1; }
1249: else if(n==1 && (cfg.dir[i]->misc&DIR_DIZ)) {
1250: cfg.dir[i]->misc&=~DIR_DIZ;
1251: uifc.changes=1; }
1252: break;
1253: case 9:
1254: n=cfg.dir[i]->misc&DIR_FREE ? 0:1;
1255: strcpy(opt[0],"Yes");
1256: strcpy(opt[1],"No");
1257: opt[2][0]=0;
1258: SETHELP(WHERE);
1259: /*
1260: &Downloads are Free:&
1261:
1262: If you would like all downloads from this directory to be free (cost
1263: no credits), set this option to &Yes&.
1264: */
1265: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1266: ,"Downloads are Free",opt);
1267: if(n==0 && !(cfg.dir[i]->misc&DIR_FREE)) {
1268: cfg.dir[i]->misc|=DIR_FREE;
1269: uifc.changes=1; }
1270: else if(n==1 && (cfg.dir[i]->misc&DIR_FREE)) {
1271: cfg.dir[i]->misc&=~DIR_FREE;
1272: uifc.changes=1; }
1273: break;
1274: case 10:
1275: n=cfg.dir[i]->misc&DIR_TFREE ? 0:1;
1276: strcpy(opt[0],"Yes");
1277: strcpy(opt[1],"No");
1278: opt[2][0]=0;
1279: SETHELP(WHERE);
1280: /*
1281: &Free Download Time:&
1282:
1283: If you would like all downloads from this directory to not subtract
1284: time from the user, set this option to &Yes&.
1285: */
1286: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1287: ,"Free Download Time",opt);
1288: if(n==0 && !(cfg.dir[i]->misc&DIR_TFREE)) {
1289: cfg.dir[i]->misc|=DIR_TFREE;
1290: uifc.changes=1; }
1291: else if(n==1 && (cfg.dir[i]->misc&DIR_TFREE)) {
1292: cfg.dir[i]->misc&=~DIR_TFREE;
1293: uifc.changes=1; }
1294: break;
1295: case 11:
1296: n=cfg.dir[i]->misc&DIR_ULTIME ? 0:1;
1297: strcpy(opt[0],"Yes");
1298: strcpy(opt[1],"No");
1299: opt[2][0]=0;
1300: SETHELP(WHERE);
1301: /*
1302: &Deduct Upload Time:&
1303:
1304: If you would like all uploads to this directory to have the time spent
1305: uploading subtracted from their time online, set this option to &Yes&.
1306: */
1307: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1308: ,"Deduct Upload Time",opt);
1309: if(n==0 && !(cfg.dir[i]->misc&DIR_ULTIME)) {
1310: cfg.dir[i]->misc|=DIR_ULTIME;
1311: uifc.changes=1; }
1312: else if(n==1 && (cfg.dir[i]->misc&DIR_ULTIME)) {
1313: cfg.dir[i]->misc&=~DIR_ULTIME;
1314: uifc.changes=1; }
1315: break;
1316: case 12:
1317: n=cfg.dir[i]->misc&DIR_CDTUL ? 0:1;
1318: strcpy(opt[0],"Yes");
1319: strcpy(opt[1],"No");
1320: opt[2][0]=0;
1321: SETHELP(WHERE);
1322: /*
1323: &Give Credit for Uploads:&
1324:
1325: If you want users who upload to this directory to get credit for their
1326: initial upload, set this option to &Yes&.
1327: */
1328: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1329: ,"Give Credit for Uploads",opt);
1330: if(n==0 && !(cfg.dir[i]->misc&DIR_CDTUL)) {
1331: cfg.dir[i]->misc|=DIR_CDTUL;
1332: uifc.changes=1; }
1333: else if(n==1 && (cfg.dir[i]->misc&DIR_CDTUL)) {
1334: cfg.dir[i]->misc&=~DIR_CDTUL;
1335: uifc.changes=1; }
1336: break;
1337: case 13:
1338: n=cfg.dir[i]->misc&DIR_CDTDL ? 0:1;
1339: strcpy(opt[0],"Yes");
1340: strcpy(opt[1],"No");
1341: opt[2][0]=0;
1342: SETHELP(WHERE);
1343: /*
1344: &Give Uploader Credit for Downloads:&
1345:
1346: If you want users who upload to this directory to get credit when their
1347: files are downloaded, set this optin to &Yes&.
1348: */
1349: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1350: ,"Give Uploader Credit for Downloads",opt);
1351: if(n==0 && !(cfg.dir[i]->misc&DIR_CDTDL)) {
1352: cfg.dir[i]->misc|=DIR_CDTDL;
1353: uifc.changes=1; }
1354: else if(n==1 && (cfg.dir[i]->misc&DIR_CDTDL)) {
1355: cfg.dir[i]->misc&=~DIR_CDTDL;
1356: uifc.changes=1; }
1357: break;
1358: case 14:
1359: n=cfg.dir[i]->misc&DIR_CDTMIN ? 0:1;
1360: strcpy(opt[0],"Yes");
1361: strcpy(opt[1],"No");
1362: opt[2][0]=0;
1363: SETHELP(WHERE);
1364: /*
1365: `Credit Uploader with Minutes instead of Credits:`
1366:
1367: If you wish to give the uploader of files to this directory minutes,
1368: intead of credits, set this option to `Yes`.
1369: */
1370: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1371: ,"Credit Uploader with Minutes",opt);
1372: if(n==0 && !(cfg.dir[i]->misc&DIR_CDTMIN)) {
1373: cfg.dir[i]->misc|=DIR_CDTMIN;
1374: uifc.changes=1; }
1375: else if(n==1 && cfg.dir[i]->misc&DIR_CDTMIN){
1376: cfg.dir[i]->misc&=~DIR_CDTMIN;
1377: uifc.changes=1; }
1378: break;
1379: case 15:
1380: n=cfg.dir[i]->misc&DIR_QUIET ? 1:0;
1381: strcpy(opt[0],"Yes");
1382: strcpy(opt[1],"No");
1383: opt[2][0]=0;
1384: SETHELP(WHERE);
1385: /*
1386: `Send Download Notifications:`
1387:
1388: If you wish the BBS to send download notification messages to the
1389: uploader of a file to this directory, set this option to `Yes`.
1390: */
1391: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1392: ,"Send Download Notifications",opt);
1393: if(n==1 && !(cfg.dir[i]->misc&DIR_QUIET)) {
1394: cfg.dir[i]->misc|=DIR_QUIET;
1395: uifc.changes=1;
1396: } else if(n==0 && cfg.dir[i]->misc&DIR_QUIET){
1397: cfg.dir[i]->misc&=~DIR_QUIET;
1398: uifc.changes=1;
1399: }
1400: break;
1401:
1402:
1403: case 16:
1404: n=cfg.dir[i]->misc&DIR_ANON ? (cfg.dir[i]->misc&DIR_AONLY ? 2:0):1;
1405: strcpy(opt[0],"Yes");
1406: strcpy(opt[1],"No");
1407: strcpy(opt[2],"Only");
1408: opt[3][0]=0;
1409: SETHELP(WHERE);
1410: /*
1411: &Allow Anonymous Uploads:&
1412:
1413: If you want users with the &A& exemption to be able to upload anonymously
1414: to this directory, set this option to &Yes&. If you want all uploads to
1415: this directory to be forced anonymous, set this option to &Only&.
1416: */
1417: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1418: ,"Allow Anonymous Uploads",opt);
1419: if(n==0 && (cfg.dir[i]->misc&(DIR_ANON|DIR_AONLY))
1420: !=DIR_ANON) {
1421: cfg.dir[i]->misc|=DIR_ANON;
1422: cfg.dir[i]->misc&=~DIR_AONLY;
1423: uifc.changes=1; }
1424: else if(n==1 && cfg.dir[i]->misc&(DIR_ANON|DIR_AONLY)){
1425: cfg.dir[i]->misc&=~(DIR_ANON|DIR_AONLY);
1426: uifc.changes=1; }
1427: else if(n==2 && (cfg.dir[i]->misc&(DIR_ANON|DIR_AONLY))
1428: !=(DIR_ANON|DIR_AONLY)) {
1429: cfg.dir[i]->misc|=(DIR_ANON|DIR_AONLY);
1430: uifc.changes=1; }
1431: break;
1432: case 17:
1433: n=cfg.dir[i]->misc&DIR_SINCEDL ? 0:1;
1434: strcpy(opt[0],"Yes");
1435: strcpy(opt[1],"No");
1436: opt[2][0]=0;
1437: SETHELP(WHERE);
1438: /*
1439: &Purge Files Based on Date of Last Download:&
1440:
1441: Using the Synchronet file base maintenance utility (&DELFILES&), you can
1442: have files removed based on the number of days since last downloaded
1443: rather than the number of days since the file was uploaded (default),
1444: by setting this option to &Yes&.
1445: */
1446: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1447: ,"Purge Files Based on Date of Last Download"
1448: ,opt);
1449: if(n==0 && !(cfg.dir[i]->misc&DIR_SINCEDL)) {
1450: cfg.dir[i]->misc|=DIR_SINCEDL;
1451: uifc.changes=1; }
1452: else if(n==1 && (cfg.dir[i]->misc&DIR_SINCEDL)) {
1453: cfg.dir[i]->misc&=~DIR_SINCEDL;
1454: uifc.changes=1; }
1455: break;
1456: case 18:
1457: n=cfg.dir[i]->misc&DIR_MOVENEW ? 0:1;
1458: strcpy(opt[0],"Yes");
1459: strcpy(opt[1],"No");
1460: opt[2][0]=0;
1461: SETHELP(WHERE);
1462: /*
1463: &Mark Moved Files as New:&
1464:
1465: If this option is set to &Yes&, then all files moved &from& this directory
1466: will have their upload date changed to the current date so the file will
1467: appear in users' new-file scans again.
1468: */
1469: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1470: ,"Mark Moved Files as New"
1471: ,opt);
1472: if(n==0 && !(cfg.dir[i]->misc&DIR_MOVENEW)) {
1473: cfg.dir[i]->misc|=DIR_MOVENEW;
1474: uifc.changes=1; }
1475: else if(n==1 && (cfg.dir[i]->misc&DIR_MOVENEW)) {
1476: cfg.dir[i]->misc&=~DIR_MOVENEW;
1477: uifc.changes=1; }
1478: break;
1479: case 19:
1480: n=cfg.dir[i]->misc&DIR_NOSTAT ? 1:0;
1481: strcpy(opt[0],"Yes");
1482: strcpy(opt[1],"No");
1483: opt[2][0]=0;
1484: SETHELP(WHERE);
1485: /*
1486: `Include Transfers In System Statistics:`
1487:
1488: If this option is set to ~Yes~, then all files uploaded to or downloaded
1489: from this directory will be included in the system's daily and
1490: cumulative statistics.
1491: */
1492: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1493: ,"Include Transfers In System Statistics"
1494: ,opt);
1495: if(n==1 && !(cfg.dir[i]->misc&DIR_NOSTAT)) {
1496: cfg.dir[i]->misc|=DIR_NOSTAT;
1497: uifc.changes=1;
1498: } else if(n==0 && cfg.dir[i]->misc&DIR_NOSTAT){
1499: cfg.dir[i]->misc&=~DIR_NOSTAT;
1500: uifc.changes=1;
1501: }
1502: break;
1503: }
1504: }
1505: break;
1506: case 14:
1507: while(1) {
1508: n=0;
1509: sprintf(opt[n++],"%-27.27s%s","Extensions Allowed"
1510: ,cfg.dir[i]->exts);
1511: if(!cfg.dir[i]->data_dir[0])
1512: sprintf(str,"%sdirs/",cfg.data_dir);
1513: else
1514: strcpy(str,cfg.dir[i]->data_dir);
1515: sprintf(opt[n++],"%-27.27s%.40s","Data Directory"
1516: ,str);
1517: sprintf(opt[n++],"%-27.27s%.40s","Upload Semaphore File"
1518: ,cfg.dir[i]->upload_sem);
1519: sprintf(opt[n++],"%-27.27s%s","Sort Value and Direction"
1520: , cfg.dir[i]->sort==SORT_NAME_A ? "Name Ascending"
1521: : cfg.dir[i]->sort==SORT_NAME_D ? "Name Descending"
1522: : cfg.dir[i]->sort==SORT_DATE_A ? "Date Ascending"
1523: : "Date Descending");
1524: opt[n][0]=0;
1525: uifc.savnum=2;
1526: SETHELP(WHERE);
1527: /*
1528: &Directory Advanced Options:&
1529:
1530: This is the advanced options menu for the selected file directory.
1531: */
1532: n=uifc.list(WIN_ACT|WIN_SAV|WIN_RHT|WIN_BOT,3,4,60,&adv_dflt,0
1533: ,"Advanced Options",opt);
1534: if(n==-1)
1535: break;
1536: uifc.savnum=3;
1537: switch(n) {
1538: case 0:
1539: SETHELP(WHERE);
1540: /*
1541: &File Extensions Allowed:&
1542:
1543: This option allows you to limit the types of files uploaded to this
1544: directory. This is a list of file extensions that are allowed, each
1545: separated by a comma (Example: &ZIP,EXE&). If this option is left
1546: blank, all file extensions will be allowed to be uploaded.
1547: */
1548: uifc.input(WIN_L2R|WIN_SAV,0,17
1549: ,"File Extensions Allowed"
1550: ,cfg.dir[i]->exts,sizeof(cfg.dir[i]->exts)-1,K_EDIT);
1551: break;
1552: case 1:
1553: SETHELP(WHERE);
1554: /*
1555: &Data Directory:&
1556:
1557: Use this if you wish to place the data directory for this directory
1558: on another drive or in another directory besides the default setting.
1559: */
1560: uifc.input(WIN_MID|WIN_SAV,0,17,"Data"
1561: ,cfg.dir[i]->data_dir,sizeof(cfg.dir[i]->data_dir)-1,K_EDIT);
1562: break;
1563: case 2:
1564: SETHELP(WHERE);
1565: /*
1566: &Upload Semaphore File:&
1567:
1568: This is a filename that will be used as a semaphore (signal) to your
1569: FidoNet front-end that new files are ready to be hatched for export.
1570: */
1571: uifc.input(WIN_MID|WIN_SAV,0,17,"Upload Semaphore"
1572: ,cfg.dir[i]->upload_sem,sizeof(cfg.dir[i]->upload_sem)-1,K_EDIT);
1573: break;
1574: case 3:
1575: n=0;
1576: strcpy(opt[0],"Name Ascending");
1577: strcpy(opt[1],"Name Descending");
1578: strcpy(opt[2],"Date Ascending");
1579: strcpy(opt[3],"Date Descending");
1580: opt[4][0]=0;
1581: SETHELP(WHERE);
1582: /*
1583: &Sort Value and Direction:&
1584:
1585: This option allows you to determine the sort value and direction. Files
1586: that are uploaded are automatically sorted by filename or upload date,
1587: ascending or descending. If you change the sort value or direction after
1588: a directory already has files in it, use the sysop transfer menu &;RESORT&
1589: command to resort the directory with the new sort parameters.
1590: */
1591: n=uifc.list(WIN_MID|WIN_SAV,0,0,0,&n,0
1592: ,"Sort Value and Direction",opt);
1593: if(n==0 && cfg.dir[i]->sort!=SORT_NAME_A) {
1594: cfg.dir[i]->sort=SORT_NAME_A;
1595: uifc.changes=1; }
1596: else if(n==1 && cfg.dir[i]->sort!=SORT_NAME_D) {
1597: cfg.dir[i]->sort=SORT_NAME_D;
1598: uifc.changes=1; }
1599: else if(n==2 && cfg.dir[i]->sort!=SORT_DATE_A) {
1600: cfg.dir[i]->sort=SORT_DATE_A;
1601: uifc.changes=1; }
1602: else if(n==3 && cfg.dir[i]->sort!=SORT_DATE_D) {
1603: cfg.dir[i]->sort=SORT_DATE_D;
1604: uifc.changes=1; }
1605: break; } }
1606: break;
1607: } } }
1608:
1609: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.