>From 702b2cc1e652c1f20f4280b11355cb337291df87 Mon Sep 17 00:00:00 2001From: Ben Walton <bwalton at artsci.utoronto.ca> Date: Sun, 31 May 2009 20:37:11 -0400 Subject: [PATCH] Add bounce message feature By pressing ! in thread view mode, a message can be re-injected to the mail system without any modification. The interesting/useful property of this feature is that, because only the envelope sender changes, the mail will show up at the new destination with the original From: header. A use case for this is redirecting mail sent to an individual into a ticket system such that the original sender gets the auto-response. Signed-off-by: Ben Walton <bwalton at artsci.utoronto.ca> --- lib/sup/modes/thread-view-mode.rb | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb index 42c6280..4737dde 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,24 @@ EOS end end + def bounce + m = @message_lines[curpos] or return + to = BufferManager.ask_for_contacts(:people, "Bounce To: ") or return + + if BufferManager.ask_yes_or_no "Really bounce to #{to.join('', '')}?" + cmd = "sendmail -oem -i #{to.map { |t| t.email}.join('' '')}" + 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
Excerpts from Ben Walton''s message of Sun May 31 21:01:10 -0400 2009:> >From 702b2cc1e652c1f20f4280b11355cb337291df87 Mon Sep 17 00:00:00 2001 > From: Ben Walton <bwalton at artsci.utoronto.ca> > Date: Sun, 31 May 2009 20:37:11 -0400 > Subject: [PATCH] Add bounce message feature...sorry for the odd way in which this arrived. The changed behaviour in the recent git send-email threw me for a bit and I fired the cover letter without the patch following. Thanks. -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu Contact me to arrange for a CAcert assurance meeting. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090531/e287f32c/attachment.bin>
Excerpts from Ben Walton''s message of Sun May 31 21:01:10 -0400 2009:> >From 702b2cc1e652c1f20f4280b11355cb337291df87 Mon Sep 17 00:00:00 2001 > From: Ben Walton <bwalton at artsci.utoronto.ca> > Date: Sun, 31 May 2009 20:37:11 -0400 > Subject: [PATCH] Add bounce message featureI thought I''d also clarify that in its final form, there should be a refactor of EditMessageMode::send_message to pull out the wrapped IO.popen into a method usable for sending a normal message and bouncing a message. Thanks -Ben -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 GPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu Contact me to arrange for a CAcert assurance meeting. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://rubyforge.org/pipermail/sup-talk/attachments/20090531/a19dd890/attachment.bin>
I merged this patch into the mainline from gitorius. Works as expected. Definitely a nice addition. Ross On Sun, May 31, 2009 at 9:01 PM, Ben Walton <bwalton at cquest.utoronto.ca> wrote:> >From 702b2cc1e652c1f20f4280b11355cb337291df87 Mon Sep 17 00:00:00 2001 > From: Ben Walton <bwalton at artsci.utoronto.ca> > Date: Sun, 31 May 2009 20:37:11 -0400 > Subject: [PATCH] Add bounce message feature > > By pressing ! in thread view mode, a message can be re-injected to the > mail system without any modification. ?The interesting/useful property > of this feature is that, because only the envelope sender changes, the > mail will show up at the new destination with the original From: > header. ?A use case for this is redirecting mail sent to an individual > into a ticket system such that the original sender gets the > auto-response. > > Signed-off-by: Ben Walton <bwalton at artsci.utoronto.ca> > --- > ?lib/sup/modes/thread-view-mode.rb | ? 19 +++++++++++++++++++ > ?1 files changed, 19 insertions(+), 0 deletions(-) > > diff --git a/lib/sup/modes/thread-view-mode.rb b/lib/sup/modes/thread-view-mode.rb > index 42c6280..4737dde 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,24 @@ EOS > ? ? end > ? end > > + ?def bounce > + ? ?m = @message_lines[curpos] or return > + ? ?to = BufferManager.ask_for_contacts(:people, "Bounce To: ") or return > + > + ? ?if BufferManager.ask_yes_or_no "Really bounce to #{to.join('', '')}?" > + ? ? ?cmd = "sendmail -oem -i #{to.map { |t| t.email}.join('' '')}" > + ? ? ?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 > > _______________________________________________ > sup-talk mailing list > sup-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/sup-talk >