X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=lib%2Fsup%2Fmessage-chunks.rb;h=ce7d1ee4f5fde1e1df37d1ed5c6223e6ba5b3481;hb=ea8c342fdef36e1876016c25dd4d7f7d4829d7c6;hp=40e098f2914e8c606d69c95a62234a53c12b9f10;hpb=2388e4a48a6d3ea5e626fccf9588a6a177e7065e;p=sup diff --git a/lib/sup/message-chunks.rb b/lib/sup/message-chunks.rb index 40e098f..ce7d1ee 100644 --- a/lib/sup/message-chunks.rb +++ b/lib/sup/message-chunks.rb @@ -208,13 +208,25 @@ EOS class EnclosedMessage attr_reader :lines - def initialize from, body - @from = from - @lines = body.split "\n" - end + def initialize from, to, cc, date, subj + @from = from ? "unknown sender" : from.full_adress + @to = to ? "" : to.map { |p| p.full_address }.join(", ") + @cc = cc ? "" : cc.map { |p| p.full_address }.join(", ") + if date + @date = date.rfc822 + else + @date = "" + end - def from - @from ? @from.longname : "unknown sender" + @subj = subj + + @lines = "\nFrom: #{from}\n" + @lines += "To: #{to}\n" + if !cc.empty? + @lines += "Cc: #{cc}\n" + end + @lines += "Date: #{date}\n" + @lines += "Subject: #{subj}\n\n" end def inlineable?; false end @@ -224,7 +236,7 @@ EOS def viewable?; false end def patina_color; :generic_notice_patina_color end - def patina_text; "Begin enclosed message from #{from} (#{@lines.length} lines)" end + def patina_text; "Begin enclosed message sent on #{@date}" end def color; :quote_color end end