impromptu: catch invalidJID exception for room jid

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <>
parent 11850bfe
......@@ -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)
room = JID(room_str)
except InvalidJID:
'The generated XMPP address is invalid: {!s}'.format(room_str),
return None
self.open_new_room(room, nick).join()
iq = self._impromptu_room_form(room)
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