From 5081ed4ee160ac612c2b11bff8d259c943cf1e42 Mon Sep 17 00:00:00 2001 From: Ben Walton Date: Sun, 7 Jun 2009 19:44:37 -0400 Subject: [PATCH] Bounce Message Hook Determine the command used to bounce a message based on a Hook instead of a configuration option. Instead of writing an external script that can send the message properly based on the recipient addresses, rely on a hook that can return the command based on the From header in the mail being bounced as well as the intended recipients. This is more in line with the sup philosophy. The default is still to strip any -t from the sendmail command of the default account. Signed-off-by: Ben Walton --- lib/sup.rb | 1 - lib/sup/modes/thread-view-mode.rb | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/sup.rb b/lib/sup.rb index 76444c9..96510b2 100644 --- a/lib/sup.rb +++ b/lib/sup.rb @@ -207,7 +207,6 @@ else :confirm_top_posting => true, :discard_snippets_from_encrypted_messages => false, :default_attachment_save_dir => "", - :bounce_sendmail => "", } begin FileUtils.mkdir_p Redwood::BASE_DIR diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 8842e59..76a1d1e 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -24,6 +24,18 @@ Return value: None. The variable 'headers' should be modified in place. EOS + HookManager.register "bounce-command", < m.from, :to => to when nil, /^$/ then defcmd - else $config[:bounce_sendmail] + else hookcmd end + ' ' + to.map { |t| t.email }.join(' ') bt = to.size > 1 ? "#{to.size} recipients" : to.to_s -- 2.45.2