From 6817b1079b0c1c0882dae3592e9f410de09e904f Mon Sep 17 00:00:00 2001 From: Marc Hartstein Date: Thu, 12 Jun 2008 12:05:46 -0400 Subject: [PATCH] add reply-from hook for user-defined handling of default from in replies The reply-from hook can now be used to process headers in a different manner than the default for purposes of generating a default From: header when replying to an email. --- lib/sup/modes/reply-mode.rb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/sup/modes/reply-mode.rb b/lib/sup/modes/reply-mode.rb index e7b2929..d6a7dc6 100644 --- a/lib/sup/modes/reply-mode.rb +++ b/lib/sup/modes/reply-mode.rb @@ -19,6 +19,16 @@ Return value: A string containing the text of the quote line (can be multi-line) EOS + HookManager.register "reply-from", < @m + + ## sanity check that selection is a Person (or we'll fail below) + ## don't check that it's an Account, though; assume they know what they're doing. + if hook_reply_from && !(hook_reply_from.is_a? Person) + Redwood::log "reply-from returned non-Person, using default from." + hook_reply_from = nil + end + from = - if @m.recipient_email && AccountManager.is_account_email?(@m.recipient_email) + if hook_reply_from + hook_reply_from + elsif @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 }) b -- 2.45.2