Commit ff1a8a6e ff1a8a6e673923ab9407815155834971f1f2235f by Sergey Poznyakoff

Minor changes

* mail/mail.c (cli_attach): Exit if unable to attach file.
* mail/mail.h (send_attach_file): Change prototype.
* mail/send.c (send_attach_file): Return int.
(add_body): Honor default_content_type
1 parent a72570a2
......@@ -146,8 +146,9 @@ cli_attach (struct mu_parseopt *po, struct mu_option *opt, char const *arg)
arg = NULL;
fd = 0;
}
send_attach_file (fd, arg, content_filename, content_name,
default_content_type, default_encoding);
if (send_attach_file (fd, arg, content_filename, content_name,
default_content_type, default_encoding))
exit (po->po_exit_error);
free (content_name);
content_name = NULL;
......
......@@ -263,7 +263,7 @@ extern char *mail_expand_name (const char *name);
extern void send_append_header (char const *text);
extern void send_append_header2 (char const *name, char const *value, int mode);
extern void send_attach_file (int fd,
extern int send_attach_file (int fd,
const char *filename,
const char *content_filename,
const char *content_name,
......
......@@ -324,13 +324,13 @@ attlist_copy (mu_list_t src)
static mu_list_t attachment_list;
void
int
send_attach_file (int fd,
const char *realname,
const char *content_filename, const char *content_name,
const char *content_type, const char *encoding)
{
attlist_attach_file (&attachment_list,
return attlist_attach_file (&attachment_list,
fd,
realname,
content_filename,
......@@ -561,7 +561,9 @@ add_body (mu_message_t inmsg, mu_iterator_t itr, mu_mime_t mime)
}
/* 4. Add the content type and content ID headers. */
mu_header_set_value (outhdr, MU_HEADER_CONTENT_TYPE, "text/plain", 0);
mu_header_set_value (outhdr, MU_HEADER_CONTENT_TYPE,
default_content_type ? default_content_type : "text/plain",
0);
mu_rfc2822_msg_id (0, &p);
mu_header_set_value (outhdr, MU_HEADER_CONTENT_ID, p, 1);
free (p);
......