X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=sendlib.c;h=2c5611a629cc251d7dd534065299c4402bd6fc59;hp=e5bb57fb5da668f4d0799398575aa77831fc2685;hb=c8c9a616c8c369da6aa06e656eacfb82af8707a8;hpb=a742b680bdba8cb47d2b81ab3397cdbec7ed5b69 diff --git a/sendlib.c b/sendlib.c index e5bb57f..2c5611a 100644 --- a/sendlib.c +++ b/sendlib.c @@ -364,8 +364,6 @@ int mutt_write_mime_header (BODY * a, FILE * f) return (ferror (f) ? -1 : 0); } -# define write_as_text_part(a) (mutt_is_text_part(a) || mutt_is_application_pgp(a)) - int mutt_write_mime_body (BODY * a, FILE * f) { const char *p; @@ -414,6 +412,7 @@ int mutt_write_mime_body (BODY * a, FILE * f) else fc = fgetconv_open (fpin, 0, 0, 0); +#define write_as_text_part(a) (mutt_is_text_part(a) || mutt_is_application_pgp(a)) if (a->encoding == ENCQUOTEDPRINTABLE) encode_quoted (fc, f, write_as_text_part (a)); else if (a->encoding == ENCBASE64) @@ -422,6 +421,7 @@ int mutt_write_mime_body (BODY * a, FILE * f) encode_8bit (fc, f, write_as_text_part (a)); else mutt_copy_stream (fpin, f); +#undef write_as_text_part fgetconv_close (&fc); fclose (fpin); @@ -429,8 +429,6 @@ int mutt_write_mime_body (BODY * a, FILE * f) return (ferror (f) ? -1 : 0); } -#undef write_as_text_part - typedef struct { int from; int whitespace; @@ -1095,22 +1093,16 @@ void mutt_stamp_attachment (BODY * a) /* Get a body's character set */ -char *mutt_get_body_charset (char *d, ssize_t dlen, BODY * b) +char *mutt_get_body_charset(char *d, ssize_t dlen, BODY * b) { - const char *p = NULL; - - if (b && b->type != TYPETEXT) - return NULL; - - if (b) - p = parameter_getval(b->parameter, "charset"); + const char *p; - if (p) - charset_canonicalize (d, dlen, p); - else - m_strcpy(d, dlen, "us-ascii"); + if (b && b->type != TYPETEXT) + return NULL; - return d; + p = b ? parameter_getval(b->parameter, "charset") : NULL; + charset_canonicalize(d, dlen, p); + return d; } @@ -1223,23 +1215,8 @@ BODY *mutt_make_file_attach (const char *path) /* Attempt to determine the appropriate content-type based on the filename * suffix. */ - -#if 0 - - if ((n = - mutt_lookup_mime_type (buf, sizeof (buf), xbuf, sizeof (xbuf), - path)) != TYPEOTHER || *xbuf != '\0') { - att->type = n; - att->subtype = m_strdup(buf); - att->xtype = m_strdup(xbuf); - } - -#else - mutt_lookup_mime_type (att, path); -#endif - if ((info = mutt_get_content_info (path, att)) == NULL) { body_list_wipe(&att); return NULL; @@ -1254,15 +1231,14 @@ BODY *mutt_make_file_attach (const char *path) */ att->type = TYPETEXT; att->subtype = m_strdup("plain"); - } - else { + } else { att->type = TYPEAPPLICATION; att->subtype = m_strdup("octet-stream"); } } mutt_update_encoding (att); - return (att); + return att; } static int get_toplevel_encoding (BODY * a)