- snprintf(mbuf2, sizeof mbuf2, "%s.MIME", partnum);
-
- if (!strcasecmp(desired_section, mbuf2)) {
- cprintf("Content-type: %s", cbtype);
- if (strlen(cbcharset) > 0)
- cprintf("; charset=\"%s\"", cbcharset);
- if (strlen(name) > 0)
- cprintf("; name=\"%s\"", name);
- cprintf("\r\n");
- if (strlen(encoding) > 0)
- cprintf("Content-Transfer-Encoding: %s\r\n", encoding);
- if (strlen(encoding) > 0) {
- cprintf("Content-Disposition: %s", disp);
- if (strlen(filename) > 0) {
- cprintf("; filename=\"%s\"", filename);
+ snprintf(mimebuf2, sizeof mimebuf2, "%s.MIME", partnum);
+
+ if (!strcasecmp(ChrPtr(desired_section), mimebuf2)) {
+ client_write(HKEY("Content-type: "));
+ client_write(cbtype, strlen(cbtype));
+ if (!IsEmptyStr(cbcharset)) {
+ client_write(HKEY("; charset=\""));
+ client_write(cbcharset, strlen(cbcharset));
+ client_write(HKEY("\""));
+ }
+ if (!IsEmptyStr(name)) {
+ client_write(HKEY("; name=\""));
+ client_write(name, strlen(name));
+ client_write(HKEY("\""));
+ }
+ client_write(HKEY("\r\n"));
+ if (!IsEmptyStr(encoding)) {
+ client_write(HKEY("Content-Transfer-Encoding: "));
+ client_write(encoding, strlen(encoding));
+ client_write(HKEY("\r\n"));
+ }
+ if (!IsEmptyStr(encoding)) {
+ client_write(HKEY("Content-Disposition: "));
+ client_write(disp, strlen(disp));
+
+ if (!IsEmptyStr(filename)) {
+ client_write(HKEY("; filename=\""));
+ client_write(filename, strlen(filename));
+ client_write(HKEY("\""));