get_hostname_from_account(account_name) saves the day [yet another helper to make our lifes better :)]

This commit is contained in:
Nikos Kouremenos 2005-09-11 00:32:58 +00:00
parent 3428a8655e
commit 5321cbc636
2 changed files with 10 additions and 4 deletions

View File

@ -189,3 +189,11 @@ def get_jid_from_account(account_name):
hostname = config.get_per('accounts', account_name, 'hostname')
jid = name + '@' + hostname
return jid
def get_hostname_from_account(account_name):
'''returns hostname (if custom hostname is used, that is returned)'''
hostname = config.get_per('accounts', account_name, 'custom_host')
if hostname == '':
hostname = config.get_per('accounts', account_name, 'hostname')
return hostname

View File

@ -1694,8 +1694,7 @@ class AccountsWindow:
model.clear()
for account in gajim.connections:
iter = model.append()
model.set(iter, 0, account, 1, gajim.config.get_per('accounts',
account, 'hostname'))
model.set(iter, 0, account, 1, gajim.get_hostname_from_account(account))
def on_accounts_treeview_cursor_changed(self, widget):
'''Activate delete and modify buttons when a row is selected'''
@ -2076,8 +2075,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()
server_address = gajim.config.get_per('accounts', self.account,
'hostname')
server_address = gajim.get_hostname_from_account(self.account)
if server_address in self.latest_addresses:
self.latest_addresses.remove(server_address)
self.latest_addresses.insert(0, server_address)