Commit 2b3e1048 authored by Philipp Hörist's avatar Philipp Hörist

Use validate_jid in more places

parent a2f2028b
......@@ -18,14 +18,13 @@ import random
from gi.repository import Gtk
from gi.repository import Gdk
from nbxmpp.protocol import InvalidJid
from nbxmpp.protocol import JID
from nbxmpp.util import is_error_result
from gajim.common import app
from gajim.common.const import MUC_CREATION_EXAMPLES
from gajim.common.const import MUC_DISCO_ERRORS
from gajim.common.i18n import _
from gajim.common.helpers import validate_jid
from gajim.gtk.dialogs import ErrorDialog
from gajim.gtk.util import get_builder
......@@ -126,11 +125,11 @@ class CreateGroupchatWindow(Gtk.ApplicationWindow):
return
try:
jid = JID(text)
jid = validate_jid(text)
if jid.getResource():
raise InvalidJid
raise ValueError
except InvalidJid:
except ValueError:
self._set_warning(_('Invalid Address'))
else:
self._set_warning_icon(False)
......
......@@ -20,12 +20,11 @@ from gi.repository import Gtk
from gi.repository import GLib
from gi.repository import Pango
from nbxmpp.protocol import InvalidJid
from nbxmpp.protocol import JID
from nbxmpp.util import is_error_result
from gajim.common import app
from gajim.common import helpers
from gajim.common.helpers import validate_jid
from gajim.common.i18n import _
from gajim.common.const import AvatarSize
from gajim.common.const import MUC_DISCO_ERRORS
......@@ -249,8 +248,8 @@ class StartChatDialog(Gtk.ApplicationWindow):
def _start_new_chat(self, row):
if row.new:
try:
JID(row.jid)
except InvalidJid as error:
validate_jid(row.jid)
except ValueError as error:
self._show_error_page(error)
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment