From mboxrd@z Thu Jan 1 00:00:00 1970 From: wmorgan-sup@masanjin.net (William Morgan) Date: Tue, 28 Aug 2007 21:15:23 -0700 Subject: [sup-talk] new in svn: mime-type hook Message-ID: <1188360667-sup-3717@south> 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