commit 88aa9bb402c566aef405ccf20bcf3a2bd8eadafd
parent 5de19940d9fa546e9675f652ac1af7fc3cdb785e
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Wed, 14 Nov 2007 07:34:36 +0000
fix border case with reply-to-recipient
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@698 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git 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}>",