Feature #3625
closedimprovement of sample in lib/imap.rb: --starttls option
Description
=begin
なかだです。
lib/net/imap.rbを直接実行すると使える簡易IMAPクライアントを、
starttlsに対応させてみました。
Index: lib/net/imap.rb¶
--- lib/net/imap.rb (revision 28780)
+++ lib/net/imap.rb (working copy)
@@ -3472,7 +3472,8 @@ if FILE == $0
$auth = "login"
$ssl = false
-
$starttls = false
def usage
- $stderr.print <<EOF
- <<EOF
usage: #{$0} [options]
@@ -3481,4 +3482,5 @@ usage: #{$0} [options]
--user=USER specifies user
--auth=AUTH specifies auth type
- --starttls use starttls
--ssl use ssl
EOF
@@ -3511,4 +3513,5 @@ EOF
['--user', GetoptLong::REQUIRED_ARGUMENT],
['--auth', GetoptLong::REQUIRED_ARGUMENT], -
begin['--starttls', GetoptLong::NO_ARGUMENT], ['--ssl', GetoptLong::NO_ARGUMENT])
@@ -3523,20 +3526,20 @@ EOF
when "--ssl"
$ssl = true -
when "--starttls"
-
$starttls = true when "--debug" Net::IMAP.debug = true when "--help" usage
-
exit(1)
-
endexit end
rescue
- usage
- exit(1)
- abort usage
end
$host = ARGV.shift
unless $host
- usage
- exit(1)
- abort usage
end
@@ -3543,4 +3546,5 @@
imap = Net::IMAP.new($host, :port => $port, :ssl => $ssl)
begin
- imap.starttls if $starttls
password = get_password
imap.authenticate($auth, $user, password)
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦
=end
Updated by shugo (Shugo Maeda) about 15 years ago
=begin
前田です。
2010年7月29日12:16 Nobuyoshi Nakada nobu@ruby-lang.org:
lib/net/imap.rbを直接実行すると使える簡易IMAPクライアントを、
starttlsに対応させてみました。
ありがとうございます。こちらもcommitしていただけますか?
--
Shugo Maeda
=end
Updated by nobu (Nobuyoshi Nakada) about 15 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r28797.
Nobuyoshi, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end