move struct uploaded_file to webcit.h
authorArt Cancro <ajc@citadel.org>
Tue, 10 Oct 2023 22:56:09 +0000 (18:56 -0400)
committerArt Cancro <ajc@citadel.org>
Tue, 10 Oct 2023 22:56:09 +0000 (18:56 -0400)
.gitignore
webcit-ng/server/upload.c
webcit-ng/server/webcit.h
webcit-ng/static/js/upload.js

index 76aa018d4bab391798418dad2b0b523f37a18382..bd6ec4f6d7aa84a041403a81171f03f4ad2aed0a 100644 (file)
@@ -1,5 +1,4 @@
 *.dsc
-*.dsc
 *.changes
 *.deb
 *.tar.gz
@@ -10,3 +9,4 @@ tmp
 webcit_*
 citadel_*
 libcitadel_*
+.vscode
index 17d96a9a31f1314ded2605e019a9f1ee2bfe5448..110241c3c5c23268699b3fc5e8d6dfe5af6bfd6b 100644 (file)
@@ -7,14 +7,6 @@
 
 #include "webcit.h"
 
-struct uploaded_file {
-       char id[64];
-       char filename[256];
-       char content_type[256];
-       long length;
-       FILE *fp;
-};
-
 Array *upload_list = NULL;                                     // all files uploaded to this webcit instance
 pthread_mutex_t upload_list_mutex = PTHREAD_MUTEX_INITIALIZER; // Lock it before modifying
 
@@ -106,8 +98,8 @@ void ctdl_p_base(struct http_transaction *h, struct ctdlsession *c) {
 }
 
 
-// DAV delete an uploaded item
-void dav_delete_upload(struct http_transaction *h, struct ctdlsession *c, struct uploaded_file this_one) {
+// delete an uploaded item
+void delete_upload(struct uploaded_file this_one) {
        int i;
        struct uploaded_file *u;
 
@@ -121,7 +113,12 @@ void dav_delete_upload(struct http_transaction *h, struct ctdlsession *c, struct
                }
        }
        pthread_mutex_unlock(&upload_list_mutex);
+}
 
+
+// DAV delete an uploaded item
+void dav_delete_upload(struct http_transaction *h, struct ctdlsession *c, struct uploaded_file this_one) {
+       delete_upload(this_one);
        do_204(h);
 }
 
@@ -187,4 +184,4 @@ void ctdl_p(struct http_transaction *h, struct ctdlsession *c) {
 
        // If we get to this point, the client requested an action we don't know how to perform.
        do_404(h);
-}
\ No newline at end of file
+}
index a52ac59930bf530a3e5beef8bc0397c40c9007db..64368b0e5c6169bb206a77d0f8b2e53c6c26522b 100644 (file)
@@ -95,6 +95,14 @@ struct ctdlsession {
        time_t room_mtime;                      // Timestampt of the most recent write activity in this room
 };
 
+struct uploaded_file {                         // things that have been uploaded to the server (such as email attachments)
+       char id[64];
+       char filename[256];
+       char content_type[256];
+       long length;
+       FILE *fp;
+};
+
 extern char *ssl_cipher_list;
 extern int is_https;                           // nonzero if we are an HTTPS server today
 extern char *ctdl_dir;                         // directory where Citadel Server is running
index c253471e1cb234b1da6b269ddd471c838dd38de7..28c374edb114302bb8c3217ae21d3b96cbe44e57 100644 (file)
@@ -145,6 +145,10 @@ function show_or_hide_upload_window() {
 // Flush all uploaded files and close the window
 function flush_uploads() {
         document.getElementById('ctdl-upload').style.display='none';
+
         // FIXME tell the server to delete the files
+       uploads.forEach(u => {
+               console.log(u.ref);
+       });
         uploads=[];
 }