From 6e593107e03e772bd10b5b43f2872bca375810e3 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 20 Nov 2005 13:27:37 +0000 Subject: [PATCH] get_hostname_from_account can now return the srv_hostname --- src/common/connection.py | 3 ++- src/common/gajim.py | 5 +++-- src/disco.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index 962333e5d..d052519af 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -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)) diff --git a/src/common/gajim.py b/src/common/gajim.py index e72ac5ec1..865d2a531 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -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') diff --git a/src/disco.py b/src/disco.py index cdb31585a..1c7a74320 100644 --- a/src/disco.py +++ b/src/disco.py @@ -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)