sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit d3874dff559080576d1f93735c13691a8dd2e631
parent d2f2caef9b51e38bc5e9501db7fd1fcd84b36b46
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date:   Wed, 29 Aug 2007 15:45:47 +0000

attachment and message mime stuff cleanups in preparation for fowards as attachments

git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@549 5c8cc53c-5e98-4d25-b20a-d8db53a31250

Diffstat:
M lib/sup/message.rb | 5 +++++
M lib/sup/modes/edit-message-mode.rb | 4 ++--
M lib/sup/util.rb | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -72,6 +72,11 @@ EOS
       $? == 0
     end
     
+    ## used when viewing the attachment as text
+    def to_s
+      @lines || @raw_content
+    end
+
   private
 
     def write_to_disk
diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
@@ -240,7 +240,6 @@ protected
     m.header["User-Agent"] = "Sup/#{Redwood::VERSION}"
 
     if @attachments.empty?
-      m.header["Content-Disposition"] = "inline"
       m.header["Content-Type"] = "text/plain; charset=#{$encoding}"
       m.body = @body.join
       m.body += sig_lines.join("\n") unless $config[:edit_signature]
@@ -248,9 +247,10 @@ protected
       body_m = RMail::Message.new
       body_m.body = @body.join
       body_m.body += sig_lines.join("\n") unless $config[:edit_signature]
+      body_m.header["Content-Disposition"] = "inline"
       
       m.add_part body_m
-      @attachments.each { |fn| m.add_attachment fn.to_s }
+      @attachments.each { |fn| m.add_file_attachment fn.to_s }
     end
     f.puts m.to_s
   end
diff --git a/lib/sup/util.rb b/lib/sup/util.rb
@@ -63,7 +63,7 @@ module RMail
   class EncodingUnsupportedError < StandardError; end
 
   class Message
-    def add_attachment fn
+    def add_file_attachment fn
       bfn = File.basename fn
       a = Message.new
       t = MIME::Types.type_for(bfn).first || MIME::Types.type_for("exe").first