def add_global_options(section, options): for option in options: OPTIONS.options[option.name] = W.config_new_option( config_file, section, option.name, option.type, option.description, option.string_values, option.min, option.max, option.value, option.value, 0, "", "", "matrix_config_change_cb", "", "", "")
def _create_options(self, config_file): options = [ Option('autoconnect', 'boolean', '', 0, 0, 'off', ("automatically connect to the matrix server when weechat " "is starting")), Option('address', 'string', '', 0, 0, '', "Hostname or IP address for the server"), Option('port', 'integer', '', 0, 65535, '8448', "Port for the server"), Option('proxy', 'string', '', 0, 0, '', ("Name of weechat proxy to use (see /help proxy)")), Option('ssl_verify', 'boolean', '', 0, 0, 'on', ("Check that the SSL connection is fully trusted")), Option('username', 'string', '', 0, 0, '', "Username to use on server"), Option( 'password', 'string', '', 0, 0, '', ("Password for server (note: content is evaluated, see /help " "eval)")), Option('device_name', 'string', '', 0, 0, 'Weechat Matrix', "Device name to use while logging in to the matrix server"), ] section = W.config_search_section(config_file, 'server') for option in options: option_name = "{server}.{option}".format(server=self.name, option=option.name) self.options[option.name] = W.config_new_option( config_file, section, option_name, option.type, option.description, option.string_values, option.min, option.max, option.value, option.value, 0, "", "", "matrix_config_server_change_cb", self.name, "", "")
def _add_option(self, option): cb = option.change_callback.__name__ if option.change_callback else "" option_ptr = W.config_new_option( self._config_ptr, self._ptr, option.name, option.type, option.description, option.string_values, option.min, option.max, option.value, option.value, 0, "", "", cb, "", "", "", ) self._option_ptrs[option.name] = option_ptr