From d3874dff559080576d1f93735c13691a8dd2e631 Mon Sep 17 00:00:00 2001 From: wmorgan Date: Wed, 29 Aug 2007 15:45:47 +0000 Subject: [PATCH] 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 --- lib/sup/message.rb | 5 +++++ lib/sup/modes/edit-message-mode.rb | 4 ++-- lib/sup/util.rb | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/sup/message.rb b/lib/sup/message.rb index 812d743..1c300dd 100644 --- 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 index 76ac2d1..779f1c6 100644 --- 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 index 6ddd758..c288795 100644 --- 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 -- 2.45.2