diff options
author | Maxime “pep” Buquet <pep@bouah.net> | 2018-11-24 04:36:19 +0000 |
---|---|---|
committer | Maxime “pep” Buquet <pep@bouah.net> | 2018-12-16 16:57:48 +0000 |
commit | 0f6205d29bf9a42939e82914c905aab118be4fc7 (patch) | |
tree | 9ed907636b48cf61fc09ecbbc82badc25d8ed62f /poezio/core/commands.py | |
parent | cf50ef2cf38a0366bcba7e45c254dc03e4fe981f (diff) | |
download | poezio-0f6205d29bf9a42939e82914c905aab118be4fc7.tar.gz poezio-0f6205d29bf9a42939e82914c905aab118be4fc7.tar.bz2 poezio-0f6205d29bf9a42939e82914c905aab118be4fc7.tar.xz poezio-0f6205d29bf9a42939e82914c905aab118be4fc7.zip |
Add /invite for ConversationTab to generate new room with all invitees
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'poezio/core/commands.py')
-rw-r--r-- | poezio/core/commands.py | 13 |
1 files changed, 9 insertions, 4 deletions
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 <jid> [<jid> ...]""" 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, ['']) |