summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-04-08 23:06:00 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2019-04-08 23:06:00 +0100
commitb5e8933ea03e129d46a73ccb2d3d3b358a0954d1 (patch)
tree8bcf21a47ac11128adc9240533a97215f4cf226f
parentdb2a22d09911d3af15f47ef4b2f045a793a15982 (diff)
downloadpoezio-b5e8933ea03e129d46a73ccb2d3d3b358a0954d1.tar.gz
poezio-b5e8933ea03e129d46a73ccb2d3d3b358a0954d1.tar.bz2
poezio-b5e8933ea03e129d46a73ccb2d3d3b358a0954d1.tar.xz
poezio-b5e8933ea03e129d46a73ccb2d3d3b358a0954d1.zip
core/commands: remove safeJID call in list command
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/core/commands.py12
1 files changed, 9 insertions, 3 deletions
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