commit bfc7b47b610da5103c1f95f480a80d952b30a2a7
parent d868d79eaa1e21bbc2705bb17375f11fa92a9296
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Sun, 20 May 2007 17:32:15 +0000
view as text if the mime view command fails
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@403 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/doc/TODO b/doc/TODO
@@ -1,5 +1,6 @@
for 0.0.9
---------
+_ detect other sup instances and do something intelligent (because ferret crashes violently with more than one index writer open)
_ bugfix: need a way to force an address to a particular name, for things like evite addresses
_ bugfix: read before thread-index has finished loading then hides the thread?!? wtf. (on jamie)
_ bugfix: ferret flakiness: just added message but can't find it.
@@ -10,6 +11,7 @@ _ bugfix: readlock
_ split out threading & message chunk parsing to a separate library
_ decode RFC 2047 ("encoded word") headers
- see: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/101949, http://dev.rubyonrails.org/ticket/6807
+x view as text command if the mime view command fails for an attachment
x bugfix: attachment filenames sometimes not detected (filename=)
x bugfix: rmail multipart error
x bugfix: sup-add not prompting for old accounts, i think? possibly because
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -44,8 +44,7 @@ class Message
@file.close
end
- ## TODO: handle unknown mime-types
- system "/usr/bin/run-mailcap --action=view #{@content_type}:#{@file.path}"
+ system "/usr/bin/run-mailcap --action=view #{@content_type}:#{@file.path} >& /dev/null"
$? == 0
end
@@ -74,10 +73,12 @@ class Message
end
end
+
QUOTE_PATTERN = /^\s{0,4}[>|\}]/
BLOCK_QUOTE_PATTERN = /^-----\s*Original Message\s*----+$/
QUOTE_START_PATTERN = /(^\s*Excerpts from)|(^\s*In message )|(^\s*In article )|(^\s*Quoting )|((wrote|writes|said|says)\s*:\s*$)/
SIG_PATTERN = /(^-- ?$)|(^\s*----------+\s*$)|(^\s*_________+\s*$)|(^\s*--~--~-)/
+
MAX_SIG_DISTANCE = 15 # lines from the end
DEFAULT_SUBJECT = "(missing subject)"
DEFAULT_SENDER = "(missing sender)"
@@ -335,10 +336,7 @@ private
state = newstate
end
- when :block_quote
- chunk_lines << line
-
- when :sig
+ when :block_quote, :sig
chunk_lines << line
end
diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb
@@ -462,9 +462,11 @@ private
success = a.view!
BufferManager.erase_flash
BufferManager.completely_redraw_screen
- BufferManager.flash "Couldn't execute view command." unless success
+ unless success
+ BufferManager.spawn "Attachment: #{a.filename}", TextMode.new(a.to_s)
+ BufferManager.flash "Couldn't execute view command, viewing as text."
+ end
end
-
end
end