* Dave Pearson <[EMAIL PROTECTED]> [2001-02-20, 12:01 +0000]:
> Actually I want to kill off mutt.octet.filter and do things properly. As
> more than one person has pointed out, this sort of thing can and should be
> done via the mailcap. If anyone is interested in taking it over and doing it
> properly and/or helping to write a "proper" version I'd love to hear from
> them.
> 
> Part of me wonders if it would make a good patch (or even actual feature?)
> for mutt itself. Something that does a double check from within mutt when
> encountering an octet-stream would be really useful.
> 
> [CC: To mutt-dev 'cos I'd be interest to know what the developers think.
>  Note that I'm not on the development list.]

Note; That I am no developer either so this is not to be seen as a patch
since it might just as well tear up a hole as fill a need.. Also, I am
not sure if this is the "proper" way to do it

The idea is the same as described above; when looking up a mailcap for
octet-streams first try to find a better type among the mime.types. This
can be done by the 'lookup_mime_type' function. (which is declared
statically, so first change that in the 'sendlib.c' file) Next, first in
the function 'rfc1524_mailcap_lookup' (in rfc1524.c) I added:

  if (!mutt_strcasecmp ("application/octet-stream", type)) {
      char buf[SHORT_STRING];
      int n;
      if ((n = lookup_mime_type (buf, a->filename)) != TYPEOTHER) {
          snprintf (type, STRING, "%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);
      }
  }

And that's it. (well.. you need to include "mime.h" too, but that's it:)

/Ulf

Reply via email to