[sup-talk] new in svn: mime-type hook
William Morgan
wmorgan-sup at masanjin.net
Wed Aug 29 00:15:23 EDT 2007
There's a new hook for all your MIME decoding needs:
mime-decode
-----------
File: ~/.sup/hooks/mime-decode.rb
Executes when decoding a MIME attachment.
Variables:
content_type: the content-type of the message
filename: the filename of the attachment as saved to disk (generated
on the fly, so don't call more than once)
sibling_types: if this attachment is part of a multipart MIME attachment,
an array of content-types for all attachments. Otherwise,
the empty array.
Return value:
The decoded text of the attachment, or nil if not decoded.
Here's what I use for mime-decode.rb. It uses w3m to translate all HTML
attachments that don't have a text/html alternative:
unless sibling_types.member? "text/plain"
case content_type
when "text/html"
`/usr/bin/w3m -dump -T #{content_type} '#{filename}'`
end
end
--
William <wmorgan-sup at masanjin.net>
More information about the sup-talk
mailing list