* lib/net/imap.rb (example): support starttls option.
[ruby-dev:41888] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6d56e80ad1
commit
2d8228c28e
@ -1,3 +1,8 @@
|
|||||||
|
Fri Jul 30 12:38:22 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/net/imap.rb (example): support starttls option.
|
||||||
|
[ruby-dev:41888]
|
||||||
|
|
||||||
Fri Jul 30 08:51:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Jul 30 08:51:51 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (file_expand_path): home directory must be absolute.
|
* file.c (file_expand_path): home directory must be absolute.
|
||||||
|
@ -3471,15 +3471,17 @@ if __FILE__ == $0
|
|||||||
$user = ENV["USER"] || ENV["LOGNAME"]
|
$user = ENV["USER"] || ENV["LOGNAME"]
|
||||||
$auth = "login"
|
$auth = "login"
|
||||||
$ssl = false
|
$ssl = false
|
||||||
|
$starttls = false
|
||||||
|
|
||||||
def usage
|
def usage
|
||||||
$stderr.print <<EOF
|
<<EOF
|
||||||
usage: #{$0} [options] <host>
|
usage: #{$0} [options] <host>
|
||||||
|
|
||||||
--help print this message
|
--help print this message
|
||||||
--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
|
||||||
|
--starttls use starttls
|
||||||
--ssl use ssl
|
--ssl use ssl
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
@ -3510,6 +3512,7 @@ EOF
|
|||||||
['--port', GetoptLong::REQUIRED_ARGUMENT],
|
['--port', GetoptLong::REQUIRED_ARGUMENT],
|
||||||
['--user', GetoptLong::REQUIRED_ARGUMENT],
|
['--user', GetoptLong::REQUIRED_ARGUMENT],
|
||||||
['--auth', GetoptLong::REQUIRED_ARGUMENT],
|
['--auth', GetoptLong::REQUIRED_ARGUMENT],
|
||||||
|
['--starttls', GetoptLong::NO_ARGUMENT],
|
||||||
['--ssl', GetoptLong::NO_ARGUMENT])
|
['--ssl', GetoptLong::NO_ARGUMENT])
|
||||||
begin
|
begin
|
||||||
parser.each_option do |name, arg|
|
parser.each_option do |name, arg|
|
||||||
@ -3522,26 +3525,27 @@ EOF
|
|||||||
$auth = arg
|
$auth = arg
|
||||||
when "--ssl"
|
when "--ssl"
|
||||||
$ssl = true
|
$ssl = true
|
||||||
|
when "--starttls"
|
||||||
|
$starttls = true
|
||||||
when "--debug"
|
when "--debug"
|
||||||
Net::IMAP.debug = true
|
Net::IMAP.debug = true
|
||||||
when "--help"
|
when "--help"
|
||||||
usage
|
usage
|
||||||
exit(1)
|
exit
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
usage
|
abort usage
|
||||||
exit(1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
$host = ARGV.shift
|
$host = ARGV.shift
|
||||||
unless $host
|
unless $host
|
||||||
usage
|
abort usage
|
||||||
exit(1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
imap = Net::IMAP.new($host, :port => $port, :ssl => $ssl)
|
imap = Net::IMAP.new($host, :port => $port, :ssl => $ssl)
|
||||||
begin
|
begin
|
||||||
|
imap.starttls if $starttls
|
||||||
password = get_password
|
password = get_password
|
||||||
imap.authenticate($auth, $user, password)
|
imap.authenticate($auth, $user, password)
|
||||||
while true
|
while true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user