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) ...@@ -146,8 +146,9 @@ cli_attach (struct mu_parseopt *po, struct mu_option *opt, char const *arg)
146 arg = NULL; 146 arg = NULL;
147 fd = 0; 147 fd = 0;
148 } 148 }
149 send_attach_file (fd, arg, content_filename, content_name, 149 if (send_attach_file (fd, arg, content_filename, content_name,
150 default_content_type, default_encoding); 150 default_content_type, default_encoding))
151 exit (po->po_exit_error);
151 152
152 free (content_name); 153 free (content_name);
153 content_name = NULL; 154 content_name = NULL;
......
...@@ -263,7 +263,7 @@ extern char *mail_expand_name (const char *name); ...@@ -263,7 +263,7 @@ extern char *mail_expand_name (const char *name);
263 263
264 extern void send_append_header (char const *text); 264 extern void send_append_header (char const *text);
265 extern void send_append_header2 (char const *name, char const *value, int mode); 265 extern void send_append_header2 (char const *name, char const *value, int mode);
266 extern void send_attach_file (int fd, 266 extern int send_attach_file (int fd,
267 const char *filename, 267 const char *filename,
268 const char *content_filename, 268 const char *content_filename,
269 const char *content_name, 269 const char *content_name,
......
...@@ -324,13 +324,13 @@ attlist_copy (mu_list_t src) ...@@ -324,13 +324,13 @@ attlist_copy (mu_list_t src)
324 324
325 static mu_list_t attachment_list; 325 static mu_list_t attachment_list;
326 326
327 void 327 int
328 send_attach_file (int fd, 328 send_attach_file (int fd,
329 const char *realname, 329 const char *realname,
330 const char *content_filename, const char *content_name, 330 const char *content_filename, const char *content_name,
331 const char *content_type, const char *encoding) 331 const char *content_type, const char *encoding)
332 { 332 {
333 attlist_attach_file (&attachment_list, 333 return attlist_attach_file (&attachment_list,
334 fd, 334 fd,
335 realname, 335 realname,
336 content_filename, 336 content_filename,
...@@ -561,7 +561,9 @@ add_body (mu_message_t inmsg, mu_iterator_t itr, mu_mime_t mime) ...@@ -561,7 +561,9 @@ add_body (mu_message_t inmsg, mu_iterator_t itr, mu_mime_t mime)
561 } 561 }
562 562
563 /* 4. Add the content type and content ID headers. */ 563 /* 4. Add the content type and content ID headers. */
564 mu_header_set_value (outhdr, MU_HEADER_CONTENT_TYPE, "text/plain", 0); 564 mu_header_set_value (outhdr, MU_HEADER_CONTENT_TYPE,
565 default_content_type ? default_content_type : "text/plain",
566 0);
565 mu_rfc2822_msg_id (0, &p); 567 mu_rfc2822_msg_id (0, &p);
566 mu_header_set_value (outhdr, MU_HEADER_CONTENT_ID, p, 1); 568 mu_header_set_value (outhdr, MU_HEADER_CONTENT_ID, p, 1);
567 free (p); 569 free (p);
......