Make SSL the default for connecting to a new network.

This commit is contained in:
Valentin Lorentz 2016-02-21 13:04:26 +01:00
parent b33dadea9e
commit c3dd5f8b64
3 changed files with 18 additions and 15 deletions

View File

@ -56,13 +56,14 @@ class Network(callbacks.Plugin):
@internationalizeDocstring
def connect(self, irc, msg, args, opts, network, server, password):
"""[--ssl] <network> [<host[:port]>] [<password>]
"""[--nossl] <network> [<host[:port]>] [<password>]
Connects to another network (which will be represented by the name
provided in <network>) at <host:port>. If port is not provided, it
defaults to 6667, the default port for IRC. If password is
provided, it will be sent to the server in a PASS command. If --ssl is
provided, an SSL connection will be attempted.
defaults to 6697, the default port for IRC with SSL. If password is
provided, it will be sent to the server in a PASS command. If --nossl is
provided, an SSL connection will not be attempted, and the port will
default to 6667.
"""
if '.' in network:
irc.error("Network names cannot have a '.' in them. "
@ -75,14 +76,16 @@ class Network(callbacks.Plugin):
# quite sure what to do about it.
except callbacks.Error:
pass
ssl = False
ssl = True
for (opt, arg) in opts:
if opt == 'ssl':
ssl = True
if opt == 'nossl':
ssl = False
if server:
if ':' in server:
(server, port) = server.split(':')
port = int(port)
elif ssl:
port = 6697
else:
port = 6667
serverPort = (server, port)

View File

@ -389,15 +389,15 @@ def main():
output("""Found %s (%s).""" % (serverString, ip))
if advanced:
# conf.supybot.networks.<network>.ssl
output("""Some servers allow you to use a secure connection via SSL.
This requires having pyOpenSSL installed.""")
if yn('Do you want to use an SSL connection?', default=False):
network.ssl.setValue(True)
# conf.supybot.networks.<network>.ssl
output("""Most networks allow you to use a secure connection via SSL.
If you are not sure whether this network supports SSL or not, check
its website.""")
if yn('Do you want to use an SSL connection?', default=True):
network.ssl.setValue(True)
output("""IRC servers almost always accept connections on port
6667 (or 6697 when using SSL). They can, however, accept connections
6697 (or 6667 when not using SSL). They can, however, accept connections
anywhere their admins feel like they want to accept connections from.""")
if yn('Does this server require connection on a non-standard port?',
default=False):

View File

@ -306,7 +306,7 @@ class ValidSaslMechanism(registry.OnlySomeStrings):
class SpaceSeparatedListOfSaslMechanisms(registry.SpaceSeparatedListOf):
Value = ValidSaslMechanism
def registerNetwork(name, password='', ssl=False, sasl_username='',
def registerNetwork(name, password='', ssl=True, sasl_username='',
sasl_password=''):
network = registerGroup(supybot.networks, name)
registerGlobalValue(network, 'password', registry.String(password,