diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1998-11-18 22:56:57 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1998-11-18 22:56:57 +0000 |
commit | b226bc2cc5db75b72c08042b95977c28b9ef2322 (patch) | |
tree | e6a594d7eca4356caee700156546ebd26c508433 /compose.c | |
parent | 98df548e97d14a9f6ba75e7c4cea7cbfbf389cef (diff) |
This patch simplifies the generation of content type parameters
significantly by introducing a funciton mutt_set_parameter().
Additionally, we re-use code from parse.c for parsing user-input
content type headers on the compose screen.
Diffstat (limited to 'compose.c')
-rw-r--r-- | compose.c | 31 |
1 files changed, 19 insertions, 12 deletions
@@ -720,19 +720,26 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ idx[menu->current]->content->subtype); if (mutt_get_field ("Content-Type: ", buf, sizeof (buf), 0) == 0 && buf[0]) { - char *p = strchr (buf, '/'); + char *s; + PARAMETER *par; + BODY *b; + + b = idx[menu->current]->content; + + s = b->filename; par = b->parameter; + b->filename = NULL; b->parameter = NULL; + + mutt_parse_content_type(buf, b); - if (p) - { - *p++ = 0; - if ((i = mutt_check_mime_type (buf)) != TYPEOTHER) - { - idx[menu->current]->content->type = i; - safe_free ((void **) &idx[menu->current]->content->subtype); - idx[menu->current]->content->subtype = safe_strdup (p); - menu->redraw = REDRAW_CURRENT; - } - } + safe_free((void **) &b->filename); + b->filename =s; + + if ((s = mutt_get_parameter("charset", b->parameter))) + mutt_set_parameter("charset", s, &par); + + /* ignore the other parameters for now */ + mutt_free_parameter(&b->parameter); + b->parameter = par; } break; |