sup

A curses threads-with-tags style email client

sup.git

git clone https://supmua.dev/git/sup/
commit 9cc878a56824fc6056aa0f6f6937f32e484c499d
parent 2fad0bb34e5e3e1abbf65a28ba0318f7c81af555
Author: Steve Goldman <sgoldman@tower-research.com>
Date:   Sun, 23 Nov 2008 13:53:09 -0500

Display a default save path for attachments

Let the user specify a default path for saving attachments with
:default_attachment_save_dir: in config.yaml, and display this path in
front of the filename when saving an attachment in thread view mode.

Diffstat:
M lib/sup.rb | 1 +
M lib/sup/modes/thread-view-mode.rb | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -221,6 +221,7 @@ else
     :confirm_no_attachments => true,
     :confirm_top_posting => true,
     :discard_snippets_from_encrypted_messages => false,
+    :default_attachment_save_dir => "",
   }
   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
@@ -260,7 +260,7 @@ EOS
     chunk = @chunk_lines[curpos] or return
     case chunk
     when Chunk::Attachment
-      fn = BufferManager.ask_for_filename :filename, "Save attachment to file: ", chunk.filename
+      fn = BufferManager.ask_for_filename :filename, "Save attachment to file: ", ($config[:default_attachment_save_dir] + chunk.filename)
       save_to_file(fn) { |f| f.print chunk.raw_content } if fn
     else
       m = @message_lines[curpos]