view_mail.js: don't list attachments in a quote or forward
authorArt Cancro <ajc@citadel.org>
Thu, 14 Dec 2023 15:29:02 +0000 (10:29 -0500)
committerArt Cancro <ajc@citadel.org>
Thu, 14 Dec 2023 15:29:02 +0000 (10:29 -0500)
webcit-ng/server/upload.c
webcit-ng/static/js/view_mail.js

index 3c40d9fed412857f6fe863679be5caeeda8cb661..f917f9a495f642f38b83a8b24bb9ced3ffe0da20 100644 (file)
@@ -24,6 +24,11 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
        }
        u.id[sizeof(u.id)-1] = 0;
 
+       syslog(LOG_DEBUG,
+               "upload_handler: name=%s, filename=%s, partnum=%s, disp=%s, cbtype=%s, cbcharset=%s, length=%ld, encoding=%s, cbid=%s",
+               name, filename, partnum, disp, cbtype, cbcharset, length, encoding, cbid
+       );
+
        safestrncpy(u.filename, filename, sizeof(u.filename));
        safestrncpy(u.content_type, cbtype, sizeof(u.content_type));
        u.length = length;
@@ -65,6 +70,7 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
        JsonArrayAppend(j_uploads, j_one_upload);
 }
 
+
 // upload handler
 void upload_files(struct http_transaction *h, struct ctdlsession *c) {
        // FIXME reject uploads if we're not logged in
@@ -150,6 +156,21 @@ struct uploaded_file pop_upload(char *id) {
 // so the attachments don't have to be sent out to the browser and back.
 void load_attachments_from_message(struct http_transaction *h, struct ctdlsession *c, char *name) {
        syslog(LOG_DEBUG, "\033[33mload_attachments_from_message: method is \033[35m%s\033[33m, name is \033[33m%s\033[0m", h->method, name);
+
+       char buf[1024];
+       StrBuf *Body = NULL;
+
+       ctdl_printf(c, "MSG2 %ld", atol(name));
+       ctdl_readline(c, buf, sizeof buf);
+       if (buf[0] != '1') {
+               do_404(h);
+               return;
+       }
+
+       while (ctdl_readline(c, buf, sizeof buf), strcmp(buf, "000")) {
+               // do something
+       }
+
        do_405(h);
 }
 
index 6d6fbcf45f1a8103f7c24b12e5a9546452f39139..4e7635f041b980e5293a83d36ccf5b8ab20be1b3 100644 (file)
@@ -216,8 +216,8 @@ function mail_render_one(msgnum, msg, target_div, include_controls) {
                          "</div>";                                             // end header
                }
 
-               // Display attachments, if any are present
-               if (msg.part) {
+               // Display attachments, if any are present (don't do this if we're quoting the message)
+               if ( (msg.part) && (include_controls) ) {
                        let display_attachments = 0;
                        for (let r=0; r<msg.part.length; ++r) {
                                if (msg.part[r].disp == "attachment") {