From bf2225468e8f496a45db477b596eb7d233cb813f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Mon, 8 Apr 2019 13:49:57 +0100 Subject: Revert work on tabs module to change tab.name to JID. This reverts commits: d693479d05f1ada999c0e29a9d9e2f021dd59e50 2d0cc092fcd154b2d14be0c5ac0ff338607824a0 89a61b84bdb29d3df8c08436c3484fddba8d2ef1 8194d9afbdec2daa1377e07ebb26bb99406473d0 e256c31875c8b67d85fe30d3e2c14c896066657a a21335ac171a827a613dcce744898e822689c9d3 c96e528a8fd1313f75cb792a8e4826fbcfde1bec 0551867bfdb8dfa7dbd5964a15a1a950510e2c71 6ab49c188a6e5bb95773165f0bdbd672b41c8c81 --- poezio/core/core.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'poezio/core/core.py') 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: -- cgit v1.2.3