From b5e8933ea03e129d46a73ccb2d3d3b358a0954d1 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 23:06:00 +0100 Subject: core/commands: remove safeJID call in list command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/core/commands.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'poezio/core') diff --git a/poezio/core/commands.py b/poezio/core/commands.py index e785a93b..792474a6 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -8,6 +8,7 @@ log = logging.getLogger(__name__) import asyncio from xml.etree import cElementTree as ET +from typing import List from slixmpp import JID, InvalidJID from slixmpp.exceptions import XMPPError @@ -260,7 +261,7 @@ class CommandCore: self.core.refresh_window() @command_args_parser.quoted(0, 1) - def list(self, args): + def list(self, args: List[str]) -> None: """ /list [server] Opens a MucListTab containing the list of the room in the specified server @@ -268,12 +269,17 @@ class CommandCore: if args is None: return self.help('list') elif args: - jid = safeJID(args[0]) + try: + jid = JID(args[0]) + except InvalidJID: + return self.core.information('Invalid server %r' % jid, 'Error') else: if not isinstance(self.core.tabs.current_tab, tabs.MucTab): return self.core.information('Please provide a server', 'Error') - jid = safeJID(self.core.tabs.current_tab.name) + jid = self.core.tabs.current_tab.jid + if jid is None or not jid.domain: + return None list_tab = tabs.MucListTab(self.core, jid) self.core.add_tab(list_tab, True) cb = list_tab.on_muc_list_item_received -- cgit v1.2.3