Commit 246198ae authored by Thomas Roessler's avatar Thomas Roessler

Merge in the mailcap patch from stable.

parent bb5d9a28
......@@ -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;
......
......@@ -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);
......
......@@ -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' :
......
......@@ -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 },
......
......@@ -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;
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment