]> git.cworth.org Git - sup/commitdiff
attachment and message mime stuff cleanups in preparation for fowards as attachments
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 29 Aug 2007 15:45:47 +0000 (15:45 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 29 Aug 2007 15:45:47 +0000 (15:45 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@549 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/message.rb
lib/sup/modes/edit-message-mode.rb
lib/sup/util.rb

index 812d743dfca7d675ac7e2d8b1ab2b502ffc35257..1c300dd9ee1df2545e665aa7f3d712def6f48599 100644 (file)
@@ -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
index 76ac2d1fb38410c7d76fc80920c705a2a3a028f4..779f1c63d3ef20515d1ab99ef0b2b74220935388 100644 (file)
@@ -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
index 6ddd758e8a9ef997fc4293b40f3c464a5d411c2b..c288795f0d66b50cdaed64697252cdf309fad7de 100644 (file)
@@ -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