Commit ef47c354 authored by Maxime Buquet's avatar Maxime Buquet

impromptu: shorten config field list formatting

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 0f6205d2
...@@ -875,22 +875,26 @@ class Core: ...@@ -875,22 +875,26 @@ class Core:
def _impromptu_room_form(self, room, _jids): def _impromptu_room_form(self, room, _jids):
# TODO: Use jids to generate user-friendly room name and description # TODO: Use jids to generate user-friendly room name and description
fields = [ fields = [
{'ftype': 'hidden', 'var': 'FORM_TYPE', 'value': 'http://jabber.org/protocol/muc#roomconfig'}, ('hidden', 'FORM_TYPE', 'http://jabber.org/protocol/muc#roomconfig'),
{'ftype': 'text-single', 'var': 'muc#roomconfig_roomname', 'value': 'Foo'}, ('text-single', 'muc#roomconfig_roomname', 'Foo'),
{'ftype': 'text-single', 'var': 'muc#roomconfig_roomdesc', 'value': 'Bar'}, ('text-single', 'muc#roomconfig_roomdesc', 'Bar'),
{'ftype': 'boolean', 'var': 'muc#roomconfig_changesubject', 'value': True}, ('boolean', 'muc#roomconfig_changesubject', True),
{'ftype': 'boolean', 'var': 'muc#roomconfig_allowinvites', 'value': True}, ('boolean', 'muc#roomconfig_allowinvites', True),
{'ftype': 'boolean', 'var': 'muc#roomconfig_persistent', 'value': True}, ('boolean', 'muc#roomconfig_persistent', True),
{'ftype': 'boolean', 'var': 'muc#roomconfig_membersonly', 'value': True}, ('boolean', 'muc#roomconfig_membersonly', True),
{'ftype': 'boolean', 'var': 'muc#roomconfig_publicroom', 'value': False}, ('boolean', 'muc#roomconfig_publicroom', False),
{'ftype': 'list-single', 'var': 'muc#roomconfig_allowpm', 'value': 'none'}, ('list-single', 'muc#roomconfig_whois', 'anyone'),
{'ftype': 'list-single', 'var': 'muc#roomconfig_whois', 'value': 'anyone'}, ('list-single', 'muc#roomconfig_allowpm', 'none'),
] ]
form = self.xmpp['xep_0004'].make_form() form = self.xmpp['xep_0004'].make_form()
form['type'] = 'submit' form['type'] = 'submit'
for field in fields: 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 = self.xmpp.Iq()
iq['type'] = 'set' iq['type'] = 'set'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment