From 396af5ad95a9307a456fa29b3bdd55b1bfef0660 Mon Sep 17 00:00:00 2001 From: wmorgan Date: Wed, 3 Jan 2007 06:40:17 +0000 Subject: [PATCH] minor tweaks and bugfixes git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@152 5c8cc53c-5e98-4d25-b20a-d8db53a31250 --- bin/sup-import | 1 - lib/sup/imap.rb | 7 +++++-- lib/sup/mbox/ssh-file.rb | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/sup-import b/bin/sup-import index 0982aec..9b27887 100644 --- a/bin/sup-import +++ b/bin/sup-import @@ -95,7 +95,6 @@ def get_login_info uri, sources [username, password] end - educate_user if ARGV.member? '--help' archive = ARGV.delete "--archive" diff --git a/lib/sup/imap.rb b/lib/sup/imap.rb index 715a98e..bd7dc82 100644 --- a/lib/sup/imap.rb +++ b/lib/sup/imap.rb @@ -48,7 +48,7 @@ class IMAP < Source @ids = [] @labels = [:unread] @labels << :inbox unless archived? - @labels << mailbox.intern unless mailbox =~ /inbox/i || mailbox.nil? + @labels << mailbox.intern unless mailbox =~ /inbox/i @mutex = Mutex.new end @@ -122,7 +122,10 @@ class IMAP < Source def host; @parsed_uri.host; end def port; @parsed_uri.port || (ssl? ? 993 : 143); end - def mailbox; @parsed_uri.path[1..-1] || 'INBOX'; end + def mailbox + x = @parsed_uri.path[1..-1] + x.empty? ? 'INBOX' : x + end def ssl?; @parsed_uri.scheme == 'imaps' end def load_header id diff --git a/lib/sup/mbox/ssh-file.rb b/lib/sup/mbox/ssh-file.rb index c2479a8..80211d0 100644 --- a/lib/sup/mbox/ssh-file.rb +++ b/lib/sup/mbox/ssh-file.rb @@ -171,10 +171,9 @@ private begin retries = 0 connect - # MBox::debug "sending command: #{cmd.inspect}" + MBox::debug "sending command: #{cmd.inspect}" begin result = @shell.send_command cmd - result = @shell.sync { @shell.send_command cmd } raise SSHFileError, "Failure during remote command #{cmd.inspect}: #{(result.stderr || result.stdout || "")[0 .. 100]}" unless result.status == 0 rescue Net::SSH::Exception # these happen occasionally for no apparent reason. gotta love that nondeterminism! retry if (retries += 1) <= 3 -- 2.45.2