Commits

Thomas Roessler  committed 9ce9318

Remove the use_mailcap variable. Instead, we introduce
implicit_autoview which triggers autoview for every content type
it's applicable to.

  • Participants
  • Parent commits a6e9bf8
  • Branches mutt-1-0-stable
  • Tags mutt-1-0-stable-nomailcap

Comments (0)

Files changed (6)

   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;
 /* 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];
   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);
 
 
       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';
         ch = 'K';
 #endif
 
-
-
-      else
-	ch = ' ';
       snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
       snprintf (buf2, sizeof (buf2),
 		"%c%c%c", (THREAD_NEW ? 'n' : (THREAD_OLD ? 'o' : 
   { "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 "> " },
   { "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 },
   OPT_VERIFYSIG, /* verify PGP signatures */
 #endif
 
-  OPT_USEMAILCAP,
   OPT_PRINT,
   OPT_INCLUDE,
   OPT_DELETE,
   OPTHELP,
   OPTHIDDENHOST,
   OPTIGNORELISTREPLYTO,
+  OPTIMPLICITAUTOVIEW,
   OPTMARKERS,
   OPTMARKOLD,
   OPTMENUSCROLL,	/* scroll menu instead of implicit next-page */
 #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;
 #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)