1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
shugo 2004-06-23 08:38:15 +00:00
parent 417f9ec4aa
commit 77574f0fa2
2 changed files with 14 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Wed Jun 23 17:37:54 2004 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb: added new option --ssl.
Wed Jun 23 01:45:27 2004 Dave Thomas <dave@pragprog.com> Wed Jun 23 01:45:27 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/parsers/parse_rb.rb (RubyLex::identify_quotation): * lib/rdoc/parsers/parse_rb.rb (RubyLex::identify_quotation):

View file

@ -3161,9 +3161,10 @@ if __FILE__ == $0
require "getoptlong" require "getoptlong"
$stdout.sync = true $stdout.sync = true
$port = "imap2" $port = nil
$user = ENV["USER"] || ENV["LOGNAME"] $user = ENV["USER"] || ENV["LOGNAME"]
$auth = "cram-md5" $auth = "login"
$ssl = false
def usage def usage
$stderr.print <<EOF $stderr.print <<EOF
@ -3173,6 +3174,7 @@ usage: #{$0} [options] <host>
--port=PORT specifies port --port=PORT specifies port
--user=USER specifies user --user=USER specifies user
--auth=AUTH specifies auth type --auth=AUTH specifies auth type
--ssl use ssl
EOF EOF
end end
@ -3201,7 +3203,8 @@ EOF
['--help', GetoptLong::NO_ARGUMENT], ['--help', GetoptLong::NO_ARGUMENT],
['--port', GetoptLong::REQUIRED_ARGUMENT], ['--port', GetoptLong::REQUIRED_ARGUMENT],
['--user', GetoptLong::REQUIRED_ARGUMENT], ['--user', GetoptLong::REQUIRED_ARGUMENT],
['--auth', GetoptLong::REQUIRED_ARGUMENT]) ['--auth', GetoptLong::REQUIRED_ARGUMENT],
['--ssl', GetoptLong::NO_ARGUMENT])
begin begin
parser.each_option do |name, arg| parser.each_option do |name, arg|
case name case name
@ -3211,6 +3214,8 @@ EOF
$user = arg $user = arg
when "--auth" when "--auth"
$auth = arg $auth = arg
when "--ssl"
$ssl = true
when "--debug" when "--debug"
Net::IMAP.debug = true Net::IMAP.debug = true
when "--help" when "--help"
@ -3228,8 +3233,9 @@ EOF
usage usage
exit(1) exit(1)
end end
$port ||= $ssl ? 993 : 143
imap = Net::IMAP.new($host, $port) imap = Net::IMAP.new($host, $port, $ssl)
begin begin
password = get_password password = get_password
imap.authenticate($auth, $user, password) imap.authenticate($auth, $user, password)