Changed to new modular upload function

This commit is contained in:
Michiel Broek 2004-11-06 22:01:51 +00:00
parent 0bc80c5eec
commit d7242cd944
16 changed files with 257 additions and 300 deletions

View File

@ -25,9 +25,13 @@ v0.71.0 27-Oct-2004
Removed support for non-batching protocols (xmodem) and for
bidirectional protocols.
Removed Ctrl-F G, this is of no use anymore.
Switched to new modular download function.
Switched to new modular download and upload functions.
With download from file areas, the long filename is sent to
the users, we will only support protocols that allow this.
When an invalid OLR reply packet is received, it is removed
from the users upload directory.
We don't reward upload time anymore, only bytes. It's more
troubles to implement right then it's worth these days.
mbnewusr:
Rewrote terminal i/o.
@ -41,7 +45,7 @@ v0.71.0 27-Oct-2004
Changed width of prompt 261.
Added prompt 28.
Removed leading spaces of prompt 151.
Removed prompt 276.
Removed prompts 259 and 276.
script:
Modified rundoor.sh so that it uses two different dosemu

View File

@ -257,7 +257,7 @@
256 offline.c |Untag Offline Reader message areas
257 filesub.c |Found FILEID.DIZ in
258 file.c |No files marked for download.
259 filesub.c |extra minutes.
259 .c |
260 offline.c |You have selected the following Conference(s):
261 file.c |Filename Size Date
262 change.c |Protocol: Can't open protocol file.

View File

@ -257,7 +257,7 @@ JN|Node onbekend, toch doorgaan [j/N]:
|Verwijder selectie Offline Reader berichten gebieden
|FILEID.DIZ gevonden in
|Geen bestanden gemarkeerd voor download.
|extra minuten.
|
|De volgende conferentie(s) zijn geselecteerd:
|Bestand Grootte Datum
|Protocol: Kan protocollen bestand niet openen.

View File

@ -257,7 +257,7 @@ YN|Node not known, continue anyway [y/N]:
|Untag Offline Reader message areas
|Found FILEID.DIZ in
|No files marked for download.
|extra minutes.
|
|You have selected the following Conference(s):
|Filename Size Date
|Protocol: Can't open protocol file.

View File

@ -257,7 +257,7 @@ ON|Node inconnu, continue quand m
|Untag Offline Reader message areas
|Found FILEID.DIZ in
|No files marked for download.
|extra minutes.
|
|You have selected the following Conference(s):
|Filename Size Date
|Protocol: Can't open protocol file.

View File

@ -257,7 +257,7 @@ SN|Nodo desco
|Desmarcar  reas para lectura Off-Line
|Atopado FILEID.DIZ en
|Non hai ficheiros marcados.
|minutos extra.
|
|Escolleche-las seguintes  reas:
|Ficheiro Tama¤o Fecha
|Protocolo: Non podo abrir ficheiro de protocolos.

View File

@ -257,7 +257,7 @@ JN|Adresse unbekannt, dennoch fortfahren [j/N]:
|Mitteilungsbereiche fuer den "Offline Reader" abwaehlen
|FILEID.DIZ gefunden in
|Es sind keine Dateien zum Herunterladen markiert.
|extra Minuten.
|
|Sie haben folgende Bereiche fuer den "Offline Reader" markiert:
|Dateiname Groesse Datum
|Protokoll: Protokolldatei kann nicht geoeffnet werden.

View File

@ -257,7 +257,7 @@ JN|Adresse unbekannt, dennoch fortfahren [<j>a/<N>ein]:
|Mitteilungsbereiche fuer den "Offline Reader" abwaehlen
|FILEID.DIZ gefunden in
|Es sind keine Dateien zum Herunterladen markiert.
|extra Minuten.
|
|Du hast folgende Bereiche fuer den "Offline Reader" markiert:
|Dateiname Groesse Datum
|Protokoll: Protokolldatei kann nicht geoeffnet werden.

View File

@ -257,7 +257,7 @@ SN|Nodo sconosciuto, continua lo stesso [s/N]:
|Untag aree messaggi per l'Offline Reader
|Trovato FILEID.DIZ in
|Nessun file selezionato per il download.
|minuti extra.
|
|Hai selezionato le seguenti Conferenze:
|Filename Dimensione Data
|Protocollo: Non posso aprire il file del protocollo.

View File

@ -257,7 +257,7 @@ SN|Nodo desconocido.
|Desmarcar  reas para lectura Off-Line
|Encontrado FILEID.DIZ en
|No hay ficheros marcados.
|minutos extra.
|
|Has seleccionado las siguientes  reas:
|Fichero Tama¤o Fecha
|Protocolo: No puedo abrir fichero de protocolos.

View File

@ -882,24 +882,12 @@ int NewfileScan(int AskStart)
*/
int Upload()
{
char temp[81];
int Area, err;
int Area, rc;
unsigned long OldArea;
time_t ElapstimeStart, ElapstimeFin, iTime;
DIR *dirp;
struct dirent *dp;
struct stat statfile;
char *arc;
char *arc, *temp;
up_list *up = NULL, *tmpf;
WhosDoingWhat(UPLOAD, NULL);
/*
* Select default protocol if users hasn't any.
*/
if (!ForceProtocol())
return 0;
Enter(1);
Area = OldArea = iAreaNumber;
@ -910,8 +898,6 @@ int Upload()
if (area.Upload)
Area = area.Upload;
SetFileArea(Area);
SetFileArea(Area);
Syslog('+', "Upload area is %d %s", Area, area.Name);
/*
@ -929,113 +915,66 @@ int Upload()
clear();
Enter(2);
colour(CFG.HiliteF, CFG.HiliteB);
/* Please start your upload now ...*/
pout(CFG.HiliteF, CFG.HiliteB, sProtAdvice);
PUTCHAR(' ');
PUTSTR((char *) Language(283));
Enter(2);
Syslog('+', "Upload using %s", sProtName);
rc = upload(&up);
sprintf(temp, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
if (chdir(temp)) {
WriteError("$Can't chdir to %s", temp);
if (rc) {
Syslog('+', "Upload failed, rc=%d", rc);
SetFileArea(OldArea);
return 0;
}
sleep(2);
ElapstimeStart = time(NULL);
/*
* Get the file(s). Set the Client/Server time to 2 hours.
* This is not a nice solution, at least it works and prevents
* that the bbs will hang.
*/
Altime(7200);
alarm_set(7190);
err = execute_str(sProtUp, (char *)"", NULL, NULL, NULL, NULL);
rawport();
if (err) {
/*
* Log any errors
*/
WriteError("$Upload error %d, prot: %s", err, sProtUp);
}
Altime(0);
alarm_off();
alarm_on();
Enter(3);
ElapstimeFin = time(NULL);
/*
* Get time from Before Upload and After Upload to get
* upload time, if the time is zero, it will be one.
*/
iTime = ElapstimeFin - ElapstimeStart;
if (!iTime)
iTime = 1;
Syslog('b', "Transfer time %ld", iTime);
if ((dirp = opendir(".")) == NULL) {
WriteError("$Upload: can't open ./upl");
Home();
SetFileArea(OldArea);
return 1;
}
Syslog('b', "upload done, start checks");
Enter(2);
pout(CFG.UnderlineColourF, CFG.UnderlineColourB, (char *)"Checking your upload(s)");
Enter(1);
while ((dp = readdir(dirp)) != NULL) {
if (*(dp->d_name) != '.') {
stat(dp->d_name, &statfile);
Syslog('+', "Uploaded \"%s\", %ld bytes", dp->d_name, statfile.st_size);
temp = calloc(PATH_MAX, sizeof(char));
for (tmpf = up; tmpf; tmpf = tmpf->next) {
sprintf(temp, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
chdir(temp);
if ((arc = GetFileType(dp->d_name)) == NULL) {
/*
* If the filetype is unknown, it is probably
* a textfile or so. Import it direct.
*/
Syslog('b', "Unknown file type");
if (!ScanDirect(dp->d_name))
ImportFile(dp->d_name, Area, FALSE, iTime, statfile.st_size);
Syslog('b', "Checking upload %s", tmpf->filename);
if ((arc = GetFileType(tmpf->filename)) == NULL) {
/*
* If the filetype is unknown, it is probably
* a textfile or so. Import it direct.
*/
Syslog('b', "Unknown file type");
if (!ScanDirect(basename(tmpf->filename)))
ImportFile(tmpf->filename, Area, FALSE, tmpf->size);
} else {
/*
* We figured out the type of the uploaded file.
*/
Syslog('b', "File type is %s", arc);
/*
* MS-DOS executables are handled direct.
*/
if ((strcmp("EXE", arc) == 0) || (strcmp("COM", arc) == 0)) {
if (!ScanDirect(basename(tmpf->filename)))
ImportFile(tmpf->filename, Area, FALSE, tmpf->size);
} else {
/*
* We figured out the type of the uploaded file.
*/
Syslog('b', "File type is %s", arc);
/*
* MS-DOS executables are handled direct.
*/
if ((strcmp("EXE", arc) == 0) || (strcmp("COM", arc) == 0)) {
if (!ScanDirect(dp->d_name))
ImportFile(dp->d_name, Area, FALSE, iTime, statfile.st_size);
} else {
switch (ScanArchive(dp->d_name, arc)) {
case 0: ImportFile(dp->d_name, Area, TRUE, iTime, statfile.st_size);
break;
case 1: break;
case 2: break;
case 3: /*
* No valid unarchiver found, just import after scanning,
* may catch macro viri.
*/
if (!ScanDirect(dp->d_name))
ImportFile(dp->d_name, Area, FALSE, iTime, statfile.st_size);
break;
}
switch (ScanArchive(basename(tmpf->filename), arc)) {
case 0: ImportFile(tmpf->filename, Area, TRUE, tmpf->size);
break;
case 1: break;
case 2: break;
case 3: /*
* No valid unarchiver found, just import after scanning,
* may catch macro viri.
*/
if (!ScanDirect(basename(tmpf->filename)))
ImportFile(tmpf->filename, Area, FALSE, tmpf->size);
break;
}
}
}
}
closedir(dirp);
tidy_upload(&up);
free(temp);
Home();
SetFileArea(OldArea);
Pause();
@ -1168,7 +1107,7 @@ void List_Home()
*/
void Delete_Home()
{
char *temp, *temp1;
char *temp, *temp1, msg[81];
int i;
temp = calloc(PATH_MAX, sizeof(char));
@ -1198,8 +1137,8 @@ void Delete_Home()
if ((access(temp, R_OK)) == 0) {
Enter(1);
/* Delete file: */ /* Are you Sure? [Y/n]: */
sprintf(temp1, "%s %s, %s", (char *) Language(368), temp1, (char *) Language(369));
pout(LIGHTGREEN, BLACK, temp1);
sprintf(msg, "%s %s, %s", (char *) Language(368), temp1, (char *) Language(369));
pout(LIGHTGREEN, BLACK, msg);
i = toupper(Readkey());
if (i == Keystroke(369, 0) || i == 13) {
@ -1306,80 +1245,22 @@ int Download_Home()
*/
int Upload_Home()
{
DIR *dirp;
struct dirent *dp;
char *File, *sFileName, *temp, *arc;
time_t ElapstimeStart, ElapstimeFin, iTime;
int err;
struct stat statfile;
char *temp, *arc;
int rc = 0, Count = 0;
up_list *up = NULL, *tmpf;
WhosDoingWhat(UPLOAD, NULL);
if (!ForceProtocol())
return 0;
File = calloc(PATH_MAX, sizeof(char));
sFileName = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
clear();
Enter(2);
/* Please start your upload now ...*/
sprintf(temp, "%s, %s", sProtAdvice, (char *) Language(283));
pout(CFG.HiliteF, CFG.HiliteB, temp);
Enter(2);
Syslog('+', "Upload using %s", sProtName);
sprintf(temp, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
if (chdir(temp)) {
WriteError("$Can't chdir to %s", temp);
free(File);
free(sFileName);
free(temp);
return 0;
}
rc = upload(&up);
sleep(2);
ElapstimeStart = time(NULL);
/*
* Get the file(s). Set the Client/Server time to 2 hours.
* This is not a nice solution, at least it works and prevents
* that the bbs will hang.
*/
Altime(7200);
alarm_set(7190);
err = execute_str(sProtUp, (char *)"", NULL, NULL, NULL, NULL);
rawport();
if (err) {
/*
* Log any errors
*/
WriteError("$Upload error %d, prot: %s", err, sProtUp);
}
Altime(0);
alarm_off();
alarm_on();
Enter(3);
ElapstimeFin = time(NULL);
/*
* Get time from Before Upload and After Upload to get
* upload time, if the time is zero, it will be one.
*/
iTime = ElapstimeFin - ElapstimeStart;
if (!iTime)
iTime = 1;
Syslog('b', "Transfer time %ld", iTime);
if ((dirp = opendir(".")) == NULL) {
WriteError("$Upload: can't open ./upl");
if (rc) {
Syslog('+', "Upload home failed, rc=%d", rc);
Home();
free(File);
free(sFileName);
free(temp);
return 1;
}
@ -1388,60 +1269,60 @@ int Upload_Home()
pout(CFG.UnderlineColourF, CFG.UnderlineColourB, (char *)"Checking your upload(s)");
Enter(2);
while ((dp = readdir(dirp)) != NULL) {
for (tmpf = up; tmpf; tmpf = tmpf->next) {
sprintf(temp, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
chdir(temp);
if (*(dp->d_name) != '.') {
stat(dp->d_name, &statfile);
Syslog('+', "Uploaded \"%s\", %ld bytes", dp->d_name, statfile.st_size);
Syslog('b', "Checking upload %s", tmpf->filename);
if ((arc = GetFileType(tmpf->filename)) == NULL) {
/*
* If the filetype is unknown, it is probably
* a textfile or so. Import it direct.
*/
Syslog('b', "Unknown file type");
ImportHome(basename(tmpf->filename));
Count++;
} else {
/*
* We figured out the type of the uploaded file.
*/
Syslog('b', "File type is %s", arc);
if ((arc = GetFileType(dp->d_name)) == NULL) {
/*
* If the filetype is unknown, it is probably
* a textfile or so. Import it direct.
*/
Syslog('b', "Unknown file type");
ImportHome(dp->d_name);
/*
* MS-DOS executables are handled direct.
*/
if ((strcmp("EXE", arc) == 0) || (strcmp("COM", arc) == 0)) {
if (!ScanDirect(basename(tmpf->filename))) {
ImportHome(basename(tmpf->filename));
Count++;
}
} else {
/*
* We figured out the type of the uploaded file.
*/
Syslog('b', "File type is %s", arc);
/*
* MS-DOS executables are handled direct.
*/
if ((strcmp("EXE", arc) == 0) || (strcmp("COM", arc) == 0)) {
if (!ScanDirect(dp->d_name))
ImportHome(dp->d_name);
} else {
switch(ScanArchive(dp->d_name, arc)) {
case 0: ImportHome(dp->d_name);
break;
case 1: break;
case 2: break;
case 3: /*
* No valid unarchiver found, just import
*/
ImportHome(dp->d_name);
break;
}
switch(ScanArchive(basename(tmpf->filename), arc)) {
case 0: ImportHome(basename(tmpf->filename));
Count++;
break;
case 1: break;
case 2: break;
case 3: /*
* No valid unarchiver found, just import
*/
ImportHome(basename(tmpf->filename));
Count++;
break;
}
}
}
}
closedir(dirp);
Home();
ReadExitinfo();
exitinfo.Uploads++;
exitinfo.Uploads += Count;
WriteExitinfo();
tidy_upload(&up);
Pause();
free(File);
free(sFileName);
free(temp);
return 1;
return rc;
}

View File

@ -759,20 +759,20 @@ char *GetFileType(char *fn)
/*
* Import file in area. Returns TRUE if successfull.
*/
int ImportFile(char *fn, int Area, int fileid, time_t iTime, off_t Size)
int ImportFile(char *fn, int Area, int fileid, off_t Size)
{
char *temp, *temp1, msg[81];
temp = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/%s", area.Path, fn);
sprintf(temp1, "%s/%s/upl/%s", CFG.bbs_usersdir, exitinfo.Name, fn);
sprintf(temp, "%s/%s", area.Path, basename(fn));
sprintf(temp1, "%s", fn);
if ((file_mv(temp1, temp))) {
WriteError("$Can't move %s to %s", fn, area.Path);
} else {
chmod(temp, 0664);
if (Addfile(fn, Area, fileid)) {
if (Addfile(basename(fn), Area, fileid)) {
ReadExitinfo();
@ -794,13 +794,6 @@ int ImportFile(char *fn, int Area, int fileid, time_t iTime, off_t Size)
Syslog('b', "DownloadKToday %d", exitinfo.DownloadKToday);
}
iTime /= 60; /* Divide Seconds by 60 to give minutes */
/* You have */ /* extra minutes. */
sprintf(msg, "%s %ld %s", (char *) Language(249), iTime, (char *) Language(259));
PUTSTR(msg);
Enter(1);
exitinfo.iTimeLeft += iTime;
WriteExitinfo();
free(temp);
free(temp1);

View File

@ -20,7 +20,7 @@ char *GetFileType(char *);
void Home(void);
int ScanDirect(char *);
int ScanArchive(char *, char *);
int ImportFile(char *, int, int, time_t, off_t);
int ImportFile(char *, int, int, off_t);
unsigned long Quota(void);
void ImportHome(char *);

View File

@ -1011,10 +1011,10 @@ USHORT TOffline::TooOld (ULONG Restrict, class TMsgBase *Msg)
*/
void OLR_Upload(void)
{
char *File, *temp, *Arc, Dirpath[PATH_MAX], Filename[81], msg[81];
time_t ElapstimeStart, ElapstimeFin, iTime;
int err, RetVal = FALSE;
char *File, *temp, *Arc, Dirpath[PATH_MAX], Filename[81];
int rc = 0, RetVal = FALSE;
FILE *fp;
up_list *up = NULL, *tmpf;
if (strlen(CFG.bbsid) == 0) {
PUTSTR((char *)"System configuration error, inform sysop");
@ -1029,57 +1029,17 @@ void OLR_Upload(void)
/* Offline Reader Upload */
poutCR(LIGHTMAGENTA, BLACK, (char *)Language(439));
if (!ForceProtocol())
return;
File = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
Enter(1);
/* Please start your upload now */
sprintf(msg, "%s, %s", sProtAdvice, (char *) Language(283));
pout(CFG.HiliteF, CFG.HiliteB, msg);
Enter(2);
Syslog('+', "Upload using %s", sProtName);
sprintf(temp, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
if (chdir(temp)) {
WriteError("$Can't chdir to %s", temp);
if ((rc = upload(&up))) {
Syslog('+', "Upload failed, rc=%d", rc);
return;
}
sleep(2);
ElapstimeStart = time(NULL);
/*
* Get the file
*/
Altime(7200);
alarm_set(7190);
err = execute_str(sProtUp, (char *)"", NULL, NULL, NULL, NULL);
if (rawport() != 0) {
WriteError("Unable to set raw mode");
}
if (err) {
WriteError("$Upload error %d, prot: %s", err, sProtUp);
}
Altime(0);
alarm_off();
alarm_on();
Enter(1);
ElapstimeFin = time(NULL);
/*
* Get the upload time.
*/
iTime = ElapstimeFin - ElapstimeStart;
if (!iTime)
iTime = 1;
Syslog('m', "Transfer time %ld", iTime);
Home();
Enter(1);
sprintf(Dirpath, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
sprintf(Filename, "%s.NEW", CFG.bbsid);
@ -1097,12 +1057,18 @@ void OLR_Upload(void)
if (RetVal == FALSE) {
WriteError("Invalid OLR packed received");
for (tmpf = up; tmpf; tmpf = tmpf->next) {
Syslog('+', "Delete %s", tmpf->filename);
unlink(tmpf->filename);
}
tidy_upload(&up);
/* Invalid packet received */
pout(LIGHTRED, BLACK, (char *)Language(440));
Enter(2);
sleep(2);
sleep(3);
return;
}
tidy_upload(&up);
sprintf(File, "%s/%s", Dirpath, Filename);
Syslog('+', "Received OLR packet %s", File);
@ -1112,6 +1078,7 @@ void OLR_Upload(void)
poutCR(LIGHTRED, BLACK, (char *)Language(441));
Syslog('+', "Unknown compression type");
Pause();
unlink(File);
return;
}
@ -1134,6 +1101,7 @@ void OLR_Upload(void)
/* Archiver not available */
poutCR(LIGHTRED, BLACK, (char *)Language(442));
Pause();
unlink(File);
return;
}
@ -1147,11 +1115,11 @@ void OLR_Upload(void)
Syslog('m', "Unarc %s", temp);
colour(CFG.HiliteF, CFG.HiliteB);
err = execute_str(archiver.funarc, File, NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
rc = execute_str(archiver.funarc, File, NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
if (rawport() != 0) {
WriteError("Unable to set raw mode");
}
if (err) {
if (rc) {
WriteError("$Failed %s", temp);
/* ERROR */
poutCR(LIGHTRED, BLACK, (char *) Language(217));

View File

@ -349,14 +349,42 @@ int download(down_list *download_list)
void tidy_upload(up_list **fdp)
{
up_list *tmp, *old;
for (tmp = *fdp; tmp; tmp = old) {
old = tmp->next;
if (tmp->filename)
free(tmp->filename);
free(tmp);
}
*fdp = NULL;
return;
}
/*
* Upload files from the user.
* Returns:
* 0 - All seems well
* 1 - No transfer protocol selected.
* 2 - Transfer failed
*/
int upload(up_list *upload_list)
int upload(up_list **upload_list)
{
char *temp;
struct dirent *dp;
DIR *dirp;
struct stat statfile;
struct timeval starttime, endtime;
struct timezone tz;
unsigned long Size = 0;
int err, Count = 0, rc = 0;
up_list *tmp, *ta;
/*
* If user has no default protocol, make sure he has one.
*/
@ -364,7 +392,91 @@ int upload(up_list *upload_list)
return 1;
}
return 0;
temp = calloc(PATH_MAX, sizeof(char));
/* Please start your upload now */
sprintf(temp, "%s, %s", sProtAdvice, (char *) Language(283));
pout(CFG.HiliteF, CFG.HiliteB, temp);
Enter(2);
Syslog('+', "Upload using %s", sProtName);
sprintf(temp, "%s/%s/upl", CFG.bbs_usersdir, exitinfo.Name);
if (chdir(temp)) {
WriteError("$Can't chdir to %s", temp);
free(temp);
return 1;
}
sleep(2);
if (uProtInternal) {
} else {
/*
* External protocol
*/
gettimeofday(&starttime, &tz);
Altime(7200);
alarm_set(7190);
err = execute_str(sProtUp, (char *)"", NULL, NULL, NULL, NULL);
if (rawport() != 0) {
WriteError("Unable to set raw mode");
}
if (err) {
WriteError("$Upload error %d, prot: %s", err, sProtUp);
rc = 2;
}
Altime(0);
alarm_off();
alarm_on();
gettimeofday(&endtime, &tz);
/*
* With external protocols we don't know anything about what we got.
* Just check the files in the users upload directory.
*/
if ((dirp = opendir(".")) == NULL) {
WriteError("$Upload: can't open ./upl");
Home();
rc = 1;
} else {
while ((dp = readdir(dirp)) != NULL) {
if (*(dp->d_name) != '.') {
stat(dp->d_name, &statfile);
Syslog('+', "Uploaded \"%s\", %ld bytes", dp->d_name, statfile.st_size);
Count++;
Size += statfile.st_size;
sprintf(temp, "%s/%s/upl/%s", CFG.bbs_usersdir, exitinfo.Name, dp->d_name);
chmod(temp, 0660);
/*
* Add uploaded file to the list
*/
tmp = (up_list *)malloc(sizeof(up_list));
tmp->next = NULL;
tmp->filename = xstrcpy(temp);
tmp->size = Size;
if (*upload_list == NULL) {
*upload_list = tmp;
} else {
for (ta = *upload_list; ta; ta = ta->next) {
if (ta->next == NULL) {
ta->next = (up_list *)tmp;
break;
}
}
}
}
}
closedir(dirp);
Syslog('+', "Upload %s in %d file(s)", transfertime(starttime, endtime, (unsigned long)Size, FALSE), Count);
}
}
free(temp);
return rc;
}

View File

@ -27,18 +27,17 @@ typedef struct _down_list {
*/
typedef struct _up_list {
struct _up_list *next;
char *remote; /* Remote filename */
char *local; /* Local filename */
long cps; /* CPS after received */
unsigned success : 1; /* If received Ok. */
char *filename; /* Filename */
unsigned long size; /* Filesize */
} up_list;
int ForceProtocol(void);
void add_download(down_list **, char *, char *, long, unsigned long, int);
void tidy_download(down_list **);
int download(down_list *);
int upload(up_list *);
int ForceProtocol(void);
void add_download(down_list **, char *, char *, long, unsigned long, int);
void tidy_download(down_list **);
int download(down_list *);
void tidy_upload(up_list **);
int upload(up_list **);
#endif