summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-04-07 20:41:52 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2019-04-07 20:41:52 +0100
commitcdd4a99c4522b596288ac006da451e5f89b3b50f (patch)
tree86fefa7497fc2d1d9a75442bc993a3b2b50055af
parent11850bfe1d411d76c409667583f84038c353db54 (diff)
downloadpoezio-cdd4a99c4522b596288ac006da451e5f89b3b50f.tar.gz
poezio-cdd4a99c4522b596288ac006da451e5f89b3b50f.tar.bz2
poezio-cdd4a99c4522b596288ac006da451e5f89b3b50f.tar.xz
poezio-cdd4a99c4522b596288ac006da451e5f89b3b50f.zip
impromptu: catch invalidJID exception for room jid
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/core/core.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py
index b491eb00..7553c57d 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -19,7 +19,7 @@ from typing import Callable, Dict, List, Optional, Set, Tuple, Type
from xml.etree import cElementTree as ET
from functools import partial
-from slixmpp import JID
+from slixmpp import JID, InvalidJID
from slixmpp.util import FileSystemPerJidCache
from slixmpp.xmlstream.handler import Callback
from slixmpp.exceptions import IqError, IqTimeout
@@ -937,7 +937,15 @@ class Core:
nick = self.own_nick
localpart = uuid.uuid4().hex
- room = '{!s}@{!s}'.format(localpart, default_muc)
+ room_str = '{!s}@{!s}'.format(localpart, default_muc)
+ try:
+ room = JID(room_str)
+ except InvalidJID:
+ self.information(
+ 'The generated XMPP address is invalid: {!s}'.format(room_str),
+ 'Error'
+ )
+ return None
self.open_new_room(room, nick).join()
iq = self._impromptu_room_form(room)