#NEWLINE# @ internationalizeDocstring #NEWLINE# def connect( self , irc , msg , args , opts , network , server , password ) : #NEWLINE# #INDENT# '[--nossl] <network> [<host[:port]>] [<password>]\n\n        Connects to another network (which will be represented by the name\n        provided in <network>) at <host:port>.  If port is not provided, it\n        defaults to 6697, the default port for IRC with SSL.  If password is\n        provided, it will be sent to the server in a PASS command.  If --nossl is\n        provided, an SSL connection will not be attempted, and the port will\n        default to 6667.\n        ' #NEWLINE# if ( '.' in network ) : #NEWLINE# #INDENT# irc . error ( "Network names cannot have a '.' in them. Remember, this is the network name, not the actual server you plan to connect to." , Raise = True ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# otherIrc = self . _getIrc ( network ) #NEWLINE# irc . error ( ( _ ( "I'm already connected to %s." ) % network ) ) #NEWLINE# return #NEWLINE# #UNINDENT# except callbacks . Error : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# ssl = True #NEWLINE# for ( opt , arg ) in opts : #NEWLINE# #INDENT# if ( opt == 'nossl' ) : #NEWLINE# #INDENT# ssl = False #NEWLINE# #UNINDENT# #UNINDENT# if server : #NEWLINE# #INDENT# if ( ':' in server ) : #NEWLINE# #INDENT# ( server , port ) = server . split ( ':' ) #NEWLINE# port = int ( network ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ssl : #NEWLINE# #INDENT# port = 6697 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# port = 6667 #NEWLINE# #UNINDENT# #UNINDENT# serverPort = ( server , port ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# serverPort = conf . supybot . networks . get ( network ) . servers ( ) [ 0 ] #NEWLINE# #UNINDENT# except ( registry . NonExistentRegistryEntry , IndexError ) : #NEWLINE# #INDENT# irc . error ( _ ( 'A server must be provided if the network is not already registered.' ) ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# Owner = irc . getCallback ( 'Owner' ) #NEWLINE# newIrc = Owner . _connect ( network , serverPort = serverPort , password = password , ssl = ssl ) #NEWLINE# conf . supybot . networks ( ) . add ( network ) #NEWLINE# assert ( newIrc . callbacks is irc . callbacks ) , 'callbacks list is different' #NEWLINE# irc . replySuccess ( ( _ ( 'Connection to %s initiated.' ) % network ) )