diff -udpr mutt-1.2.5.orig/attach.c mutt-1.2.5/attach.c --- mutt-1.2.5.orig/attach.c Fri Mar 3 11:10:06 2000 +++ mutt-1.2.5/attach.c Sun Apr 29 13:29:11 2001 @@ -325,6 +325,27 @@ static int is_mmnoask (const char *buf) return (0); } +void mutt_lookup_octetstream (BODY *b, char *type, int len) +{ + if (option (OPTLOOKUPOCTETSTREAM) && + ! mutt_strcasecmp ("application/octet-stream", type)) { + char buf[SHORT_STRING]; + int n; + if ((n = mutt_lookup_mime_type (buf, b->filename)) != TYPEOTHER) { + snprintf (type, len, "%s/%s", + n == TYPEAUDIO ? "audio" : + n == TYPEAPPLICATION ? "application" : + n == TYPEIMAGE ? "image" : + n == TYPEMESSAGE ? "message" : + n == TYPEMODEL ? "model" : + n == TYPEMULTIPART ? "multipart" : + n == TYPETEXT ? "text" : + n == TYPEVIDEO ? "video" : "other", + buf); + } + } +} + int mutt_is_autoview (BODY *b, const char *type) { LIST *t = AutoViewList; @@ -332,10 +353,12 @@ int mutt_is_autoview (BODY *b, const cha int i; if (!type) - { snprintf (_type, sizeof (_type), "%s/%s", TYPE (b), b->subtype); - type = _type; - } + else + strncpy (_type, type, sizeof(_type)); + + mutt_lookup_octetstream (b, _type, sizeof(_type)); + type = _type; if (mutt_needs_mailcap (b)) { diff -udpr mutt-1.2.5.orig/init.h mutt-1.2.5/init.h --- mutt-1.2.5.orig/init.h Tue Jul 18 09:47:08 2000 +++ mutt-1.2.5/init.h Sun Apr 29 13:29:11 2001 @@ -845,6 +845,17 @@ struct option_t MuttVars[] = { ** The locale used by \fIstrftime(3)\fP to format dates. Legal values are ** the strings your system accepts for the locale variable \fILC_TIME\fP. */ + { "lookup_octetstream", DT_BOOL, R_NONE, OPTLOOKUPOCTETSTREAM, 0 }, + /* + ** .pp + ** This variable controls whether "application/octet-stream" attachments + ** should be dealt with especially. If set, Mutt will, when viewing + ** octet-streams, search the 'mime.types' file for an entry matching + ** the file extension. If a match is found the file is viewed according + ** to the found mime-type's entry in the mailcap file, otherwise the + ** application-octetstream entry in the mailcap file is used. All + ** attachments not labeled application/octet-stream are handled normally. + */ { "mail_check", DT_NUM, R_NONE, UL &BuffyTimeout, 5 }, /* ** .pp diff -udpr mutt-1.2.5.orig/mutt.h mutt-1.2.5/mutt.h --- mutt-1.2.5.orig/mutt.h Thu Jun 8 12:00:14 2000 +++ mutt-1.2.5/mutt.h Sun Apr 29 13:29:11 2001 @@ -312,6 +312,7 @@ enum OPTSSLSYSTEMCERTS, #endif OPTIMPLICITAUTOVIEW, + OPTLOOKUPOCTETSTREAM, OPTMAILCAPSANITIZE, OPTMARKERS, OPTMARKOLD, diff -udpr mutt-1.2.5.orig/protos.h mutt-1.2.5/protos.h --- mutt-1.2.5.orig/protos.h Tue May 16 17:23:12 2000 +++ mutt-1.2.5/protos.h Sun Apr 29 13:29:11 2001 @@ -163,6 +163,7 @@ void mutt_free_parameter (PARAMETER **); void mutt_generate_header (char *, size_t, HEADER *, int); void mutt_help (int); void mutt_linearize_tree (CONTEXT *, int); +void mutt_lookup_octetstream (BODY *, char *, int); void mutt_make_attribution (CONTEXT *ctx, HEADER *cur, FILE *out); void mutt_make_forward_subject (ENVELOPE *env, CONTEXT *ctx, HEADER *cur); void mutt_make_help (char *, size_t, char *, int, int); @@ -257,6 +258,7 @@ int mutt_is_list_recipient (int, ADDRESS int mutt_is_subscribed_list (ADDRESS *); int mutt_is_text_type (int, char *); int mutt_is_valid_mailbox (const char *); +int mutt_lookup_mime_type (char *, const char *); int mutt_multi_choice (char *prompt, char *letters); int mutt_needs_mailcap (BODY *); int mutt_num_postponed (int); diff -udpr mutt-1.2.5.orig/rfc1524.c mutt-1.2.5/rfc1524.c --- mutt-1.2.5.orig/rfc1524.c Fri Mar 3 11:10:13 2000 +++ mutt-1.2.5/rfc1524.c Sun Apr 29 13:29:11 2001 @@ -392,6 +392,8 @@ int rfc1524_mailcap_lookup (BODY *a, cha return 0; } + mutt_lookup_octetstream (a, type, SHORT_STRING); + while (!found && *curr) { x = 0; diff -udpr mutt-1.2.5.orig/sendlib.c mutt-1.2.5/sendlib.c --- mutt-1.2.5.orig/sendlib.c Sat May 20 08:38:59 2000 +++ mutt-1.2.5/sendlib.c Sun Apr 29 13:29:11 2001 @@ -626,7 +626,7 @@ static CONTENT *mutt_get_content_info (c * exists. */ -static int lookup_mime_type (char *d, const char *s) +int mutt_lookup_mime_type (char *d, const char *s) { FILE *f; char *p, *ct, @@ -1076,7 +1076,7 @@ BODY *mutt_make_file_attach (const char * suffix. */ - if ((n = lookup_mime_type (buf, path)) != TYPEOTHER) + if ((n = mutt_lookup_mime_type (buf, path)) != TYPEOTHER) { att->type = n; att->subtype = safe_strdup (buf);