X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=webcit%2Fmessages.c;fp=webcit%2Fmessages.c;h=29fd30559e90dc02a327ae77606403d947b72342;hp=9f9f9730f7b9bd291fc06ab85c192b98cadd434b;hb=9809dad64dd0b76de940b873215ad8b19db6bbb9;hpb=e2c97f4b0f5420b21f491d6e61dca580f8772d39 diff --git a/webcit/messages.c b/webcit/messages.c index 9f9f9730f..29fd30559 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -1232,19 +1232,31 @@ void upload_attachment(void) { long newnlen; void *v; wc_mime_attachment *att; + const StrBuf *Tmpl = sbstr("template"); + const StrBuf *MimeType = NULL; + begin_burst(); syslog(LOG_DEBUG, "upload_attachment()\n"); - wc_printf("upload_attachment()
\n"); + if (!Tmpl) wc_printf("upload_attachment()
\n"); if (WCC->upload_length <= 0) { syslog(LOG_DEBUG, "ERROR no attachment was uploaded\n"); - wc_printf("ERROR no attachment was uploaded
\n"); + if (Tmpl) + { + putlbstr("UPLOAD_ERROR", 1); + MimeType = DoTemplate(SKEY(Tmpl), NULL, &NoCtx); + } + else wc_printf("ERROR no attachment was uploaded
\n"); + http_transmit_thing(ChrPtr(MimeType), 0); + return; } syslog(LOG_DEBUG, "Client is uploading %d bytes\n", WCC->upload_length); - wc_printf("Client is uploading %d bytes
\n", WCC->upload_length); - att = malloc(sizeof(wc_mime_attachment)); + if (Tmpl) putlbstr("UPLOAD_LENGTH", WCC->upload_length); + else wc_printf("Client is uploading %d bytes
\n", WCC->upload_length); + + att = (wc_mime_attachment*)malloc(sizeof(wc_mime_attachment)); memset(att, 0, sizeof(wc_mime_attachment )); att->length = WCC->upload_length; att->ContentType = NewStrBufPlain(WCC->upload_content_type, -1); @@ -1284,6 +1296,9 @@ void upload_attachment(void) { att->Data = WCC->upload; WCC->upload = NULL; WCC->upload_length = 0; + + if (Tmpl) MimeType = DoTemplate(SKEY(Tmpl), NULL, &NoCtx); + http_transmit_thing(ChrPtr(MimeType), 0); }