summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2019-11-21 02:49:04 +0100
committerMaxime “pep” Buquet <pep@bouah.net>2019-11-21 02:49:04 +0100
commit647655152f9f823f769c784d3602236066b10f34 (patch)
tree5a834deb5e99ac0dcd131b170f8d0ee7677f71d0
parentd65ad614b3b067b673f5782b454d779a2da829e7 (diff)
downloadpoezio-647655152f9f823f769c784d3602236066b10f34.tar.gz
poezio-647655152f9f823f769c784d3602236066b10f34.tar.bz2
poezio-647655152f9f823f769c784d3602236066b10f34.tar.xz
poezio-647655152f9f823f769c784d3602236066b10f34.zip
Remove safeJID call in destroy_room
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r--poezio/core/commands.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index 08e49898..b509d4a1 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -940,19 +940,25 @@ class CommandCore:
"disconnected", self.core.exit, disposable=True)
@command_args_parser.quoted(0, 1, [''])
- def destroy_room(self, args):
+ def destroy_room(self, args: List[str]) -> None:
"""
/destroy_room [JID]
"""
- room = safeJID(args[0]).bare
- if room:
- muc.destroy_room(self.core.xmpp, room)
- elif isinstance(self.core.tabs.current_tab,
- tabs.MucTab) and not args[0]:
+ if not args[0] and isinstance(self.core.tabs.current_tab, tabs.MucTab):
muc.destroy_room(self.core.xmpp,
self.core.tabs.current_tab.general_jid)
- else:
- self.core.information('Invalid JID: "%s"' % args[0], 'Error')
+ return None
+
+ try:
+ room = JID(args[0]).bare
+ if room:
+ muc.destroy_room(self.core.xmpp, room)
+ return None
+ except InvalidJID:
+ pass
+
+ self.core.information('Invalid JID: "%s"' % args[0], 'Error')
+ return None
@command_args_parser.quoted(1, 1, [''])
def bind(self, args):