From: "Edward Z. Yang" <ezyang@MIT.EDU>
To: sup-devel@rubyforge.org
Subject: [sup-devel] [PATCH] Add sent-save-to hook.
Date: Tue, 28 Aug 2012 21:42:10 -0400 [thread overview]
Message-ID: <1346204530-30793-1-git-send-email-ezyang@mit.edu> (raw)
From: "Edward Z. Yang" <ezyang@mit.edu>
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
---
lib/sup/modes/edit-message-mode.rb | 13 ++++++++++++-
lib/sup/sent.rb | 7 ++++---
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
index 5947ffd..2daffaf 100644
--- a/lib/sup/modes/edit-message-mode.rb
+++ b/lib/sup/modes/edit-message-mode.rb
@@ -69,6 +69,16 @@ Return value:
True if mail has been sent successfully, false otherwise.
EOS
+ HookManager.register "sent-save-to", <<EOS
+Configures where to save sent mail to. If this hook doesn't exist,
+the global sent setting will be used (possibly defaulting to sup://sent)
+Variables:
+ message: RMail::Message instance of the mail to send.
+ account: Account instance matching the From address
+Return value:
+ Source to save mail to, nil to use default
+EOS
+
attr_reader :status
attr_accessor :body, :header
bool_reader :edited
@@ -456,7 +466,8 @@ protected
raise SendmailCommandFailed, "Couldn't execute #{acct.sendmail}" unless $? == 0
end
- SentManager.write_sent_message(date, from_email) { |f| f.puts sanitize_body(m.to_s) }
+ SentManager.write_sent_message(HookManager.run("sent-save-to", :message => m, :account => acct),
+ date, from_email) { |f| f.puts sanitize_body(m.to_s) }
BufferManager.kill_buffer buffer
BufferManager.flash "Message sent!"
true
diff --git a/lib/sup/sent.rb b/lib/sup/sent.rb
index 0ca1fb1..e712dad 100644
--- a/lib/sup/sent.rb
+++ b/lib/sup/sent.rb
@@ -24,9 +24,10 @@ class SentManager
@source
end
- def write_sent_message date, from_email, &block
- @source.store_message date, from_email, &block
- PollManager.poll_from @source
+ def write_sent_message src, date, from_email, &block
+ use_src = src || @source
+ use_src.store_message date, from_email, &block
+ PollManager.poll_from use_src
end
end
--
1.7.11.3
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
reply other threads:[~2012-08-29 1:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1346204530-30793-1-git-send-email-ezyang@mit.edu \
--to=ezyang@mit.edu \
--cc=sup-devel@rubyforge.org \
/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