From: bwalton@artsci.utoronto.ca (Ben Walton)
Subject: [sup-talk] [PATCH 1/2] Add message bouncing capability
Date: Sun, 7 Jun 2009 20:02:26 -0400 [thread overview]
Message-ID: <1244419347-11330-2-git-send-email-bwalton@artsci.utoronto.ca> (raw)
In-Reply-To: <1244419347-11330-1-git-send-email-bwalton@artsci.utoronto.ca>
Bouncing a message is akin to redirecting a mail with a .forward
entry. It is passed back to the mail system as it sits on disk.
By pressing ! while viewing a message, you can now re-inject it to the
mail system using either the command defined in bounce_sendmail or the
sendmail command for the default account with any instance of -t
removed. The user is prompted for the recipients of the message and is
offered a chance to confirm the bounce before it is sent.
The message is _not_ stored in the sent box, as this doesn't make
sense with bounced messages (and would not show up uniquely anyway).
The bounce_sendmail configuration item allows users that require
different sendmail commands depending on where the bounce is destined
to write a wrapper around their local mail tools to pick and choose
the appropriate injection method for the message based on the
addresses passed in. Most systems can likely use: sendmail -oem -i
Signed-off-by: Ben Walton <bwalton at artsci.utoronto.ca>
---
lib/sup.rb | 1 +
lib/sup/modes/thread-view-mode.rb | 33 +++++++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/lib/sup.rb b/lib/sup.rb
index 96510b2..76444c9 100644
--- a/lib/sup.rb
+++ b/lib/sup.rb
@@ -207,6 +207,7 @@ 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 42c6280..8842e59 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -41,6 +41,7 @@ EOS
# k.add :collapse_non_new_messages, "Collapse all but unread messages", 'N'
k.add :reply, "Reply to a message", 'r'
k.add :forward, "Forward a message or attachment", 'f'
+ k.add :bounce, "Bounce message to other recipient(s)", '!'
k.add :alias, "Edit alias/nickname for a person", 'i'
k.add :edit_as_new, "Edit message as new", 'D'
k.add :save_to_disk, "Save message/attachment to disk", 's'
@@ -172,6 +173,38 @@ EOS
end
end
+ def bounce
+ 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
+
+ cmd = case $config[:bounce_sendmail]
+ when nil, /^$/ then defcmd
+ else $config[:bounce_sendmail]
+ end + ' ' + to.map { |t| t.email }.join(' ')
+
+ bt = to.size > 1 ? "#{to.size} recipients" : to.to_s
+
+ if BufferManager.ask_yes_or_no "Really bounce to #{bt}?"
+ Redwood::log "Bounce Command: #{cmd}"
+ begin
+ IO.popen(cmd, 'w') do |sm|
+ sm.puts m.raw_message
+ end
+ raise SendmailCommandFailed, "Couldn't execute #{cmd}" unless $? == 0
+ rescue SystemCallError, SendmailCommandFailed => e
+ Redwood::log "Problem sending mail: #{e.message}"
+ BufferManager.flash "Problem sending mail: #{e.message}"
+ end
+ end
+ end
+
include CanAliasContacts
def alias
p = @person_lines[curpos] or return
--
1.6.3
next prev parent reply other threads:[~2009-06-08 0:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-08 0:02 [sup-talk] (no subject) Ben Walton
2009-06-08 0:02 ` Ben Walton [this message]
2009-06-08 0:02 ` [sup-talk] [PATCH 2/2] Bounce Message Hook Ben Walton
2009-06-11 23:50 ` [sup-talk] (no subject) Ben Walton
2009-06-12 3:44 ` William Morgan
2009-06-12 13:15 ` Ben Walton
2009-06-12 18:23 ` William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1244419347-11330-2-git-send-email-bwalton@artsci.utoronto.ca \
--to=bwalton@artsci.utoronto.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox