From: Dan Callaghan <dan@bl2.djc.id.au>
To: sup-commits@supmua.dev
Subject: [sup.git] 01/04: Add sent-save-to hook.
Date: Sat, 31 Oct 2026 20:01:13 +1100 [thread overview]
Message-ID: <20261031090112.AA7DE2C7287@bl2.djc.id.au> (raw)
In-Reply-To: <179343727252.62525.6154116323776963401@bl2.djc.id.au>
New commit on branch develop:
https://supmua.dev/git/sup/commit/d2315c480a83c8d54a77e4f7e588d66a12541c87.html
commit d2315c480a83c8d54a77e4f7e588d66a12541c87
Author: Edward Z. Yang <ezyang@mit.edu>
AuthorDate: Tue Aug 28 21:40:06 2012 -0400
Add sent-save-to hook.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
---
lib/sup/modes/edit_message_mode.rb | 13 ++++++++++++-
lib/sup/sent.rb | 9 +++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/lib/sup/modes/edit_message_mode.rb b/lib/sup/modes/edit_message_mode.rb
index e69a9bcc..f9de6434 100644
--- a/lib/sup/modes/edit_message_mode.rb
+++ b/lib/sup/modes/edit_message_mode.rb
@@ -80,6 +80,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
@@ -571,7 +581,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 1c702ceb..640303bb 100644
--- a/lib/sup/sent.rb
+++ b/lib/sup/sent.rb
@@ -24,13 +24,14 @@ class SentManager
@source
end
- def write_sent_message date, from_email, &block
+ def write_sent_message src, date, from_email, &block
::Thread.new do
debug "store the sent message (locking sent source..)"
- @source.synchronize do
- @source.store_message date, from_email, &block
+ use_src = src || @source
+ use_src.synchronize do
+ use_src.store_message date, from_email, &block
end
- PollManager.poll_from @source
+ PollManager.poll_from use_src
end
end
end
next prev parent reply other threads:[~2026-10-31 9:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 9:01 [sup.git] branch develop updated (ce4fb685 -> 1cfa015a) Dan Callaghan
2026-10-31 9:01 ` Dan Callaghan [this message]
2026-10-31 9:01 ` [sup.git] 02/04: tweak sent-save-to hook doc for clarity Dan Callaghan
2026-10-31 9:01 ` [sup.git] 03/04: sup-sync: handle message updates Dan Callaghan
2026-10-31 9:01 ` [sup.git] 04/04: clean up dead conditional in PollManager#poll_from Dan Callaghan
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=20261031090112.AA7DE2C7287@bl2.djc.id.au \
--to=dan@bl2.djc.id.au \
--cc=ezyang@mit.edu \
--cc=sup-commits@supmua.dev \
/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