From 77574f0fa2ce5cbc1558cec1ac4368cedbe8ec6a Mon Sep 17 00:00:00 2001 From: shugo Date: Wed, 23 Jun 2004 08:38:15 +0000 Subject: [PATCH] * lib/net/imap.rb: added new option --ssl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ lib/net/imap.rb | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8915fcdcad..af01a6af74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Jun 23 17:37:54 2004 Shugo Maeda + + * lib/net/imap.rb: added new option --ssl. + Wed Jun 23 01:45:27 2004 Dave Thomas * lib/rdoc/parsers/parse_rb.rb (RubyLex::identify_quotation): diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 666e883d68..d74d41ad6b 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -3161,9 +3161,10 @@ if __FILE__ == $0 require "getoptlong" $stdout.sync = true - $port = "imap2" + $port = nil $user = ENV["USER"] || ENV["LOGNAME"] - $auth = "cram-md5" + $auth = "login" + $ssl = false def usage $stderr.print < --port=PORT specifies port --user=USER specifies user --auth=AUTH specifies auth type + --ssl use ssl EOF end @@ -3201,7 +3203,8 @@ EOF ['--help', GetoptLong::NO_ARGUMENT], ['--port', GetoptLong::REQUIRED_ARGUMENT], ['--user', GetoptLong::REQUIRED_ARGUMENT], - ['--auth', GetoptLong::REQUIRED_ARGUMENT]) + ['--auth', GetoptLong::REQUIRED_ARGUMENT], + ['--ssl', GetoptLong::NO_ARGUMENT]) begin parser.each_option do |name, arg| case name @@ -3211,6 +3214,8 @@ EOF $user = arg when "--auth" $auth = arg + when "--ssl" + $ssl = true when "--debug" Net::IMAP.debug = true when "--help" @@ -3228,8 +3233,9 @@ EOF usage exit(1) end + $port ||= $ssl ? 993 : 143 - imap = Net::IMAP.new($host, $port) + imap = Net::IMAP.new($host, $port, $ssl) begin password = get_password imap.authenticate($auth, $user, password)