summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-06-23 08:38:15 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-06-23 08:38:15 +0000
commitbc7fc82d2eaac50fefe649f441e1f9575f2f0541 (patch)
tree87138326a03f98c4211725063041d224571b15d0 /lib
parent9dc2199eff99e8015ed2ab1ed5d375a613c40567 (diff)
downloadruby-bc7fc82d2eaac50fefe649f441e1f9575f2f0541.tar.gz
ruby-bc7fc82d2eaac50fefe649f441e1f9575f2f0541.tar.xz
ruby-bc7fc82d2eaac50fefe649f441e1f9575f2f0541.zip
* lib/net/imap.rb: added new option --ssl.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/imap.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 666e883d6..d74d41ad6 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 <<EOF
@@ -3173,6 +3174,7 @@ usage: #{$0} [options] <host>
--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)