test server name in discover services windows. Fixes #4314

This commit is contained in:
Yann Leboulanger 2008-09-14 07:15:15 +00:00
parent f640e7c860
commit 85d5748800
1 changed files with 13 additions and 0 deletions

View File

@ -61,6 +61,7 @@ import search_window
from common import gajim from common import gajim
from common import xmpp from common import xmpp
from common.exceptions import GajimGeneralException from common.exceptions import GajimGeneralException
from common import helpers
# Dictionary mapping category, type pairs to browser class, image pairs. # Dictionary mapping category, type pairs to browser class, image pairs.
# This is a function, so we can call it after the classes are declared. # This is a function, so we can call it after the classes are declared.
@ -692,10 +693,22 @@ _('This type of service does not contain any items to browse.'))
if self.address_comboboxentry.get_active() != -1: if self.address_comboboxentry.get_active() != -1:
# user selected one of the entries so do auto-visit # user selected one of the entries so do auto-visit
jid = self.address_comboboxentry.child.get_text().decode('utf-8') jid = self.address_comboboxentry.child.get_text().decode('utf-8')
try:
jid = helpers.parse_jid(jid)
except helpers.InvalidFormat, s:
pritext = _('Invalid Server Name')
dialogs.ErrorDialog(pritext, str(s))
return
self.travel(jid, '') self.travel(jid, '')
def on_go_button_clicked(self, widget): def on_go_button_clicked(self, widget):
jid = self.address_comboboxentry.child.get_text().decode('utf-8') jid = self.address_comboboxentry.child.get_text().decode('utf-8')
try:
jid = helpers.parse_jid(jid)
except helpers.InvalidFormat, s:
pritext = _('Invalid Server Name')
dialogs.ErrorDialog(pritext, str(s))
return
if jid == self.jid: # jid has not changed if jid == self.jid: # jid has not changed
return return
if jid in self.latest_addresses: if jid in self.latest_addresses: