From: Art Cancro Date: Wed, 11 Oct 2023 22:55:08 +0000 (-0400) Subject: messages.c: inching towards saving the attachments X-Git-Tag: v997~117 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=9e99938c31d779fb37e7f5ebc6745b92131581d8 messages.c: inching towards saving the attachments --- diff --git a/webcit-ng/server/messages.c b/webcit-ng/server/messages.c index 7c111863c..ef244aab0 100644 --- a/webcit-ng/server/messages.c +++ b/webcit-ng/server/messages.c @@ -186,12 +186,6 @@ void dav_put_message(struct http_transaction *h, struct ctdlsession *c, char *eu char *mailbcc = get_url_param(h, "mailbcc"); // Bcc: if (!mailbcc) mailbcc = ""; - // If there are attachments, we have to merge them into the message text. - char *att = get_url_param(h, "att"); - if (att) { - syslog(LOG_DEBUG, "💥 There are attachments. Going multipart/mixed. <%s>", att); - } - // Mode 4 will give us metadata back after upload ctdl_printf(c, "ENT0 1|%s||4|%s||1|%s|%s|||%s|", mailto, subj, mailcc, mailbcc, wefw); ctdl_readline(c, buf, sizeof buf); @@ -207,8 +201,8 @@ void dav_put_message(struct http_transaction *h, struct ctdlsession *c, char *eu // Remember, ctdl_printf() appends \n on its own, so when adding a CRLF newline, only use \r // Or for a blank line, use ctdl_write() with \r\n - // If there are attachments, open up a multipart/mixed MIME container. + char *att = get_url_param(h, "att"); if (att) { snprintf(mime_boundary, sizeof(mime_boundary), "citadel-multipart-%x-%x", time(NULL), rand()); ctdl_printf(c, "MIME-Version: 1.0\r"); @@ -227,9 +221,20 @@ void dav_put_message(struct http_transaction *h, struct ctdlsession *c, char *eu ctdl_write(c, HKEY("\r\n")); } - // If there are attachments, close the multipart/mixed MIME container. + // If there are attachments, add them now. if (att) { - // FIXME actually attach the attachments here. + int i; + char attid[10]; + struct uploaded_file one_att; + int num_attachments = num_tokens(att, ','); + + for (i=0; i