diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1999-01-07 09:57:04 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1999-01-07 09:57:04 +0000 |
commit | 246198ae90539dd2429032c1620044dde3d5176e (patch) | |
tree | bc2eb5ee2bbfe8f9db9c5236ee94d3a8b33dd969 /attach.c | |
parent | bb5d9a28dda68c70359bc2710f22e6734fa85e76 (diff) |
Merge in the mailcap patch from stable.
Diffstat (limited to 'attach.c')
-rw-r--r-- | attach.c | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -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; |