projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b5235ed
)
upload_attachment : add possibility to switch reply to template.
author
Wilfried Goesgens
<dothebart@citadel.org>
Tue, 21 Jan 2014 20:24:26 +0000
(21:24 +0100)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 26 Jan 2014 16:52:55 +0000
(17:52 +0100)
webcit/messages.c
patch
|
blob
|
history
diff --git
a/webcit/messages.c
b/webcit/messages.c
index ebc4e41f8ff25ab96600991edf6bc49b5e8d3f4c..ce9bc9fa8bd102a7502ec8e59fa7b16905d822c3 100644
(file)
--- a/
webcit/messages.c
+++ b/
webcit/messages.c
@@
-1219,19
+1219,31
@@
void upload_attachment(void) {
long newnlen;
void *v;
wc_mime_attachment *att;
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");
syslog(LOG_DEBUG, "upload_attachment()\n");
- wc_printf("upload_attachment()<br>\n");
+
if (!Tmpl)
wc_printf("upload_attachment()<br>\n");
if (WCC->upload_length <= 0) {
syslog(LOG_DEBUG, "ERROR no attachment was uploaded\n");
if (WCC->upload_length <= 0) {
syslog(LOG_DEBUG, "ERROR no attachment was uploaded\n");
- wc_printf("ERROR no attachment was uploaded<br>\n");
+ if (Tmpl)
+ {
+ putlbstr("UPLOAD_ERROR", 1);
+ MimeType = DoTemplate(SKEY(Tmpl), NULL, &NoCtx);
+ }
+ else wc_printf("ERROR no attachment was uploaded<br>\n");
+ http_transmit_thing(ChrPtr(MimeType), 0);
+
return;
}
syslog(LOG_DEBUG, "Client is uploading %d bytes\n", WCC->upload_length);
return;
}
syslog(LOG_DEBUG, "Client is uploading %d bytes\n", WCC->upload_length);
- wc_printf("Client is uploading %d bytes<br>\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<br>\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);
memset(att, 0, sizeof(wc_mime_attachment ));
att->length = WCC->upload_length;
att->ContentType = NewStrBufPlain(WCC->upload_content_type, -1);
@@
-1271,6
+1283,9
@@
void upload_attachment(void) {
att->Data = WCC->upload;
WCC->upload = NULL;
WCC->upload_length = 0;
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);
}
}