From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.90.117.16 with SMTP id p16cs180607agc; Sat, 10 Oct 2009 00:30:08 -0700 (PDT) Received: by 10.224.78.22 with SMTP id i22mr3405465qak.280.1255159807671; Sat, 10 Oct 2009 00:30:07 -0700 (PDT) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 36si1465585qyk.58.2009.10.10.00.30.07; Sat, 10 Oct 2009 00:30:07 -0700 (PDT) Received-SPF: pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-talk-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id EF4421D7882D; Sat, 10 Oct 2009 03:30:06 -0400 (EDT) X-Greylist: delayed 495 seconds by postgrey-1.31 at rubycentral.org; Sat, 10 Oct 2009 03:29:52 EDT Received: from kuovi.tilus.net (kuovi.tilus.net [80.68.89.168]) by rubyforge.org (Postfix) with ESMTP id 90DC91D7882D for ; Sat, 10 Oct 2009 03:29:52 -0400 (EDT) Received: by kuovi.tilus.net (Postfix, from userid 1000) id 32C1F6010; Sat, 10 Oct 2009 08:21:33 +0100 (BST) From: Tero Tilus To: sup-talk Date: Sat, 10 Oct 2009 10:21:33 +0300 Message-Id: <1255159160-sup-8754@tilus.net> User-Agent: Sup/git Subject: [sup-talk] [PATCH] moved deriving the cmd for bouncing to Account and fixed a bug in it X-BeenThere: sup-talk@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: User & developer discussion of Sup List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: sup-talk-bounces@rubyforge.org Errors-To: sup-talk-bounces@rubyforge.org The default sendmail command used for bouncing mail was derived from Account#sendmail in ThreadViewMode#bounce. Moved it to Account#bounce_sendmail. Part of work towards more DRY mail bouncing within mark-as-spam hook. The code also had a bug, "$1" (instead of $1 or "#{$1}"). Fixed it. Signed-off-by: Tero Tilus --- lib/sup/account.rb | 11 +++++++++++ lib/sup/modes/thread-view-mode.rb | 7 +------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/sup/account.rb b/lib/sup/account.rb index eed2794..bf8a8a0 100644 --- a/lib/sup/account.rb +++ b/lib/sup/account.rb @@ -10,6 +10,17 @@ class Account < Person @sendmail = h[:sendmail] @signature = h[:signature] end + + # Default sendmail command for bouncing mail, + # deduced from #sendmail + def bounce_sendmail + sendmail.sub(/\s(\-(ti|it|t))\b/) do |match| + case $1 + when '-t' then '' + else ' -i' + end + end + end end class AccountManager diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 81197c2..e7f4a4f 100644 --- a/lib/sup/modes/thread-view-mode.rb +++ b/lib/sup/modes/thread-view-mode.rb @@ -202,12 +202,7 @@ EOS m = @message_lines[curpos] or return to = BufferManager.ask_for_contacts(:people, "Bounce To: ") or return - defcmd = AccountManager.default_account.sendmail.sub(/\s(\-(ti|it|t))\b/) do |match| - case "$1" - when '-t' then '' - else ' -i' - end - end + defcmd = AccountManager.default_account.bounce_sendmail cmd = case (hookcmd = HookManager.run "bounce-command", :from => m.from, :to => to) when nil, /^$/ then defcmd -- 1.5.6.5 -- Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/ _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk