summaryrefslogtreecommitdiff
path: root/poezio/core/commands.py
diff options
context:
space:
mode:
authorMaxime Buquet <pep@bouah.net>2018-12-16 17:59:59 +0100
committerMaxime Buquet <pep@bouah.net>2018-12-16 17:59:59 +0100
commit8a23706b72a0f19405581e20c132fb442a960250 (patch)
tree6c8cc5297ed16f5f348825b85f9e7d6ac504ed00 /poezio/core/commands.py
parentc3e9130d7d8bb290118b95deba2b7168c0dc8647 (diff)
parent9b25abf9fbe8781dffa054d6483725c13df74a16 (diff)
downloadpoezio-8a23706b72a0f19405581e20c132fb442a960250.tar.gz
poezio-8a23706b72a0f19405581e20c132fb442a960250.tar.bz2
poezio-8a23706b72a0f19405581e20c132fb442a960250.tar.xz
poezio-8a23706b72a0f19405581e20c132fb442a960250.zip
Merge branch 'invite_impromptu' into 'master'
Invite impromptu See merge request poezio/poezio!2
Diffstat (limited to 'poezio/core/commands.py')
-rw-r--r--poezio/core/commands.py19
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]"""