From 0f344b899c0dff685795108fee4d2de850d92cd6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Wed, 6 Jun 2018 23:25:21 +0100
Subject: Initial impromptu command
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Add a command that invites people to a newly created room, with a random
localpart. The muc component is currently static. The interface
for the command might also change later on.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/core/commands.py    | 14 ++++++++++++++
 poezio/core/completions.py | 13 +++++++++++++
 poezio/core/core.py        | 30 ++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+)

diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index 5c8199c0..f301e801 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -763,6 +763,20 @@ 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):
+        """/impromptu <jid> [<jid> ...]"""
+
+        if args is None:
+            return self.help('impromptu')
+
+        jids = []
+        for jid in common.shell_split(' '.join(args)):
+            jids.append(safeJID(jid).bare)
+
+        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]"""
diff --git a/poezio/core/completions.py b/poezio/core/completions.py
index b283950e..87bb2d47 100644
--- a/poezio/core/completions.py
+++ b/poezio/core/completions.py
@@ -289,6 +289,19 @@ class CompletionCore:
             return Completion(
                 the_input.new_completion, rooms, n, '', quotify=True)
 
+    def impromptu(self, the_input):
+        """Completion for /impromptu"""
+        n = the_input.get_argument_position(quoted=True)
+        onlines = []
+        offlines = []
+        for barejid in roster.jids():
+            if len(roster[barejid]):
+                onlines.append(barejid)
+            else:
+                offlines.append(barejid)
+        comp = sorted(onlines) + sorted(offlines)
+        return Completion(the_input.new_completion, comp, n, quotify=True)
+
     def activity(self, the_input):
         """Completion for /activity"""
         n = the_input.get_argument_position(quoted=True)
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>
@@ -1788,6 +1811,13 @@ class Core:
             desc='Invite jid in room with reason.',
             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,
-- 
cgit v1.2.3


From b6fb719cc991b63f360ff46355b0f96a9aac2a0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Fri, 8 Jun 2018 23:40:41 +0100
Subject: Add configuration for default_muc server to join if no muc available
 on domain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/config.py    |  1 +
 poezio/core/core.py | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/poezio/config.py b/poezio/config.py
index a1f3dd49..d5a81c0e 100644
--- a/poezio/config.py
+++ b/poezio/config.py
@@ -49,6 +49,7 @@ DEFAULT_CONFIG = {
         'custom_host': '',
         'custom_port': '',
         'default_nick': '',
+        'default_muc_service': '',
         'deterministic_nick_colors': True,
         'device_id': '',
         'nick_color_aliases': True,
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 985dcbab..5090a211 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -877,10 +877,12 @@ class Core:
         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'
+        # Use config.default_muc_service as muc component if available,
+        # otherwise find muc component by disco#items-ing the user domain. If
+        # not, give up
+        default_muc = config.get('default_muc_service')
+        if not default_muc:
+            return
 
         nick = self.own_nick
         room = uuid.uuid4().hex + '@' + default_muc
-- 
cgit v1.2.3


From dc2808cdcc08624d323e9103e4fa4a7036f41a4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sat, 30 Jun 2018 22:41:19 +0100
Subject: Add error message if muc service not found
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/core/core.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/poezio/core/core.py b/poezio/core/core.py
index 5090a211..fc311ea3 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -882,6 +882,12 @@ class Core:
         # not, give up
         default_muc = config.get('default_muc_service')
         if not default_muc:
+            self.information(
+                "Error finding a MUC service to join. If your server does not "
+                "provide one, set 'default_muc_service' manually to a MUC "
+                "service that allows room creation.",
+                'Error'
+            )
             return
 
         nick = self.own_nick
-- 
cgit v1.2.3


From cf50ef2cf38a0366bcba7e45c254dc03e4fe981f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sun, 1 Jul 2018 01:40:52 +0100
Subject: Use identites from server for muc service
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/core/core.py     | 50 +++++++++++++++++++++++++++++++------------------
 poezio/core/handlers.py |  5 +++++
 2 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/poezio/core/core.py b/poezio/core/core.py
index fc311ea3..edec3b0c 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -877,27 +877,41 @@ class Core:
         contacts to join in.
         """
 
-        # Use config.default_muc_service as muc component if available,
-        # otherwise find muc component by disco#items-ing the user domain. If
-        # not, give up
-        default_muc = config.get('default_muc_service')
-        if not default_muc:
-            self.information(
-                "Error finding a MUC service to join. If your server does not "
-                "provide one, set 'default_muc_service' manually to a MUC "
-                "service that allows room creation.",
-                'Error'
-            )
-            return
+        def callback(results):
+            muc_from_identity = ''
+
+            for info in results:
+                for identity in info['disco_info']['identities']:
+                    if identity[0] == 'conference' and identity[1] == 'text':
+                        muc_from_identity = info['from'].bare
+
+            # Use config.default_muc_service as muc component if available,
+            # otherwise find muc component by disco#items-ing the user domain.
+            # If not, give up
+            default_muc = config.get('default_muc_service', muc_from_identity)
+            if not default_muc:
+                self.information(
+                    "Error finding a MUC service to join. If your server does not "
+                    "provide one, set 'default_muc_service' manually to a MUC "
+                    "service that allows room creation.",
+                    'Error'
+                )
+                return
+
+            nick = self.own_nick
+            room = uuid.uuid4().hex + '@' + default_muc
 
-        nick = self.own_nick
-        room = uuid.uuid4().hex + '@' + default_muc
+            self.open_new_room(room, nick).join()
+            self.information('Room %s created' % room, 'Info')
 
-        self.open_new_room(room, nick).join()
-        self.information('Room %s created' % room, 'Info')
+            for jid in jids:
+                self.invite(jid, room)
 
-        for jid in jids:
-            self.invite(jid, room)
+        asyncio.ensure_future(
+            self.xmpp['xep_0030'].get_info_from_domain(
+                callback=callback,
+            )
+        )
 
     def get_error_message(self, stanza, deprecated: bool = False):
         """
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py
index 0e655d68..b87e7307 100644
--- a/poezio/core/handlers.py
+++ b/poezio/core/handlers.py
@@ -97,6 +97,11 @@ class HandlerCore:
         self.core.xmpp.plugin['xep_0030'].get_info(
             jid=self.core.xmpp.boundjid.domain, callback=callback)
 
+    def find_identities(self, _):
+        asyncio.ensure_future(
+            self.core.xmpp['xep_0030'].get_info_from_domain(),
+        )
+
     def on_carbon_received(self, message):
         """
         Carbon <received/> received
-- 
cgit v1.2.3


From 0f6205d29bf9a42939e82914c905aab118be4fc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
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 <pep@bouah.net>
---
 poezio/core/commands.py        | 13 ++++--
 poezio/core/core.py            | 95 ++++++++++++++++++++++++++++--------------
 poezio/tabs/conversationtab.py |  6 +++
 3 files changed, 79 insertions(+), 35 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, [''])
diff --git a/poezio/core/core.py b/poezio/core/core.py
index edec3b0c..9ffa59a9 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -15,11 +15,14 @@ import shutil
 import time
 import uuid
 from collections import defaultdict
-from typing import Callable, Dict, List, Optional, Tuple, Type
+from typing import Callable, Dict, List, Optional, Set, Tuple, Type
+from xml.etree import cElementTree as ET
+from functools import partial
 
 from slixmpp import JID
 from slixmpp.util import FileSystemPerJidCache
 from slixmpp.xmlstream.handler import Callback
+from slixmpp.exceptions import IqError, IqTimeout
 
 from poezio import connection
 from poezio import decorators
@@ -869,7 +872,35 @@ class Core:
         self.xmpp.plugin['xep_0030'].get_info(
             jid=jid, timeout=5, callback=callback)
 
-    def impromptu(self, jids: List[JID]) -> None:
+    def _impromptu_room_form(self, room, _jids):
+        # TODO: Use jids to generate user-friendly room name and description
+        fields = [
+            {'ftype': 'hidden', 'var': 'FORM_TYPE', 'value': 'http://jabber.org/protocol/muc#roomconfig'},
+            {'ftype': 'text-single', 'var': 'muc#roomconfig_roomname', 'value': 'Foo'},
+            {'ftype': 'text-single', 'var': 'muc#roomconfig_roomdesc', 'value': 'Bar'},
+            {'ftype': 'boolean', 'var': 'muc#roomconfig_changesubject', 'value': True},
+            {'ftype': 'boolean', 'var': 'muc#roomconfig_allowinvites', 'value': True},
+            {'ftype': 'boolean', 'var': 'muc#roomconfig_persistent', 'value': True},
+            {'ftype': 'boolean', 'var': 'muc#roomconfig_membersonly', 'value': True},
+            {'ftype': 'boolean', 'var': 'muc#roomconfig_publicroom', 'value': False},
+            {'ftype': 'list-single', 'var': 'muc#roomconfig_allowpm', 'value': 'none'},
+            {'ftype': 'list-single', 'var': 'muc#roomconfig_whois', 'value': 'anyone'},
+        ]
+
+        form = self.xmpp['xep_0004'].make_form()
+        form['type'] = 'submit'
+        for field in fields:
+            form.add_field(**field)
+
+        iq = self.xmpp.Iq()
+        iq['type'] = 'set'
+        iq['to'] = room
+        query = ET.Element('{http://jabber.org/protocol/muc#owner}query')
+        query.append(form.xml)
+        iq.append(query)
+        return iq
+
+    async def impromptu(self, jids: Set[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
@@ -877,41 +908,43 @@ class Core:
         contacts to join in.
         """
 
-        def callback(results):
-            muc_from_identity = ''
+        results = await self.xmpp['xep_0030'].get_info_from_domain()
 
-            for info in results:
-                for identity in info['disco_info']['identities']:
-                    if identity[0] == 'conference' and identity[1] == 'text':
-                        muc_from_identity = info['from'].bare
+        muc_from_identity = ''
+        for info in results:
+            for identity in info['disco_info']['identities']:
+                if identity[0] == 'conference' and identity[1] == 'text':
+                    muc_from_identity = info['from'].bare
 
-            # Use config.default_muc_service as muc component if available,
-            # otherwise find muc component by disco#items-ing the user domain.
-            # If not, give up
-            default_muc = config.get('default_muc_service', muc_from_identity)
-            if not default_muc:
-                self.information(
-                    "Error finding a MUC service to join. If your server does not "
-                    "provide one, set 'default_muc_service' manually to a MUC "
-                    "service that allows room creation.",
-                    'Error'
-                )
-                return
+        # Use config.default_muc_service as muc component if available,
+        # otherwise find muc component by disco#items-ing the user domain.
+        # If not, give up
+        default_muc = config.get('default_muc_service', muc_from_identity)
+        if not default_muc:
+            self.information(
+                "Error finding a MUC service to join. If your server does not "
+                "provide one, set 'default_muc_service' manually to a MUC "
+                "service that allows room creation.",
+                'Error'
+            )
+            return
 
-            nick = self.own_nick
-            room = uuid.uuid4().hex + '@' + default_muc
+        nick = self.own_nick
+        room = uuid.uuid4().hex + '@' + default_muc
 
-            self.open_new_room(room, nick).join()
-            self.information('Room %s created' % room, 'Info')
+        self.open_new_room(room, nick).join()
+        iq = self._impromptu_room_form(room, jids)
+        try:
+            await iq.send()
+        except (IqError, IqTimeout):
+            self.information('Failed to create configure impromptu room.', 'Info')
+            # TODO: destroy? leave room.
+            return None
 
-            for jid in jids:
-                self.invite(jid, room)
+        self.information('Room %s created' % room, 'Info')
 
-        asyncio.ensure_future(
-            self.xmpp['xep_0030'].get_info_from_domain(
-                callback=callback,
-            )
-        )
+        for jid in jids:
+            self.invite(jid, room)
 
     def get_error_message(self, stanza, deprecated: bool = False):
         """
diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py
index 7e7a7488..94f1d719 100644
--- a/poezio/tabs/conversationtab.py
+++ b/poezio/tabs/conversationtab.py
@@ -79,6 +79,12 @@ class ConversationTab(OneToOneTab):
             ' allow you to see his presence, and allow them to'
             ' see your presence.',
             shortdesc='Add a user to your roster.')
+        self.register_command(
+            'invite',
+            self.core.command.impromptu,
+            desc='Invite people into an impromptu room.',
+            shortdesc='Invite other users to the discussion',
+            completion=self.core.completion.impromptu)
         self.update_commands()
         self.update_keys()
 
-- 
cgit v1.2.3


From ef47c3548a54ebc0418d8d76a5e0dbc55567d31d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sat, 24 Nov 2018 17:36:41 +0000
Subject: impromptu: shorten config field list formatting
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/core/core.py | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/poezio/core/core.py b/poezio/core/core.py
index 9ffa59a9..87f18468 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -875,22 +875,26 @@ class Core:
     def _impromptu_room_form(self, room, _jids):
         # TODO: Use jids to generate user-friendly room name and description
         fields = [
-            {'ftype': 'hidden', 'var': 'FORM_TYPE', 'value': 'http://jabber.org/protocol/muc#roomconfig'},
-            {'ftype': 'text-single', 'var': 'muc#roomconfig_roomname', 'value': 'Foo'},
-            {'ftype': 'text-single', 'var': 'muc#roomconfig_roomdesc', 'value': 'Bar'},
-            {'ftype': 'boolean', 'var': 'muc#roomconfig_changesubject', 'value': True},
-            {'ftype': 'boolean', 'var': 'muc#roomconfig_allowinvites', 'value': True},
-            {'ftype': 'boolean', 'var': 'muc#roomconfig_persistent', 'value': True},
-            {'ftype': 'boolean', 'var': 'muc#roomconfig_membersonly', 'value': True},
-            {'ftype': 'boolean', 'var': 'muc#roomconfig_publicroom', 'value': False},
-            {'ftype': 'list-single', 'var': 'muc#roomconfig_allowpm', 'value': 'none'},
-            {'ftype': 'list-single', 'var': 'muc#roomconfig_whois', 'value': 'anyone'},
+            ('hidden', 'FORM_TYPE', 'http://jabber.org/protocol/muc#roomconfig'),
+            ('text-single', 'muc#roomconfig_roomname', 'Foo'),
+            ('text-single', 'muc#roomconfig_roomdesc', 'Bar'),
+            ('boolean', 'muc#roomconfig_changesubject', True),
+            ('boolean', 'muc#roomconfig_allowinvites', True),
+            ('boolean', 'muc#roomconfig_persistent', True),
+            ('boolean', 'muc#roomconfig_membersonly', True),
+            ('boolean', 'muc#roomconfig_publicroom', False),
+            ('list-single', 'muc#roomconfig_whois', 'anyone'),
+            ('list-single', 'muc#roomconfig_allowpm', 'none'),
         ]
 
         form = self.xmpp['xep_0004'].make_form()
         form['type'] = 'submit'
         for field in fields:
-            form.add_field(**field)
+            form.add_field(
+                ftype=field[0],
+                var=field[1],
+                value=field[2],
+            )
 
         iq = self.xmpp.Iq()
         iq['type'] = 'set'
-- 
cgit v1.2.3


From 0f3f093cdc6507ece913cd86187e3bd0f3803e38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sat, 24 Nov 2018 18:19:59 +0000
Subject: impromptu: Incorporate feedback from daniel for muc options
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Adding missing MAM bits, removing the allowpm restriction, as clients
should already be using realjids when available.

I am leaving allowinvites for now as I think that should be in there,
but we can align ourselves later on if necessary, I'm not totally
against the idea.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/core/core.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/poezio/core/core.py b/poezio/core/core.py
index 87f18468..0480f33e 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -884,7 +884,10 @@ class Core:
             ('boolean', 'muc#roomconfig_membersonly', True),
             ('boolean', 'muc#roomconfig_publicroom', False),
             ('list-single', 'muc#roomconfig_whois', 'anyone'),
-            ('list-single', 'muc#roomconfig_allowpm', 'none'),
+            # MAM
+            ('boolean', 'muc#roomconfig_enablearchiving', True),  # Prosody
+            ('boolean', 'mam', True),  # Ejabberd community
+            ('boolean', 'muc#roomconfig_mam', True),  # Ejabberd saas
         ]
 
         form = self.xmpp['xep_0004'].make_form()
-- 
cgit v1.2.3


From 9e573c81cd098d879819510d063d3590c21ed52a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sun, 25 Nov 2018 00:42:08 +0000
Subject: Remove TODO comment about user-friendly muc name
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

See #3447 instead. This can be generated at runtime.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/core/core.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/poezio/core/core.py b/poezio/core/core.py
index 0480f33e..94b25a3d 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -873,7 +873,6 @@ class Core:
             jid=jid, timeout=5, callback=callback)
 
     def _impromptu_room_form(self, room, _jids):
-        # TODO: Use jids to generate user-friendly room name and description
         fields = [
             ('hidden', 'FORM_TYPE', 'http://jabber.org/protocol/muc#roomconfig'),
             ('text-single', 'muc#roomconfig_roomname', 'Foo'),
-- 
cgit v1.2.3


From 82da51cb3d1c806cecc105992b20c2493bcab403 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sat, 15 Dec 2018 23:06:34 +0000
Subject: impromptu: fix typo in log line
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/core/core.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/poezio/core/core.py b/poezio/core/core.py
index 94b25a3d..e601eace 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -943,7 +943,7 @@ class Core:
         try:
             await iq.send()
         except (IqError, IqTimeout):
-            self.information('Failed to create configure impromptu room.', 'Info')
+            self.information('Failed to configure impromptu room.', 'Info')
             # TODO: destroy? leave room.
             return None
 
-- 
cgit v1.2.3


From f86626a7f43d7669877de17c181596d7644e5cad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sat, 15 Dec 2018 23:28:46 +0000
Subject: impromptu: don't set roomname and roomdesc; remove jids argument
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

I was originally panning to generate a user-friendly room name with
them, but this can/should be done at runtime (in case it changes).

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/core/core.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/poezio/core/core.py b/poezio/core/core.py
index e601eace..54c33a0d 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -872,11 +872,9 @@ class Core:
         self.xmpp.plugin['xep_0030'].get_info(
             jid=jid, timeout=5, callback=callback)
 
-    def _impromptu_room_form(self, room, _jids):
+    def _impromptu_room_form(self, room):
         fields = [
             ('hidden', 'FORM_TYPE', 'http://jabber.org/protocol/muc#roomconfig'),
-            ('text-single', 'muc#roomconfig_roomname', 'Foo'),
-            ('text-single', 'muc#roomconfig_roomdesc', 'Bar'),
             ('boolean', 'muc#roomconfig_changesubject', True),
             ('boolean', 'muc#roomconfig_allowinvites', True),
             ('boolean', 'muc#roomconfig_persistent', True),
@@ -939,7 +937,7 @@ class Core:
         room = uuid.uuid4().hex + '@' + default_muc
 
         self.open_new_room(room, nick).join()
-        iq = self._impromptu_room_form(room, jids)
+        iq = self._impromptu_room_form(room)
         try:
             await iq.send()
         except (IqError, IqTimeout):
-- 
cgit v1.2.3


From 936e16f98f7b9cf4062de62cc9c5ef30b1e44820 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sat, 15 Dec 2018 23:50:11 +0000
Subject: impromptu: rework string format
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 poezio/core/core.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/poezio/core/core.py b/poezio/core/core.py
index 54c33a0d..01748659 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -934,7 +934,8 @@ class Core:
             return
 
         nick = self.own_nick
-        room = uuid.uuid4().hex + '@' + default_muc
+        localpart = uuid.uuid4().hex
+        room = '{!s}@{!s}'.format(localpart, default_muc)
 
         self.open_new_room(room, nick).join()
         iq = self._impromptu_room_form(room)
-- 
cgit v1.2.3


From 3ad55c746e1a28f457a5b1f26873097c263812a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sun, 16 Dec 2018 16:28:02 +0000
Subject: impromptu: add or update documentation for commands
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 doc/source/commands.rst | 11 +++++++++++
 poezio/core/core.py     |  6 +++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/doc/source/commands.rst b/doc/source/commands.rst
index f28f992f..d5424e61 100644
--- a/doc/source/commands.rst
+++ b/doc/source/commands.rst
@@ -218,6 +218,11 @@ These commands work in *any* tab.
     /invitations
         Show the pending invitations.
 
+   /impromptu
+        **Usage:** ``/impromptu <jid> [jid ..]``
+
+        Invite specified JIDs into a newly created room.
+
     /activity
         **Usage:** ``/activity [<general> [specific] [comment]]``
 
@@ -472,6 +477,12 @@ Normal Conversation tab commands
         Get the software version of the current interlocutor (usually its
         XMPP client and Operating System).
 
+   /invite
+        **Usage:** ``/invite <jid> [jid ..]``
+
+        Invite specified JIDs, with this contact, into a newly
+        created room.
+
 .. _rostertab-commands:
 
 Contact list tab commands
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 01748659..2ab34412 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -1874,9 +1874,9 @@ class Core:
         self.register_command(
             'impromptu',
             self.command.impromptu,
-            usage='<jid> [<jid> ...]',
-            desc='Invite people into an impromptu room',
-            shortdesc='Invite someone in a room.',
+            usage='<jid> [jid ...]',
+            desc='Invite specified JIDs into a newly created room.',
+            shortdesc='Invite specified JIDs into newly created room.',
             completion=self.completion.impromptu)
         self.register_command(
             'invitations',
-- 
cgit v1.2.3


From 91ee1211953fc4ad1407dee35c760abbf6b25d64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sun, 16 Dec 2018 16:40:15 +0000
Subject: impromptu: document default_muc_service
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 doc/source/configuration.rst | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 6baa6a27..da6d7954 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -81,6 +81,15 @@ and certificate validation.
         you know what you are doing, see the :ref:`ciphers` dedicated section
         for more details.
 
+    default_muc_service
+
+       **Default value:** ``[empty]``
+
+       If specified, will be used instead of the MUC service provided by
+       the user domain.
+
+       .. versionadded:: 0.13
+
     force_encryption
 
         **Default value:** ``true``
-- 
cgit v1.2.3


From 9b25abf9fbe8781dffa054d6483725c13df74a16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= <pep@bouah.net>
Date: Sun, 16 Dec 2018 16:41:53 +0000
Subject: impromptu: add versionadded info in doc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
---
 doc/source/commands.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/doc/source/commands.rst b/doc/source/commands.rst
index d5424e61..054f6ccd 100644
--- a/doc/source/commands.rst
+++ b/doc/source/commands.rst
@@ -223,6 +223,8 @@ These commands work in *any* tab.
 
         Invite specified JIDs into a newly created room.
 
+       .. versionadded:: 0.13
+
     /activity
         **Usage:** ``/activity [<general> [specific] [comment]]``
 
@@ -483,6 +485,8 @@ Normal Conversation tab commands
         Invite specified JIDs, with this contact, into a newly
         created room.
 
+       .. versionadded:: 0.13
+
 .. _rostertab-commands:
 
 Contact list tab commands
-- 
cgit v1.2.3