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
Showing
3 changed files
with
20 additions
and
17 deletions
... | @@ -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; |
... | @@ -170,7 +171,7 @@ cli_attach_fd (struct mu_parseopt *po, struct mu_option *opt, char const *arg) | ... | @@ -170,7 +171,7 @@ cli_attach_fd (struct mu_parseopt *po, struct mu_option *opt, char const *arg) |
170 | 171 | ||
171 | send_attach_file (fd, NULL, content_filename, content_name, | 172 | send_attach_file (fd, NULL, content_filename, content_name, |
172 | default_content_type, default_encoding); | 173 | default_content_type, default_encoding); |
173 | 174 | ||
174 | free (content_name); | 175 | free (content_name); |
175 | content_name = NULL; | 176 | content_name = NULL; |
176 | free (content_filename); | 177 | free (content_filename); | ... | ... |
... | @@ -263,11 +263,11 @@ extern char *mail_expand_name (const char *name); | ... | @@ -263,11 +263,11 @@ 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, |
270 | const char *content_type, const char *encoding); | 270 | const char *content_type, const char *encoding); |
271 | 271 | ||
272 | extern int escape_check_args (int argc, char **argv, int minargs, int maxargs); | 272 | extern int escape_check_args (int argc, char **argv, int minargs, int maxargs); |
273 | 273 | ... | ... |
... | @@ -324,19 +324,19 @@ attlist_copy (mu_list_t src) | ... | @@ -324,19 +324,19 @@ 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, |
337 | content_name, | 337 | content_name, |
338 | content_type, | 338 | content_type, |
339 | encoding); | 339 | encoding); |
340 | } | 340 | } |
341 | 341 | ||
342 | static void | 342 | static void |
... | @@ -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); | ... | ... |
-
Please register or sign in to post a comment