summaryrefslogtreecommitdiffstats
path: root/handler.c
diff options
context:
space:
mode:
authorRocco Rutte <pdmef@gmx.net>2009-05-31 10:40:23 +0200
committerRocco Rutte <pdmef@gmx.net>2009-05-31 10:40:23 +0200
commit27928c1e70d8a5168e685a939149257343ca39d6 (patch)
treed4130da4201142d4000b4e732c10541814d52dac /handler.c
parentfc05a64e01633a3436f33fa20292490daa3a948b (diff)
Add $honor_disposition to not display attachments inline. Closes #3170.
Previously all MIME parts were displayed inline regardless of the Content-Disposition header (if present). With $honor_disposition set, only inline parts are displayed inline, attachments can only be viewed from the attachments menu.
Diffstat (limited to 'handler.c')
-rw-r--r--handler.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/handler.c b/handler.c
index c3572bd3..a4c27ad0 100644
--- a/handler.c
+++ b/handler.c
@@ -1592,8 +1592,11 @@ int mutt_body_handler (BODY *b, STATE *s)
handler = crypt_smime_application_smime_handler;
}
-
- if (plaintext || handler)
+ /* only respect disposition == attachment if we're not
+ displaying from the attachment menu (i.e. pager) */
+ if ((!option (OPTHONORDISP) || (b->disposition != DISPATTACH ||
+ option(OPTVIEWATTACH))) &&
+ (plaintext || handler))
{
fseeko (s->fpin, b->offset, 0);
@@ -1680,10 +1683,18 @@ int mutt_body_handler (BODY *b, STATE *s)
}
s->flags |= M_FIRSTDONE;
}
- else if (s->flags & M_DISPLAY)
+ /* print hint to use attachment menu for disposition == attachment
+ if we're not already being called from there */
+ else if ((s->flags & M_DISPLAY) || (b->disposition == DISPATTACH &&
+ !option (OPTVIEWATTACH) &&
+ option (OPTHONORDISP) &&
+ (plaintext || handler)))
{
state_mark_attach (s);
- state_printf (s, _("[-- %s/%s is unsupported "), TYPE (b), b->subtype);
+ if (option (OPTHONORDISP) && b->disposition == DISPATTACH)
+ fputs (_("[-- This is an attachment "), s->fpout);
+ else
+ state_printf (s, _("[-- %s/%s is unsupported "), TYPE (b), b->subtype);
if (!option (OPTVIEWATTACH))
{
if (km_expand_key (type, sizeof(type),