@@ -25,9 +25,11 @@ def command_line():
25
25
help = 'Password to login with' )
26
26
p .add_option ('-P' , '--port' , dest = 'port' , action = 'store' , type = int ,
27
27
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)' )
31
33
p .add_option ('-f' , '--file' , dest = 'file' , action = 'store' , default = None ,
32
34
help = 'Config file (same as livetest)' )
33
35
@@ -36,11 +38,16 @@ def command_line():
36
38
p .error ('unexpected arguments %s' % ' ' .join (args ))
37
39
38
40
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 :
40
42
p .error ('If -f/--file is given no other options can be used' )
41
43
# Use the options in the config file
42
44
opts = parse_config_file (opts .file )
43
45
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
+
44
51
# Scan through options, filling in defaults and prompting when
45
52
# a compulsory option wasn't provided.
46
53
compulsory_opts = ('host' , 'username' , 'password' )
0 commit comments