diff options
Diffstat (limited to 'poezio/core')
-rw-r--r-- | poezio/core/commands.py | 3 | ||||
-rw-r--r-- | poezio/core/core.py | 14 |
2 files changed, 14 insertions, 3 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py index e785a93b..f7946b71 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -369,7 +369,8 @@ class CommandCore: # New tab if tab is None: tab = self.core.open_new_room(room, nick, password=password) - tab.join() + if tab is not None: + tab.join() else: self.core.focus_tab(tab) if tab.own_nick == nick and tab.joined: diff --git a/poezio/core/core.py b/poezio/core/core.py index 7553c57d..91eb4877 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -1179,7 +1179,12 @@ class Core: """ Open a Private conversation in a MUC and focus if needed. """ - complete_jid = room_name + '/' + user_nick + try: + complete_jid_str = room_name + '/' + user_nick + complete_jid = JID(complete_jid_str) + except InvalidJID: + self.information('Invalid XMPP address %r for chat tab.', complete_jid_str) + return None # if the room exists, focus it and return for tab in self.get_tabs(tabs.PrivateTab): if tab.name == complete_jid: @@ -1205,10 +1210,15 @@ class Core: nick: str, *, password: Optional[str] = None, - focus=True) -> tabs.MucTab: + focus=True) -> Optional[tabs.MucTab]: """ Open a new tab.MucTab containing a muc Room, using the specified nick """ + try: + room = JID(room) + except InvalidJID: + self.information('Invalid XMPP address %r for chat tab.', room) + return None new_tab = tabs.MucTab(self, room, nick, password=password) self.add_tab(new_tab, focus) self.refresh_window() |