From 5e0b295a66b7d5c414847fbd07c345da19cc2fe2 Mon Sep 17 00:00:00 2001 From: Michael Elkins Date: Thu, 17 Jan 2013 02:10:12 +0000 Subject: change semantics of mutt_is_autoview() to return 1 if there is a matching mailcap entry and either $implicit_autoview is set or the MIME type matches the user's auto_view list. closes #3496 closes #3426 --- attach.c | 77 ---------------------------------------------------------------- 1 file changed, 77 deletions(-) (limited to 'attach.c') diff --git a/attach.c b/attach.c index 9e45cfdc..99fab2ab 100644 --- a/attach.c +++ b/attach.c @@ -293,49 +293,6 @@ int mutt_edit_attachment (BODY *a) } -/* for compatibility with metamail */ -static int is_mmnoask (const char *buf) -{ - char tmp[LONG_STRING], *p, *q; - int lng; - - if ((p = getenv ("MM_NOASK")) != NULL && *p) - { - if (mutt_strcmp (p, "1") == 0) - return (1); - - strfcpy (tmp, p, sizeof (tmp)); - p = tmp; - - while ((p = strtok (p, ",")) != NULL) - { - if ((q = strrchr (p, '/')) != NULL) - { - if (*(q+1) == '*') - { - if (ascii_strncasecmp (buf, p, q-p) == 0) - return (1); - } - else - { - if (ascii_strcasecmp (buf, p) == 0) - return (1); - } - } - else - { - lng = mutt_strlen (p); - if (buf[lng] == '/' && mutt_strncasecmp (buf, p, lng) == 0) - return (1); - } - - p = NULL; - } - } - - return (0); -} - void mutt_check_lookup_list (BODY *b, char *type, int len) { LIST *t = MimeLookupList; @@ -371,40 +328,6 @@ void mutt_check_lookup_list (BODY *b, char *type, int len) } } -int mutt_is_autoview (BODY *b, const char *type) -{ - LIST *t = AutoViewList; - char _type[SHORT_STRING]; - int i; - - if (!type) - snprintf (_type, sizeof (_type), "%s/%s", TYPE (b), b->subtype); - else - strncpy (_type, type, sizeof(_type)); - - mutt_check_lookup_list (b, _type, sizeof(_type)); - type = _type; - - 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] == '*' && - ascii_strncasecmp (type, t->data, i) == 0) || - ascii_strcasecmp (type, t->data) == 0) - return 1; - } - - return 0; -} - /* returns -1 on error, 0 or the return code from mutt_do_pager() on success */ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, ATTACHPTR **idx, short idxlen) -- cgit v1.2.3