Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: sgoldman@tower-research.com (Steve Goldman)
Subject: [sup-talk] [PATCH] Display a default save path for attachments
Date: Sun, 23 Nov 2008 13:53:09 -0500	[thread overview]
Message-ID: <1227466312-sup-6661@sgoldmanlinux.tower-research.com> (raw)

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.
---
 lib/sup.rb                        |    1 +
 lib/sup/modes/thread-view-mode.rb |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/sup.rb b/lib/sup.rb
index 93369a5..92ace7d 100644
--- 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
index 5f578d3..011eccd 100644
--- a/lib/sup/modes/thread-view-mode.rb
+++ b/lib/sup/modes/thread-view-mode.rb
@@ -259,7 +259,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]
-- 
1.5.6.4
-- 

Steve Goldman
sgoldman at tower-research.com

T: 212.219.6014
F: 212.219.6007

Tower Research Capital, LLC
377 Broadway, 11th Fl.
New York, NY 10013


             reply	other threads:[~2008-11-23 18:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-23 18:53 Steve Goldman [this message]
2008-11-27  0:15 ` 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=1227466312-sup-6661@sgoldmanlinux.tower-research.com \
    --to=sgoldman@tower-research.com \
    /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