diff options
Diffstat (limited to 'poezio/core/core.py')
-rw-r--r-- | poezio/core/core.py | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py index 5e3e912b..7553c57d 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -1164,7 +1164,7 @@ class Core: provided, we open a StaticConversationTab, else a DynamicConversationTab """ - if jid.resource: + if safeJID(jid).resource: new_tab = tabs.StaticConversationTab(self, jid) else: new_tab = tabs.DynamicConversationTab(self, jid) @@ -1179,12 +1179,7 @@ class Core: """ Open a Private conversation in a MUC and focus if needed. """ - 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 + complete_jid = room_name + '/' + user_nick # if the room exists, focus it and return for tab in self.get_tabs(tabs.PrivateTab): if tab.name == complete_jid: @@ -1210,15 +1205,10 @@ class Core: nick: str, *, password: Optional[str] = None, - focus=True) -> Optional[tabs.MucTab]: + focus=True) -> 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() @@ -1277,7 +1267,7 @@ class Core: if reason is None: reason = '\x195}You left the room\x193}' for tab in self.get_tabs(tabs.PrivateTab): - if tab.name.full.startswith(room_name): + if tab.name.startswith(room_name): tab.deactivate(reason=reason) def enable_private_tabs(self, room_name: str, @@ -1288,7 +1278,7 @@ class Core: if reason is None: reason = '\x195}You joined the room\x193}' for tab in self.get_tabs(tabs.PrivateTab): - if tab.name.full.startswith(room_name): + if tab.name.startswith(room_name): tab.activate(reason=reason) def on_user_changed_status_in_private(self, jid: JID, status: str) -> None: |