Subject: [sup-talk] [PATCH] Config control over how From address is generated when replying.

From: [email-masked] (Marc Hartstein)
Date: Wed, 23 Apr 2008 17:02:50 -0400

Two new boolean options are now recognized in .sup/config.yaml

:reply_from_recipient: Check headers for the real email address the message
                       ultimately arrived at, and use it if it's one of
                       your accounts (or an alternate/regexp for such).

:reply_from_tocc:      Check To and CC for an address which matches one of
                       your accounts and use the first such found.

Both options default to true if missing, preserving the traditional sup
behavior.

Setting ...recipient to false and ...tocc to true will emulate mutt's behavior
with reverse_name=true

Setting both to false will always reply from your default account.
---
 lib/sup/modes/reply-mode.rb |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb
index e7b2929..82ce912 100644
--- a/lib/sup/modes/reply-mode.rb
+++ b/lib/sup/modes/reply-mode.rb
@@ -29,10 +29,12 @@ EOS
 
     ## first, determine the address at which we received this email. this will
     ## become our From: address in the reply.
+    check_recipient = $config[:reply_from_recipient].nil? || $config[:reply_from_recipient]
+    check_tocc = $config[:reply_from_tocc].nil? || $config[:reply_from_tocc]
     from =
-      if @m.recipient_email && AccountManager.is_account_email?(@m.recipient_email)
+      if check_recipient && @m.recipient_email && AccountManager.is_account_email?(@m.recipient_email)
         PersonManager.person_for(@m.recipient_email)
-      elsif(b = (@m.to + @m.cc).find { |p| AccountManager.is_account? p })
+      elsif check_tocc && (b = (@m.to + @m.cc).find { |p| AccountManager.is_account? p })
         b
       else
         AccountManager.default_account
-- 
1.5.3.7