Made file area create/delete more friendly

This commit is contained in:
Michiel Broek 2001-12-16 13:28:54 +00:00
parent 1bd01075b1
commit 0e787dab0f
3 changed files with 25 additions and 17 deletions

View File

@ -4270,6 +4270,7 @@ v0.33.19 26-Oct-2001
When a file area is made unavailable in menu 8.4, first the When a file area is made unavailable in menu 8.4, first the
files in that area area checked. If there are none, the area files in that area area checked. If there are none, the area
is completly removed, including paths, indexes and database. is completly removed, including paths, indexes and database.
When an new area is made available, the database is created.
The AREADEF lines in golded.inc now contain the aka to use The AREADEF lines in golded.inc now contain the aka to use
instead of a dot. instead of a dot.

13
TODO
View File

@ -15,13 +15,6 @@ $Id$
mbsebbs: mbsebbs:
L: Reading of function keys over modem lines, or worse PPP connections,
must be fixed. Timing problems together with modem buffering?
It works with direct serial connections. Note, this also happens
on busy LAN's between Linux boxes with normal xterm's.
Note: this problem almost dissapeared after kernel upgrade to
2.2.16. Another note, this does not happen over ssh.
L: Must include SEEN-BY and other hidden lines into BlueWave and QWK L: Must include SEEN-BY and other hidden lines into BlueWave and QWK
mail, must be user selectable. see remarks of William McBrine. mail, must be user selectable. see remarks of William McBrine.
The default is oke now. The default is oke now.
@ -44,12 +37,10 @@ mbfido:
U: Code cleanup and make a structure in this program. Remove duplicate U: Code cleanup and make a structure in this program. Remove duplicate
or similar functions. or similar functions.
N: Received files not in an archive are not scanned for virusses.
N: Remove memory leak during toss. (It's ok for less 5000 messages for N: Remove memory leak during toss. (It's ok for less 5000 messages for
each run). each run).
N: Implement long filename support from .tic files. N: Implement long filename support from .tic files (testing fase).
N: When a news article is received from a mailinglist there is a valid N: When a news article is received from a mailinglist there is a valid
To: address in the message, the gate doesn't see that and uses the To: address in the message, the gate doesn't see that and uses the
@ -66,8 +57,6 @@ mbfido:
N: Also check for file_id.diz filenames. N: Also check for file_id.diz filenames.
mbcico: mbcico:
U: Implement nodes FNC flag for sending files.
L: Implement modem connect response translation for ISDN lines, i.e. L: Implement modem connect response translation for ISDN lines, i.e.
make the CAUSE responses human readable. see McMail for this make the CAUSE responses human readable. see McMail for this
option. option.

View File

@ -173,6 +173,7 @@ int AppendFilearea(void)
area.FileFind = TRUE; area.FileFind = TRUE;
area.AddAlpha = TRUE; area.AddAlpha = TRUE;
area.FileReq = TRUE; area.FileReq = TRUE;
strcpy(area.Path, CFG.ftp_base);
fwrite(&area, sizeof(area), 1, fil); fwrite(&area, sizeof(area), 1, fil);
fclose(fil); fclose(fil);
FileUpdated = 1; FileUpdated = 1;
@ -314,12 +315,12 @@ int EditFileRec(int Area)
case 5: E_SEC( 10,16, area.LTSec, "8.4.5 LIST SECURITY", FileScreen) case 5: E_SEC( 10,16, area.LTSec, "8.4.5 LIST SECURITY", FileScreen)
case 6: E_STR( 11,16,64, area.FilesBbs, "The path and name of \"files.bbs\" if area is on CDROM") case 6: E_STR( 11,16,64, area.FilesBbs, "The path and name of \"files.bbs\" if area is on CDROM")
case 7: Available = edit_bool(12, 16, area.Available, (char *)"Is this area ^available^"); case 7: Available = edit_bool(12, 16, area.Available, (char *)"Is this area ^available^");
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), Area);
if (area.Available && !Available) { if (area.Available && !Available) {
/* /*
* Attempt to disable this area, but check first. * Attempt to disable this area, but check first.
*/ */
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), Area);
if ((fp = fopen(temp, "r"))) { if ((fp = fopen(temp, "r"))) {
fseek(fp, 0, SEEK_END); fseek(fp, 0, SEEK_END);
files = ftell(fp) / sizeof(file); files = ftell(fp) / sizeof(file);
@ -329,13 +330,23 @@ int EditFileRec(int Area)
} }
fclose(fp); fclose(fp);
} }
if (!Available) {
if (yes_no((char *)"Are you sure you want to delete this area") == 0)
Available = TRUE;
}
if (!Available) { if (!Available) {
/* /*
* Make it so * Make it so
*/ */
unlink(temp); unlink(temp);
sprintf(temp, "rm -r -f %s", area.Path); if (strlen(area.Path) && strcmp(area.Path, CFG.ftp_base)) {
system(temp); /*
* Erase file in path if path is set and not the default
* FTP base path
*/
sprintf(temp, "rm -r -f %s", area.Path);
system(temp);
}
memset(&area, 0, sizeof(area)); memset(&area, 0, sizeof(area));
/* /*
* Fill in default values * Fill in default values
@ -345,15 +356,22 @@ int EditFileRec(int Area)
area.FileFind = TRUE; area.FileFind = TRUE;
area.AddAlpha = TRUE; area.AddAlpha = TRUE;
area.FileReq = TRUE; area.FileReq = TRUE;
strcpy(area.Path, CFG.ftp_base);
Syslog('+', "Removed file area %d", Area); Syslog('+', "Removed file area %d", Area);
} }
free(temp);
area.Available = Available; area.Available = Available;
FileScreen(); FileScreen();
} }
if (!area.Available && Available) { if (!area.Available && Available) {
area.Available = TRUE; area.Available = TRUE;
if ((fp = fopen(temp, "a+")) == NULL) {
WriteError("$Can't create file database %s", temp);
} else {
fclose(fp);
}
chmod(temp, 0660);
} }
free(temp);
break; break;
case 8: E_BOOL(13,16, area.New, "Include this area in ^new files^ check") case 8: E_BOOL(13,16, area.New, "Include this area in ^new files^ check")
case 9: E_BOOL(14,16, area.Dupes, "Check this area for ^duplicates^ during upload") case 9: E_BOOL(14,16, area.Dupes, "Check this area for ^duplicates^ during upload")