Fixed mbfile kill bug and dup announce bug
This commit is contained in:
parent
66fb5827e8
commit
a15239d0ff
@ -3,6 +3,7 @@ $Id$
|
||||
If you feel lucky then try this version, if not just wait
|
||||
a few days so that I fix the destructive bugs that might
|
||||
be present in this version.
|
||||
One found, destroyed 5 fileareas, don't think it won't happen!
|
||||
|
||||
|
||||
v0.51.2 06-Mar-2004
|
||||
@ -34,6 +35,11 @@ v0.51.2 06-Mar-2004
|
||||
files, thumbnails are now also removed from disk.
|
||||
Updated tic file import function to the new files database
|
||||
structure.
|
||||
Added more checks and logging for adding new file announce
|
||||
records. Newer files will replace the older record so the last
|
||||
one will be announced.
|
||||
Fixed a bug in mbfile kill that destroyed the filebase when a
|
||||
file was deleted or moved.
|
||||
|
||||
mbfile:
|
||||
Updated kill, index, check, pack, list, adopt, import, move,
|
||||
|
4
TODO
4
TODO
@ -125,6 +125,10 @@ mbfido:
|
||||
|
||||
N: Reimplement characterset conversion again on the gateway.
|
||||
|
||||
N: When adding a record to the toberep database add check for existing
|
||||
older entry to update the info with the later received file. Else
|
||||
just handle the record as a dupe.
|
||||
|
||||
mbcico:
|
||||
N: Further investigate binkp tty_error hangup.
|
||||
|
||||
|
@ -129,7 +129,7 @@ void Uploads()
|
||||
}
|
||||
T_File.TotLdesc = k;
|
||||
T_File.Announce = TRUE;
|
||||
if (Add_ToBeRep())
|
||||
if (Add_ToBeRep(T_File))
|
||||
Count++;
|
||||
/*
|
||||
* Mark file is announced.
|
||||
|
@ -229,7 +229,7 @@ void Kill(void)
|
||||
* Now we must pack this area database otherwise
|
||||
* we run into trouble later on.
|
||||
*/
|
||||
fseek(pFile, 0, SEEK_SET);
|
||||
fseek(pFile, fdbhdr.hdrsize, SEEK_SET);
|
||||
sprintf(sTemp, "%s/fdb/filetmp.data", getenv("MBSE_ROOT"));
|
||||
|
||||
if ((pTemp = fopen(sTemp, "a+")) != NULL) {
|
||||
|
@ -677,7 +677,7 @@ int ProcessTic(fa_list *sbl)
|
||||
strncpy(T_File.Name, TIC.NewFile, 12);
|
||||
strncpy(T_File.LName, TIC.NewFullName, 80);
|
||||
T_File.Fdate = TIC.FileDate;
|
||||
Add_ToBeRep();
|
||||
Add_ToBeRep(T_File);
|
||||
}
|
||||
|
||||
if (TIC.SendOrg && !tic.FileArea) {
|
||||
|
@ -35,10 +35,11 @@
|
||||
|
||||
|
||||
/*
|
||||
* Add a file whos data is in T_File to the toberep.data file.
|
||||
* Add a file record to the toberep database and do some checks.
|
||||
* The function returns TRUE if the file will be announced.
|
||||
* The newfiles announce option will later remove these records.
|
||||
*/
|
||||
int Add_ToBeRep()
|
||||
int Add_ToBeRep(struct _filerecord report)
|
||||
{
|
||||
char *fname;
|
||||
struct _filerecord Temp;
|
||||
@ -56,9 +57,31 @@ int Add_ToBeRep()
|
||||
|
||||
fseek(tbr, 0, SEEK_SET);
|
||||
while (fread(&Temp, sizeof(Temp), 1, tbr) == 1) {
|
||||
if ((strcmp(Temp.Name, T_File.Name) == 0) && (Temp.Fdate == T_File.Fdate))
|
||||
|
||||
if (strcmp(Temp.Name, report.Name) == 0) {
|
||||
Syslog('f', "Add_ToBeRep found record with the same name");
|
||||
if (strlen(report.Echo) && (strcmp(Temp.Echo, report.Echo) == 0)) {
|
||||
Syslog('f', "Add_ToBeRep this is the same tic area");
|
||||
/*
|
||||
* If it's a later received file, update the record
|
||||
*/
|
||||
if (report.Fdate > Temp.Fdate) {
|
||||
Syslog('f', "Add_ToBeRep this file is newer, update record");
|
||||
fseek(tbr, - sizeof(Temp), SEEK_SET);
|
||||
fwrite(&report, sizeof(report), 1, tbr);
|
||||
fclose(tbr);
|
||||
return TRUE;
|
||||
}
|
||||
Syslog('f', "Add_ToBeRep this file is older, discard record");
|
||||
fclose(tbr);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if ((strcmp(Temp.Name, report.Name) == 0) && (Temp.Fdate == T_File.Fdate)) {
|
||||
Syslog('f', "Add_ToBeRep record with same filename, but other area");
|
||||
Found = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (Found) {
|
||||
Syslog('!', "File %s already in toberep.data", T_File.Name);
|
||||
@ -66,6 +89,10 @@ int Add_ToBeRep()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Append record
|
||||
*/
|
||||
Syslog('f', "Add_ToBeRep append record");
|
||||
fwrite(&T_File, sizeof(T_File), 1, tbr);
|
||||
fclose(tbr);
|
||||
return TRUE;
|
||||
|
@ -3,6 +3,6 @@
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
int Add_ToBeRep(void);
|
||||
int Add_ToBeRep(struct _filerecord);
|
||||
|
||||
#endif
|
||||
|
@ -428,17 +428,17 @@ int main(int argc, char *argv[])
|
||||
|
||||
oldmask = umask(002);
|
||||
|
||||
if ((argc == 2) && (strncmp(tl(argv[1]), "i", 1) == 0))
|
||||
init = TRUE;
|
||||
else
|
||||
screen_start((char *)"MBsetup");
|
||||
|
||||
do_quiet = TRUE;
|
||||
Syslog(' ', " ");
|
||||
Syslog(' ', "MBSETUP v%s started by %s", VERSION, pw->pw_name);
|
||||
if (init)
|
||||
Syslog('+', "Cmd: mbsetup init");
|
||||
|
||||
if ((argc == 2) && (strncmp(tl(argv[1]), "i", 1) == 0))
|
||||
init = TRUE;
|
||||
else
|
||||
screen_start((char *)"MBsetup");
|
||||
|
||||
if (lockprogram((char *)"mbsetup")) {
|
||||
printf("\n\7Another mbsetup is already running, abort.\n\n");
|
||||
die(MBERR_NO_PROGLOCK);
|
||||
|
Reference in New Issue
Block a user