don't try only last_connection_type, but try it it first. Fixes #7002

This commit is contained in:
Yann Leboulanger 2012-08-19 22:35:46 +02:00
parent 96cb66c04d
commit aaccec79cf
1 changed files with 6 additions and 3 deletions

View File

@ -1102,13 +1102,16 @@ class Connection(CommonConnection, ConnectionHandlers):
log.debug('Connection to next host') log.debug('Connection to next host')
if len(self._hosts): if len(self._hosts):
# No config option exist when creating a new account # No config option exist when creating a new account
if self.last_connection_type: if self.name in gajim.config.get_per('accounts'):
self._connection_types = [self.last_connection_type]
elif self.name in gajim.config.get_per('accounts'):
self._connection_types = gajim.config.get_per('accounts', self.name, self._connection_types = gajim.config.get_per('accounts', self.name,
'connection_types').split() 'connection_types').split()
else: else:
self._connection_types = ['tls', 'ssl', 'plain'] self._connection_types = ['tls', 'ssl', 'plain']
if self.last_connection_type:
if self.last_connection_type in self._connection_types:
self._connection_types.remove(self.last_connection_type)
self._connection_types.insert(0, self.last_connection_type)
if self._proxy and self._proxy['type']=='bosh': if self._proxy and self._proxy['type']=='bosh':
# with BOSH, we can't do TLS negotiation with <starttls>, we do only "plain" # with BOSH, we can't do TLS negotiation with <starttls>, we do only "plain"