* [sup-talk] [PATCH] moved deriving the cmd for bouncing to Account and fixed a bug in it
@ 2009-10-10 7:21 Tero Tilus
2009-11-12 4:30 ` Rich Lane
0 siblings, 1 reply; 2+ messages in thread
From: Tero Tilus @ 2009-10-10 7:21 UTC (permalink / raw)
To: sup-talk
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 <tero@tilus.net>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [sup-talk] [PATCH] moved deriving the cmd for bouncing to Account and fixed a bug in it
2009-10-10 7:21 [sup-talk] [PATCH] moved deriving the cmd for bouncing to Account and fixed a bug in it Tero Tilus
@ 2009-11-12 4:30 ` Rich Lane
0 siblings, 0 replies; 2+ messages in thread
From: Rich Lane @ 2009-11-12 4:30 UTC (permalink / raw)
To: Tero Tilus; +Cc: sup-talk
Excerpts from Tero Tilus's message of Sat Oct 10 03:21:33 -0400 2009:
> 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 <tero@tilus.net>
> ---
> lib/sup/account.rb | 11 +++++++++++
> lib/sup/modes/thread-view-mode.rb | 7 +------
> 2 files changed, 12 insertions(+), 6 deletions(-)
Looks good to me. Pushed to branch fix-bounce-cmd in my repo* and merged
to master.
* git://github.com/rlane/sup
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-12 4:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-10 7:21 [sup-talk] [PATCH] moved deriving the cmd for bouncing to Account and fixed a bug in it Tero Tilus
2009-11-12 4:30 ` Rich Lane
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox