From 0f6205d29bf9a42939e82914c905aab118be4fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 24 Nov 2018 04:36:19 +0000 Subject: Add /invite for ConversationTab to generate new room with all invitees 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 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'poezio/core/commands.py') diff --git a/poezio/core/commands.py b/poezio/core/commands.py index f301e801..86df9a93 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -6,6 +6,7 @@ import logging log = logging.getLogger(__name__) +import asyncio from xml.etree import cElementTree as ET from slixmpp.exceptions import XMPPError @@ -764,17 +765,21 @@ class CommandCore: self.core.information('Invited %s to %s' % (to.bare, room), 'Info') @command_args_parser.quoted(1, 0) - def impromptu(self, args): + def impromptu(self, args: str) -> None: """/impromptu [ ...]""" if args is None: return self.help('impromptu') - jids = [] + jids = set() + current_tab = self.core.tabs.current_tab + if isinstance(current_tab, tabs.ConversationTab): + jids.add(current_tab.general_jid) + for jid in common.shell_split(' '.join(args)): - jids.append(safeJID(jid).bare) + jids.add(safeJID(jid).bare) - self.core.impromptu(jids) + asyncio.ensure_future(self.core.impromptu(jids)) self.core.information('Invited %s to a random room' % (' '.join(jids)), 'Info') @command_args_parser.quoted(1, 1, ['']) -- cgit v1.2.3