Skip to content

Commit 8abc143

Browse files
committed
* --ssl is kept so that existing scripts are not broken
* --ssl and --insecure result in an error * the ssl parameter is kept to minimize the amount of code changes (and to stay in sync with config files)
1 parent 95530c2 commit 8abc143

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

imapclient/interact.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ def command_line():
2525
help='Password to login with')
2626
p.add_option('-P', '--port', dest='port', action='store', type=int,
2727
default=None,
28-
help='IMAP port to use (default is 993 for TLS, or 143 for plaintext/STARTSSL)')
29-
p.add_option('-s', '--ssl', dest='ssl', action='store_true', default=True,
30-
help='Use SSL connection')
28+
help='IMAP port to use (default is 993 for TLS, or 143 otherwise)')
29+
p.add_option('-s', '--ssl', dest='ssl', action='store_true', default=None,
30+
help='Use SSL/TLS connection (default)')
31+
p.add_option('', '--insecure', dest='insecure', action='store_true', default=False,
32+
help='Use insecure connection (i.e. without SSL/TLS)')
3133
p.add_option('-f', '--file', dest='file', action='store', default=None,
3234
help='Config file (same as livetest)')
3335

@@ -36,11 +38,16 @@ def command_line():
3638
p.error('unexpected arguments %s' % ' '.join(args))
3739

3840
if opts.file:
39-
if opts.host or opts.username or opts.password or opts.port or opts.ssl:
41+
if opts.host or opts.username or opts.password or opts.port or opts.ssl or opts.insecure:
4042
p.error('If -f/--file is given no other options can be used')
4143
# Use the options in the config file
4244
opts = parse_config_file(opts.file)
4345
else:
46+
if opts.ssl and opts.insecure:
47+
p.error("Can't use --ssl and --insecure at the same time")
48+
49+
opts.ssl = not opts.insecure
50+
4451
# Scan through options, filling in defaults and prompting when
4552
# a compulsory option wasn't provided.
4653
compulsory_opts = ('host', 'username', 'password')

0 commit comments

Comments
 (0)