'Connect to jabber server. If you want to specify different ip/port to connect to you can
pass it as tuple as first parameter. If there is HTTP proxy between you and server
specify it\'s address and credentials (if needed) in the second argument.
If you want ssl/tls support to be discovered and enable automatically - leave third argument as None. (ssl will be autodetected only if port is 5223 or 443)
If you want to force SSL start (i.e. if port 5223 or 443 is remapped to some non-standard port) then set it to 1.
If you want to disable tls/ssl support completely, set it to 0.
Example: connect((\'192.168.5.5\',5222),{\'host\':\'proxy.my.net\',\'port\':8080,\'user\':\'me\',\'password\':\'secret\'})
Returns \'\' or \'tcp\' or \'tls\', depending on the result.'

def connect(self, server=None, proxy=None, secure=None, use_srv=True):

    if ((not CommonClient.connect(self, server, proxy, secure, use_srv)) or ((secure != None) and (not secure))):
        return self.connected
    transports.TLS().PlugIn(self)
    if ((not self.Dispatcher.Stream._document_attrs.has_key('version')) or (not (self.Dispatcher.Stream._document_attrs['version'] == '1.0'))):
        return self.connected
    while ((not self.Dispatcher.Stream.features) and self.Process(1)):
        pass
    if (not self.Dispatcher.Stream.features.getTag('starttls')):
        return self.connected
    while ((not self.TLS.starttls) and self.Process(1)):
        pass
    if ((not hasattr(self, 'TLS')) or (self.TLS.starttls != 'success')):
        self.event('tls_failed')
        return self.connected
    self.connected = 'tls'
    return self.connected
