diff options
Diffstat (limited to 'poezio/core/commands.py')
-rw-r--r-- | poezio/core/commands.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py index 5c8199c0..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 @@ -763,6 +764,24 @@ class CommandCore: self.core.invite(to.full, room, reason=reason) self.core.information('Invited %s to %s' % (to.bare, room), 'Info') + @command_args_parser.quoted(1, 0) + def impromptu(self, args: str) -> None: + """/impromptu <jid> [<jid> ...]""" + + if args is None: + return self.help('impromptu') + + 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.add(safeJID(jid).bare) + + 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, ['']) def decline(self, args): """/decline <room@server.tld> [reason]""" |