diff options
author | Maxime “pep” Buquet <pep@bouah.net> | 2018-11-24 17:36:41 +0000 |
---|---|---|
committer | Maxime “pep” Buquet <pep@bouah.net> | 2018-12-16 16:57:48 +0000 |
commit | ef47c3548a54ebc0418d8d76a5e0dbc55567d31d (patch) | |
tree | ab09c203d462c6a0958264ddfd233563f736d103 | |
parent | 0f6205d29bf9a42939e82914c905aab118be4fc7 (diff) | |
download | poezio-ef47c3548a54ebc0418d8d76a5e0dbc55567d31d.tar.gz poezio-ef47c3548a54ebc0418d8d76a5e0dbc55567d31d.tar.bz2 poezio-ef47c3548a54ebc0418d8d76a5e0dbc55567d31d.tar.xz poezio-ef47c3548a54ebc0418d8d76a5e0dbc55567d31d.zip |
impromptu: shorten config field list formatting
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
-rw-r--r-- | poezio/core/core.py | 26 |
1 files 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' |