]> git.cworth.org Git - sup/commitdiff
fix border case with reply-to-recipient
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 14 Nov 2007 07:34:36 +0000 (07:34 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Wed, 14 Nov 2007 07:34:36 +0000 (07:34 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@698 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/modes/reply-mode.rb

index d176499018bc784b07b6fdc6573e184faab22f2d..48bf66acd476cbe8641532f51b71256aeb9c8757 100644 (file)
@@ -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}>",