summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>1999-01-07 10:44:19 +0000
committerThomas Roessler <roessler@does-not-exist.org>1999-01-07 10:44:19 +0000
commita759d3844ca925f5cf24035a75c68158ad156216 (patch)
tree9697cdc7d01102602a35bbb46cb0c442afa49c45
parent1b3d62e1f4e92f3781112bc566b8d0d124a984ff (diff)
Only use "implicit" autoviews (implicit_autoview or MM_NOASK) when
mutt is unable to handle a content type internally. This saves us parsing the mailcap files for every attachment we handle.
-rw-r--r--attach.c25
-rw-r--r--handler.c6
-rw-r--r--protos.h2
3 files changed, 21 insertions, 12 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;
diff --git a/handler.c b/handler.c
index 182f6974..8ba2e828 100644
--- a/handler.c
+++ b/handler.c
@@ -878,7 +878,7 @@ static void alternative_handler (BODY *a, STATE *s)
while (b)
{
snprintf (buf, sizeof (buf), "%s/%s", TYPE (b), b->subtype);
- if (mutt_is_autoview (buf))
+ if (mutt_is_autoview (b, buf))
{
rfc1524_entry *entry = rfc1524_new_entry ();
@@ -997,7 +997,7 @@ int mutt_can_decode (BODY *a)
char type[STRING];
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
- if (mutt_is_autoview (type))
+ if (mutt_is_autoview (a, type))
return (rfc1524_mailcap_lookup (a, type, NULL, M_AUTOVIEW));
else if (a->type == TYPETEXT)
return (1);
@@ -1322,7 +1322,7 @@ void mutt_body_handler (BODY *b, STATE *s)
/* first determine which handler to use to process this part */
snprintf (type, sizeof (type), "%s/%s", TYPE (b), b->subtype);
- if (mutt_is_autoview (type))
+ if (mutt_is_autoview (b, type))
{
rfc1524_entry *entry = rfc1524_new_entry ();
diff --git a/protos.h b/protos.h
index 4a673bda..0eed0dde 100644
--- a/protos.h
+++ b/protos.h
@@ -233,7 +233,7 @@ int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t);
int mutt_get_tmp_attachment (BODY *);
int mutt_index_menu (void);
int mutt_invoke_sendmail (ADDRESS *, ADDRESS *, ADDRESS *, const char *, int);
-int mutt_is_autoview (char *);
+int mutt_is_autoview (BODY *, const char *);
int mutt_is_mail_list (ADDRESS *);
int mutt_is_message_type(int, const char *);
int mutt_is_list_recipient (int, ADDRESS *, ADDRESS *);