]> code.citadel.org Git - citadel.git/blobdiff - citadel/file_ops.c
* Added some temporary variables to OpenCmdResult(). Hopefully fixes
[citadel.git] / citadel / file_ops.c
index 6dfccb4e239ffe92983297b94a81f9ffb247add0..9c121825bc5ab1959f1a66f1f6f4beaf9d4cb826 100644 (file)
@@ -10,9 +10,6 @@
 #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"
@@ -234,11 +231,16 @@ void cmd_netf(char *cmdbuf)
  */
 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);
+}
 
 
 /*
@@ -528,7 +530,7 @@ void cmd_ucls(char *cmd)
        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;
@@ -536,9 +538,17 @@ void cmd_ucls(char *cmd)
        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");
@@ -546,7 +556,7 @@ void cmd_ucls(char *cmd)
                if (fp!=NULL) {
                        fprintf(fp,"%s %s\n",CC->upl_file,CC->upl_comment);
                        fclose(fp);
-                       }
+               }
 
                /* put together an upload notice */
                sprintf(upload_notice,
@@ -554,12 +564,14 @@ void cmd_ucls(char *cmd)
                        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