From: wmorgan Date: Wed, 14 Nov 2007 07:34:36 +0000 (+0000) Subject: fix border case with reply-to-recipient X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=88aa9bb402c566aef405ccf20bcf3a2bd8eadafd;p=sup fix border case with reply-to-recipient git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@698 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb index d176499..48bf66a 100644 --- a/lib/sup/modes/reply-mode.rb +++ b/lib/sup/modes/reply-mode.rb @@ -38,13 +38,20 @@ class ReplyMode < EditMessageMode cc = (@m.to + @m.cc - [from, to]).uniq @headers = {} - @headers[:sender] = { - "To" => [to.full_address], - } unless AccountManager.is_account? to + ## if there's no cc, then the sender is the person you want to reply + ## to. if it's a list message, then the list address is. otherwise, + ## the cc contains a recipient. + useful_recipient = !(cc.empty? || @m.is_list_message?) + @headers[:recipient] = { "To" => cc.map { |p| p.full_address }, - } unless cc.empty? || @m.is_list_message? + } if useful_recipient + + ## typically we don't want to have a reply-to-sender option if the sender + ## is a user account. however, if the cc is empty, it's a message to + ## ourselves, so for the lack of any other options, we'll add it. + @headers[:sender] = { "To" => [to.full_address], } if !AccountManager.is_account?(to) || !useful_recipient @headers[:user] = {} @@ -58,6 +65,7 @@ class ReplyMode < EditMessageMode } if @m.is_list_message? refs = gen_references + @headers.each do |k, v| @headers[k] = { "From" => "#{from.name} <#{from.email}>",