]> git.cworth.org Git - sup/commitdiff
view as text if the mime view command fails
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sun, 20 May 2007 17:32:15 +0000 (17:32 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Sun, 20 May 2007 17:32:15 +0000 (17:32 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@403 5c8cc53c-5e98-4d25-b20a-d8db53a31250

doc/TODO
lib/sup/message.rb
lib/sup/modes/thread-view-mode.rb

index bcd7450607865893a1ca0180cc3b72e52bc427e5..cbb6c998865b916e3e9bf56f726059d84aae1685 100644 (file)
--- 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
index e6aa21c885e5d9e0f00e3ef8c8de201fa3f28ab5..dd4ded9c09f4cac644082cf1e3346b7264bc1389 100644 (file)
@@ -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
  
index 174e284099513fe4bc56a6cfa0065738c08d17fb..6693f68052790fcfd9a5e509e72d69f3ecc4ab4c 100644 (file)
@@ -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