Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Config control over how From address is generated when replying.
@ 2008-04-27  6:49 William Morgan
  2008-04-28  4:11 ` Marc Hartstein
  0 siblings, 1 reply; 7+ messages in thread
From: William Morgan @ 2008-04-27  6:49 UTC (permalink / raw)


Hi Marc,

Reformatted excerpts from Marc Hartstein's message of 2008-04-23:
> Two new boolean options are now recognized in .sup/config.yaml

I appreciate the idea behind this patch, but I'm making a concerted
effort to keep the config options down to a minimum. I'd prefer a hook
that passed in all the relevant header values as parameters
(@m.recipient_email, @m.to, @m.cc, etc) and returned the desired From:
address. Then people can implement their own logic without the config
file starting down the path of Mutt-style configuration insanity.

You could actually technically accomplish this already with the
before-edit hook, but I'd be happy with a special purpose hook.

-- 
William <wmorgan-sup at masanjin.net>


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [sup-talk] [PATCH] Config control over how From address is generated when replying.
@ 2008-04-23 21:02 Marc Hartstein
  0 siblings, 0 replies; 7+ messages in thread
From: Marc Hartstein @ 2008-04-23 21:02 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-06-19 17:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-27  6:49 [sup-talk] [PATCH] Config control over how From address is generated when replying William Morgan
2008-04-28  4:11 ` Marc Hartstein
2008-04-29 16:19   ` William Morgan
2008-06-12 16:05     ` [sup-talk] [PATCH] add reply-from hook for user-defined handling of default from in replies Marc Hartstein
2008-06-12 16:12       ` Marc Hartstein
2008-06-19 17:56         ` William Morgan
  -- strict thread matches above, loose matches on Subject: below --
2008-04-23 21:02 [sup-talk] [PATCH] Config control over how From address is generated when replying Marc Hartstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox