#include <sys/stat.h>
#include <time.h>
#include <limits.h>
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-#endif
#include "citadel.h"
#include "server.h"
#include "config.h"
*/
void OpenCmdResult(char *filename, char *mime_type) {
struct stat statbuf;
+ time_t modtime;
+ long filesize;
fstat(fileno(CC->download_fp), &statbuf);
- cprintf("%d %ld|%ld|%s|%s\n", OK, statbuf.st_size, statbuf.st_mtime,
- filename, mime_type);
- }
+ filesize = (long) statbuf.st_size;
+ modtime = (time_t) statbuf.st_mtime;
+
+ cprintf("%d %ld|%ld|%s|%s\n",
+ OK, filesize, modtime, filename, mime_type);
+}
/*
if (CC->upload_fp == NULL) {
cprintf("%d You don't have an upload file open.\n",ERROR);
return;
- }
+ }
fclose(CC->upload_fp);
CC->upload_fp = NULL;
if ((!strcasecmp(cmd,"1")) && (CC->upload_type != UPL_FILE)) {
CC->upload_type = UPL_FILE;
cprintf("%d Upload completed.\n", OK);
- return;
+
+ if (CC->upload_type == UPL_NET) {
+ if (fork()==0) {
+ execlp("./netproc", "netproc", "-i", NULL);
+ exit(errno);
+ }
}
+ return;
+ }
+
if (!strcasecmp(cmd,"1")) {
cprintf("%d File '%s' saved.\n",OK,CC->upl_path);
fp = fopen(CC->upl_filedir,"a");
if (fp!=NULL) {
fprintf(fp,"%s %s\n",CC->upl_file,CC->upl_comment);
fclose(fp);
- }
+ }
/* put together an upload notice */
sprintf(upload_notice,
CC->upl_file,CC->upl_comment);
quickie_message(CC->curr_user, NULL, CC->quickroom.QRname,
upload_notice);
- }
+ }
else {
abort_upl(CC);
cprintf("%d File '%s' aborted.\n",OK,CC->upl_path);
- }
}
+}
+
+
/*
* read from the download file