- default_labels, components =
- case type
- when :mbox
- $last_fn ||= ENV["MAIL"]
- fn = axe "What's the full path to the mbox file?", $last_fn #"srm
- return if fn.nil? || fn.empty?
-
- $last_fn = fn
- [Redwood::MBox::Loader.suggest_labels_for(fn),
- { :scheme => "mbox", :path => fn }]
- when :maildir
- $last_fn ||= ENV["MAIL"]
- fn = axe "What's the full path to the maildir directory?", $last_fn #"srm
- return if fn.nil? || fn.empty?
-
- $last_fn = fn
- [Redwood::Maildir.suggest_labels_for(fn),
- { :scheme => "maildir", :path => fn }]
- when :mboxssh
- $last_server ||= "localhost"
- srv = axe "What machine is the mbox file located on?", $last_server
- return if srv.nil? || srv.empty?
- $last_server = srv
-
- fn = axe "What's the path to the mbox file?", $last_fn #" stupid ruby-mode
- return if fn.nil? || fn.empty?
- $last_fn = fn
- fn = "/#{fn}" # lame
- [Redwood::MBox::SSHLoader.suggest_labels_for(fn),
- { :scheme => "mbox+ssh", :host => srv, :path => fn }]
- when :imap, :imaps
- $last_server ||= "localhost"
- srv = axe "What is the IMAP server (host, or host:port notation)?", $last_server
- return if srv.nil? || srv.empty?
- $last_server = srv
-
- $last_folder ||= "INBOX"
- fn = axe "What's the folder path?", $last_folder #"srm
- return if fn.nil? || fn.empty?
- $last_folder = fn
-
- fn = "/#{fn}" # lame
- if srv =~ /^(\S+):(\d+)$/
- host, port = $1, $2.to_i
- else
- host, port = srv, nil
- end
- [Redwood::IMAP.suggest_labels_for(fn),
- { :scheme => type.to_s, :host => host, :port => port, :path => fn }]
- end
-
- uri =
- begin
- URI::Generic.build components
- rescue URI::Error => e
- say "Whoopsie! I couldn't build a URI from that: #{e.message}"
- if axe_yes("Try again?") then next else return end
+ default_labels, components = case type
+ when :mbox
+ $last_fn ||= ENV["MAIL"]
+ fn = axe "What's the full path to the mbox file?", $last_fn
+ return if fn.nil? || fn.empty?
+
+ $last_fn = fn
+ [Redwood::MBox::Loader.suggest_labels_for(fn),
+ { :scheme => "mbox", :path => fn }]
+ when :maildir
+ $last_fn ||= ENV["MAIL"]
+ fn = axe "What's the full path to the maildir directory?", $last_fn
+ return if fn.nil? || fn.empty?
+
+ $last_fn = fn
+ [Redwood::Maildir.suggest_labels_for(fn),
+ { :scheme => "maildir", :path => fn }]
+ when :mboxssh
+ $last_server ||= "localhost"
+ srv = axe "What machine is the mbox file located on?", $last_server
+ return if srv.nil? || srv.empty?
+ $last_server = srv
+
+ fn = axe "What's the path to the mbox file?", $last_fn
+ return if fn.nil? || fn.empty?
+ $last_fn = fn
+ fn = "/#{fn}" # lame
+ [Redwood::MBox::SSHLoader.suggest_labels_for(fn),
+ { :scheme => "mbox+ssh", :host => srv, :path => fn }]
+ when :imap, :imaps
+ $last_server ||= "localhost"
+ srv = axe "What is the IMAP server (host, or host:port notation)?", $last_server
+ return if srv.nil? || srv.empty?
+ $last_server = srv
+
+ $last_folder ||= "INBOX"
+ fn = axe "What's the folder path?", $last_folder
+ return if fn.nil? || fn.empty?
+ $last_folder = fn
+
+ fn = "/#{fn}"
+ if srv =~ /^(\S+):(\d+)$/
+ host, port = $1, $2.to_i
+ else
+ host, port = srv, nil