how to overried mime types?

2001-02-19 Thread Michael S. Tsirkin

Hello!
I get lots of mail from Outlook which all have attachments
of the type "application/octet-stream".
I would like in this case to use file extension to
select the viewer for the attachment.

Is there a way to do this in mutt?

-- 
This message content is not part of Intel's views or affairs
Michael S. Tsirkin
>   Four things are to be strengthened: Torah,and good deeds,
>   prayer and one's good manners (Berachoth)



Re: how to overried mime types?

2001-02-20 Thread Thomas Roessler

On 2001-02-20 09:35:25 +0200, Michael S. Tsirkin wrote:

> I get lots of mail from Outlook which all have attachments of the
> type "application/octet-stream". I would like in this case to use
> file extension to select the viewer for the attachment.

> Is there a way to do this in mutt?

Not really.  In more recent versions, you can, however, manually
override a message's content-type.

-- 
Thomas Roessler <[EMAIL PROTECTED]>



Re: how to overried mime types?

2001-02-20 Thread Lars Hecking

Michael S. Tsirkin writes:
> Hello!
> I get lots of mail from Outlook which all have attachments
> of the type "application/octet-stream".
> I would like in this case to use file extension to
> select the viewer for the attachment.
 
 This is precisely what Dave Pearson's mutt.octet.filter does.

  http://www.hagbard.demon.co.uk/mutt.html




Re: how to overried mime types?

2001-02-20 Thread Dave Pearson

On Tue, Feb 20, 2001 at 10:57:20AM +, Lars Hecking wrote:
> Michael S. Tsirkin writes:
> > Hello!
> > I get lots of mail from Outlook which all have attachments
> > of the type "application/octet-stream".
> > I would like in this case to use file extension to
> > select the viewer for the attachment.
>  
>  This is precisely what Dave Pearson's mutt.octet.filter does.
> 
>   http://www.hagbard.demon.co.uk/mutt.html

That's not quite what it does, it was only ever written as a filter for
auto_viewing octet-stream stuff. There is a version floating around that
adds a "view" option too.

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.]

-- 
Dave Pearson:  | mutt.octet.filter - autoview octet-streams
http://www.davep.org/  | mutt.vcard.filter - autoview simple vcards
Mutt:  | muttrc2html   - muttrc -> HTML utility
http://www.davep.org/mutt/ | muttrc.sl - Jed muttrc mode



Re: how to overried mime types?

2001-02-20 Thread Ulf Erikson

* Dave Pearson <[EMAIL PROTECTED]> [2001-02-20, 12:01 +]:
> 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



Re: how to overried mime types?

2001-02-20 Thread Dave Pearson

On Tue, Feb 20, 2001 at 06:53:42PM +0100, Ulf Erikson wrote:

>   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);
>   }
>   }

This seems very useful. Perhaps with the addition of a configuration
variable to control the behaviour (perhaps there are reasons why people
would wish this extra digging didn't happen)?

Would any of the developers care to comment on why this would be a bad idea?

-- 
Dave Pearson:  | mutt.octet.filter - autoview octet-streams
http://www.davep.org/  | mutt.vcard.filter - autoview simple vcards
Mutt:  | muttrc2html   - muttrc -> HTML utility
http://www.davep.org/mutt/ | muttrc.sl - Jed muttrc mode