Fixed magic update for import

This commit is contained in:
Michiel Broek 2004-03-13 14:34:36 +00:00
parent 5c47fa0c86
commit e6755f1880
4 changed files with 23 additions and 7 deletions

View File

@ -38,6 +38,7 @@ v0.51.2 06-Mar-2004
Fixed a bug when a m_get message was received on a file that Fixed a bug when a m_get message was received on a file that
was already transmitted to remove that file from the outbound was already transmitted to remove that file from the outbound
queue. queue.
Removed some debug logging from inbound handler.
mbfido: mbfido:
When removing files during tic import due to replace or maximum When removing files during tic import due to replace or maximum

3
TODO
View File

@ -77,9 +77,6 @@ mbtask:
space is still available. space is still available.
mbfido: mbfido:
N: When importing a tic file with magic name, remove the magic from
the filerecord of the previous file. (Is no corrected by mbfile c).
N: The elist rules files are named (8.3) areaname.rul where areaname N: The elist rules files are named (8.3) areaname.rul where areaname
is the first 8 characters of the area name and we use the full name is the first 8 characters of the area name and we use the full name
only. Make sure both namings are accepted? only. Make sure both namings are accepted?

View File

@ -109,7 +109,6 @@ int inbound_close(int success)
dest = calloc(PATH_MAX, sizeof(char)); dest = calloc(PATH_MAX, sizeof(char));
while ((de = readdir(dp))) { while ((de = readdir(dp))) {
Syslog('s', "inbound_close() checking \"%s\"", MBSE_SS(de->d_name));
sprintf(source, "%s/%s", tempinbound, de->d_name); sprintf(source, "%s/%s", tempinbound, de->d_name);
sprintf(dest, "%s/%s", inbound, de->d_name); sprintf(dest, "%s/%s", inbound, de->d_name);
if ((lstat(source, &stb) == 0) && (S_ISREG(stb.st_mode))) { if ((lstat(source, &stb) == 0) && (S_ISREG(stb.st_mode))) {
@ -119,7 +118,7 @@ int inbound_close(int success)
if ((rc = file_mv(source, dest))) { if ((rc = file_mv(source, dest))) {
WriteError("Can't move %s to %s: %s", source, dest, strerror(rc)); WriteError("Can't move %s to %s: %s", source, dest, strerror(rc));
} else { } else {
Syslog('s', "Moved %s to %s", de->d_name, inbound); Syslog('s', "inbound_close(): moved %s to %s", de->d_name, inbound);
gotfiles = TRUE; gotfiles = TRUE;
} }
} }
@ -137,7 +136,7 @@ int inbound_close(int success)
if ((rc = rmdir(tempinbound))) { if ((rc = rmdir(tempinbound))) {
WriteError("Can't remove %s: %s", tempinbound, strerror(rc)); WriteError("Can't remove %s: %s", tempinbound, strerror(rc));
} else { } else {
Syslog('s', "Removed %s", tempinbound); Syslog('s', "inbound_close(): removed %s", tempinbound);
} }
free(tempinbound); free(tempinbound);

View File

@ -131,7 +131,6 @@ int Add_BBS()
} }
if (strlen(TIC.TicIn.Magic)) { if (strlen(TIC.TicIn.Magic)) {
strncpy(frec.Magic, TIC.TicIn.Magic, sizeof(frec.Magic) -1); strncpy(frec.Magic, TIC.TicIn.Magic, sizeof(frec.Magic) -1);
sprintf(frec.Desc[i], "Magic Request: %s", TIC.TicIn.Magic);
} }
sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile); sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile);
@ -235,6 +234,16 @@ int Add_BBS()
*/ */
for (i = 0; i < Insert; i++) { for (i = 0; i < Insert; i++) {
fread(&fdb, frechdr.recsize, 1, fp); fread(&fdb, frechdr.recsize, 1, fp);
/*
* If we see a magic that is the new magic, remove
* the old one.
*/
if (strlen(TIC.TicIn.Magic) && (strcmp(fdb.Magic, TIC.TicIn.Magic) == 0)) {
Syslog('f', "addbbs(): remove magic from %s (%s)", fdb.Name, fdb.LName);
memset(&fdb.Magic, 0, sizeof(fdb.Magic));
}
/* /*
* Check if we are importing a file with the same * Check if we are importing a file with the same
* name, if so, don't copy the original database * name, if so, don't copy the original database
@ -255,6 +264,16 @@ int Add_BBS()
* Append the rest of the entries. * Append the rest of the entries.
*/ */
while (fread(&fdb, frechdr.recsize, 1, fp) == 1) { while (fread(&fdb, frechdr.recsize, 1, fp) == 1) {
/*
* If we see a magic that is the new magic, remove
* the old one.
*/
if (strlen(TIC.TicIn.Magic) && (strcmp(fdb.Magic, TIC.TicIn.Magic) == 0)) {
Syslog('f', "addbbs(): remove magic from %s (%s)", fdb.Name, fdb.LName);
memset(&fdb.Magic, 0, sizeof(fdb.Magic));
}
/* /*
* Check if we find a file with the same name, * Check if we find a file with the same name,
* then we skip the record what was origionaly * then we skip the record what was origionaly