summaryrefslogtreecommitdiffstats
path: root/attach.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-01-07 10:45:47 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-01-07 10:45:47 +0000
commitd084dc02709698b298f191947cbb42bb283250a0 (patch)
treece6107b9134d2717a1298f67c6ba9dc6a2b78255 /attach.c
parent246198ae90539dd2429032c1620044dde3d5176e (diff)
Updated implicit autoview handling from stable.
Diffstat (limited to 'attach.c')
-rw-r--r--attach.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/attach.c b/attach.c
index 14171704..a7dffddb 100644
--- a/attach.c
+++ b/attach.c
@@ -320,25 +320,34 @@ static int is_mmnoask (const char *buf)
return (0);
}
-int mutt_is_autoview (char *type)
+int mutt_is_autoview (BODY *b, const char *type)
{
LIST *t = AutoViewList;
+ char _type[SHORT_STRING];
int i;
- if (option (OPTIMPLICITAUTOVIEW))
- return 1;
+ if (!type)
+ {
+ snprintf (_type, sizeof (_type), "%s/%s", TYPE (b), b->subtype);
+ type = _type;
+ }
- if (is_mmnoask (type))
- return 1;
-
- while (t)
+ if (mutt_needs_mailcap (b))
+ {
+ if (option (OPTIMPLICITAUTOVIEW))
+ return 1;
+
+ if (is_mmnoask (type))
+ return 1;
+ }
+
+ for (; t; t = t->next)
{
i = mutt_strlen (t->data) - 1;
if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' &&
mutt_strncasecmp (type, t->data, i) == 0) ||
mutt_strcasecmp (type, t->data) == 0)
return 1;
- t = t->next;
}
return 0;