get_hostname_from_account can now return the srv_hostname
This commit is contained in:
parent
a2467b8a8d
commit
6e593107e0
|
@ -157,6 +157,7 @@ class Connection:
|
|||
self.vcard_shas = {} # sha of contacts
|
||||
self.status = ''
|
||||
self.old_show = ''
|
||||
self.connected_hostname = None
|
||||
self.time_to_reconnect = None
|
||||
self.new_account_info = None
|
||||
self.bookmarks = []
|
||||
|
@ -1606,7 +1607,7 @@ class Connection:
|
|||
self.dispatch('ERROR', (_('Could not connect to "%s"') % h,
|
||||
_('Check your connection or try again later.')))
|
||||
return None, ''
|
||||
|
||||
self.connected_hostname = host['host']
|
||||
con.RegisterDisconnectHandler(self._disconnectedReconnCB)
|
||||
gajim.log.debug(_('Connected to server %s:%s with %s') % (host['host'],
|
||||
host['port'], con_type))
|
||||
|
|
|
@ -262,9 +262,10 @@ def get_jid_from_account(account_name):
|
|||
jid = name + '@' + hostname
|
||||
return jid
|
||||
|
||||
def get_hostname_from_account(account_name):
|
||||
def get_hostname_from_account(account_name, use_srv = False):
|
||||
'''returns hostname (if custom hostname is used, that is returned)'''
|
||||
#FIXME: save srv record result and ask it here
|
||||
if use_srv and connections[account_name].connected_hostname:
|
||||
return connections[account_name].connected_hostname
|
||||
if config.get_per('accounts', account_name, 'use_custom_host'):
|
||||
return config.get_per('accounts', account_name, 'custom_host')
|
||||
return config.get_per('accounts', account_name, 'hostname')
|
||||
|
|
|
@ -452,7 +452,7 @@ _('Without a connection, you can not browse available services')).get_response()
|
|||
self.address_comboboxentry.set_model(liststore)
|
||||
self.address_comboboxentry.set_text_column(0)
|
||||
self.latest_addresses = gajim.config.get('latest_disco_addresses').split()
|
||||
jid = gajim.get_hostname_from_account(self.account)
|
||||
jid = gajim.get_hostname_from_account(self.account, True)
|
||||
if jid in self.latest_addresses:
|
||||
self.latest_addresses.remove(jid)
|
||||
self.latest_addresses.insert(0, jid)
|
||||
|
|
Loading…
Reference in New Issue