From 8fac49d064a3fbcebcf243593c8dfd7a758efdd7 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 7 Jan 1999 09:57:04 +0000 Subject: [PATCH] Merge in the mailcap patch from stable. --- attach.c | 50 +++++++++++++++++++++++++++++++++++++++++ commands.c | 66 ------------------------------------------------------ hdrline.c | 12 +++------- init.h | 2 +- mutt.h | 3 +-- mx.c | 5 ----- 6 files changed, 55 insertions(+), 83 deletions(-) diff --git a/attach.c b/attach.c index b18b66209..14171704d 100644 --- a/attach.c +++ b/attach.c @@ -276,11 +276,61 @@ int mutt_edit_attachment (BODY *a) return rc; } + +/* 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 (mutt_strncasecmp (buf, p, q-p) == 0) + return (1); + } + else + { + if (mutt_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); +} + int mutt_is_autoview (char *type) { LIST *t = AutoViewList; int i; + if (option (OPTIMPLICITAUTOVIEW)) + return 1; + + if (is_mmnoask (type)) + return 1; + while (t) { i = mutt_strlen (t->data) - 1; diff --git a/commands.c b/commands.c index f2be30aa5..82765900f 100644 --- a/commands.c +++ b/commands.c @@ -60,49 +60,6 @@ extern char *ReleaseDate; /* The folder the user last saved to. Used by ci_save_message() */ static char LastSaveFolder[_POSIX_PATH_MAX] = ""; -/* 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 (mutt_strncasecmp (buf, p, q-p) == 0) - return (1); - } - else - { - if (mutt_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); -} - int mutt_display_message (HEADER *cur) { char tempfile[_POSIX_PATH_MAX], buf[LONG_STRING]; @@ -113,29 +70,6 @@ int mutt_display_message (HEADER *cur) snprintf (buf, sizeof (buf), "%s/%s", TYPE (cur->content), cur->content->subtype); - if (cur->mailcap && !mutt_is_autoview (buf)) - { - if (is_mmnoask (buf)) - rc = M_YES; - else - rc = query_quadoption (OPT_USEMAILCAP, - _("Display message using mailcap?")); - if (rc < 0) - return 0; - else if (rc == M_YES) - { - MESSAGE *msg; - - if ((msg = mx_open_message (Context, cur->msgno)) != NULL) - { - mutt_view_attachment (msg->fp, cur->content, M_REGULAR); - mx_close_message (&msg); - mutt_set_flag (Context, cur, M_READ, 1); - } - return 0; - } - } - mutt_parse_mime_message (Context, cur); diff --git a/hdrline.c b/hdrline.c index 988c84019..89c5ad543 100644 --- a/hdrline.c +++ b/hdrline.c @@ -595,13 +595,11 @@ hdr_format_str (char *dest, break; case 'Z': - if (hdr->mailcap) - ch = 'M'; - - + + ch = ' '; #ifdef _PGPPATH - else if (hdr->pgp & PGPENCRYPT) + if (hdr->pgp & PGPENCRYPT) ch = 'P'; else if (hdr->pgp & PGPSIGN) ch = 'S'; @@ -609,10 +607,6 @@ hdr_format_str (char *dest, ch = 'K'; #endif - - - else - ch = ' '; snprintf (fmt, sizeof (fmt), "%%%ss", prefix); snprintf (buf2, sizeof (buf2), "%c%c%c", (THREAD_NEW ? 'n' : (THREAD_OLD ? 'o' : diff --git a/init.h b/init.h index 17845785d..9edc74cd5 100644 --- a/init.h +++ b/init.h @@ -127,6 +127,7 @@ struct option_t MuttVars[] = { { "imap_pass", DT_STR, R_NONE, UL &ImapPass, UL 0 }, { "imap_checkinterval", DT_NUM, R_NONE, UL &ImapCheckTime, 0 }, #endif + { "implicit_autoview", DT_BOOL,R_NONE, OPTIMPLICITAUTOVIEW, 0}, { "in_reply_to", DT_STR, R_NONE, UL &InReplyTo, UL "%i; from %n on %{!%a, %b %d, %Y at %I:%M:%S%p %Z}" }, { "include", DT_QUAD, R_NONE, OPT_INCLUDE, M_ASKYES }, { "indent_string", DT_STR, R_NONE, UL &Prefix, UL "> " }, @@ -268,7 +269,6 @@ struct option_t MuttVars[] = { { "use_8bitmime", DT_BOOL, R_NONE, OPTUSE8BITMIME, 0 }, { "use_domain", DT_BOOL, R_NONE, OPTUSEDOMAIN, 1 }, { "use_from", DT_BOOL, R_NONE, OPTUSEFROM, 1 }, - { "use_mailcap", DT_QUAD, R_NONE, OPT_USEMAILCAP, M_ASKNO }, { "visual", DT_PATH, R_NONE, UL &Visual, 0 }, { "wait_key", DT_BOOL, R_NONE, OPTWAITKEY, 1 }, { "wrap_search", DT_BOOL, R_NONE, OPTWRAPSEARCH, 1 }, diff --git a/mutt.h b/mutt.h index 4ca1b6f70..2a82e0fb1 100644 --- a/mutt.h +++ b/mutt.h @@ -246,7 +246,6 @@ enum OPT_VERIFYSIG, /* verify PGP signatures */ #endif - OPT_USEMAILCAP, OPT_PRINT, OPT_INCLUDE, OPT_DELETE, @@ -302,6 +301,7 @@ enum OPTHELP, OPTHIDDENHOST, OPTIGNORELISTREPLYTO, + OPTIMPLICITAUTOVIEW, OPTMARKERS, OPTMARKOLD, OPTMENUSCROLL, /* scroll menu instead of implicit next-page */ @@ -520,7 +520,6 @@ typedef struct header #endif unsigned int mime : 1; /* has a Mime-Version header? */ - unsigned int mailcap : 1; /* requires mailcap to display? */ unsigned int flagged : 1; /* marked important? */ unsigned int tagged : 1; unsigned int deleted : 1; diff --git a/mx.c b/mx.c index aed1be415..214286424 100644 --- a/mx.c +++ b/mx.c @@ -1306,13 +1306,8 @@ void mx_update_context (CONTEXT *ctx) #ifdef _PGPPATH /* NOTE: this _must_ be done before the check for mailcap! */ h->pgp = pgp_query (h->content); - if (!h->pgp) #endif /* _PGPPATH */ - - - if (mutt_needs_mailcap (h->content)) - h->mailcap = 1; if (h->flagged) ctx->flagged++; if (h->deleted) -- 2.40.0