diff options
Diffstat (limited to 'poezio/core/core.py')
-rw-r--r-- | poezio/core/core.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py index eec0d49b..985dcbab 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -13,6 +13,7 @@ import pipes import sys import shutil import time +import uuid from collections import defaultdict from typing import Callable, Dict, List, Optional, Tuple, Type @@ -868,6 +869,28 @@ class Core: self.xmpp.plugin['xep_0030'].get_info( jid=jid, timeout=5, callback=callback) + def impromptu(self, jids: List[JID]) -> None: + """ + Generates a new "Impromptu" room with a random localpart on the muc + component of the user who initiated the request. One the room is + created and the first user has joined, send invites for specified + contacts to join in. + """ + + # Use config.default_muc as muc component if available, otherwise + # find muc component by disco#items-ing the user domain. If not, give + # up + default_muc = 'chat.cluxia.eu' + + nick = self.own_nick + room = uuid.uuid4().hex + '@' + default_muc + + self.open_new_room(room, nick).join() + self.information('Room %s created' % room, 'Info') + + for jid in jids: + self.invite(jid, room) + def get_error_message(self, stanza, deprecated: bool = False): """ Takes a stanza of the form <message type='error'><error/></message> @@ -1789,6 +1812,13 @@ class Core: shortdesc='Invite someone in a room.', completion=self.completion.invite) self.register_command( + 'impromptu', + self.command.impromptu, + usage='<jid> [<jid> ...]', + desc='Invite people into an impromptu room', + shortdesc='Invite someone in a room.', + completion=self.completion.impromptu) + self.register_command( 'invitations', self.command.invitations, shortdesc='Show the pending invitations.') |