def _set_form_values(xmpp, room, form=None):
    """Creates/Updates an XMPP room config form"""
    if form is None:
        form = xmpp.plugin['xep_0004'].make_form(ftype='submit')
        form.add_field('FORM_TYPE', value='http://jabber.org/protocol/muc#roomconfig')
        form.add_field('muc#roomconfig_publicroom', value='1')
        form.add_field('muc#roomconfig_whois', value='moderators')
        form.add_field('muc#roomconfig_membersonly', value='0')
        form.add_field('muc#roomconfig_moderatedroom', value='1')
        form.add_field('muc#roomconfig_changesubject', value='1')
        form.add_field('muc#roomconfig_allowinvites', value='1')
        form.add_field('muc#roomconfig_allowvisitorstatus', value='1')
        form.add_field('muc#roomconfig_allowvisitornickchange', value='1')
        form.add_field('muc#roomconfig_enablelogging', value='1')
        form.add_field('public_list', value='1')
        form.add_field('members_by_default', value='1')
        form.add_field('allow_private_messages', value='1')
        form.add_field('allow_query_users', value='1')
    form.add_field('muc#roomconfig_persistentroom', value='1')
    form.add_field('muc#roomconfig_roomname', value=room.name)
    form.add_field('muc#roomconfig_passwordprotectedroom', value='1' if room.password else '0')
    if room.description:
        form.add_field('muc#roomconfig_roomdesc', value=room.description)
    if room.password:
        form.add_field('muc#roomconfig_roomsecret', value=room.password)
    return form
def _set_form_values ( xmpp , room , form = None ) : if form is None : form = xmpp . plugin [ 'xep_0004' ] . make_form ( ftype = 'submit' ) form . add_field ( 'FORM_TYPE' , value = 'http://jabber.org/protocol/muc#roomconfig' ) form . add_field ( 'muc#roomconfig_publicroom' , value = '1' ) form . add_field ( 'muc#roomconfig_whois' , value = 'moderators' ) form . add_field ( 'muc#roomconfig_membersonly' , value = '0' ) form . add_field ( 'muc#roomconfig_moderatedroom' , value = '1' ) form . add_field ( 'muc#roomconfig_changesubject' , value = '1' ) form . add_field ( 'muc#roomconfig_allowinvites' , value = '1' ) form . add_field ( 'muc#roomconfig_allowvisitorstatus' , value = '1' ) form . add_field ( 'muc#roomconfig_allowvisitornickchange' , value = '1' ) form . add_field ( 'muc#roomconfig_enablelogging' , value = '1' ) form . add_field ( 'public_list' , value = '1' ) form . add_field ( 'members_by_default' , value = '1' ) form . add_field ( 'allow_private_messages' , value = '1' ) form . add_field ( 'allow_query_users' , value = '1' ) form . add_field ( 'muc#roomconfig_persistentroom' , value = '1' ) form . add_field ( 'muc#roomconfig_roomname' , value = room . name ) form . add_field ( 'muc#roomconfig_passwordprotectedroom' , value = '1' if room . password else '0' ) if room . description : form . add_field ( 'muc#roomconfig_roomdesc' , value = room . description ) if room . password : form . add_field ( 'muc#roomconfig_roomsecret' , value = room . password ) return form
Creates/Updates an XMPP room config form