def free_all_config():
    """Free all config options, sections and config file."""
    for section in CONFIG_SECTIONS.itervalues():
        weechat.config_section_free_options(section)
        weechat.config_section_free(section)

    weechat.config_free(CONFIG_FILE)
示例#2
0
def bas_config_init():
    """
    Initialization of configuration file.
    Sections: buffer.
    """
    global bas_config_file, bas_options
    bas_config_file = weechat.config_new(CONFIG_FILE_NAME,
                                         "bas_config_reload_cb", "")
    if bas_config_file == "":
        return

    # section "look"
    section_look = weechat.config_new_section(
        bas_config_file, "look", 0, 0, "", "", "", "", "", "", "", "", "", "")
    if not section_look:
        weechat.config_free(bas_config_file)
        return

    # options in section "look"
    bas_options["look_timer"] = weechat.config_new_option(
        bas_config_file, section_look, "timer", "integer",
        "Timer used to delay the set of properties (in milliseconds, "
        "0 = don't use a timer)",
        "", 0, 2147483647, "1", "1", 0, "", "", "", "", "", "")

    # section "buffer"
    section_buffer = weechat.config_new_section(
        bas_config_file, "buffer", 1, 1, "", "", "", "", "", "",
        "bas_config_buffer_create_option_cb", "", "", "")
    if not section_buffer:
        weechat.config_free(bas_config_file)
        return
示例#3
0
def free_all_config():
    # free all config options, sections and config file
    for section in list(CONFIG_SECTIONS.values()):
        weechat.config_section_free_options(section)
        weechat.config_section_free(section)

    weechat.config_free(CONFIG_FILE)
示例#4
0
def theme_config_init():
    """Initialization of configuration file. Sections: ???."""
    global theme_config_file, theme_config_option
    theme_config_file = weechat.config_new(THEME_CONFIG_FILE_NAME,
                                           'theme_config_reload_cb', '')
    if not theme_config_file:
        return
    
    # section "color"
    section_color = weechat.config_new_section(
        theme_config_file, 'color', 0, 0, '', '', '', '', '', '', '', '', '', '')
    if not section_color:
        weechat.config_free(theme_config_file)
        return
    theme_config_option['color_script'] = weechat.config_new_option(
        theme_config_file, section_color,
        'script', 'color', 'Color for script names', '', 0, 0,
        'cyan', 'cyan', 0, '', '', '', '', '', '')
    theme_config_option['color_installed'] = weechat.config_new_option(
        theme_config_file, section_color,
        'installed', 'color', 'Color for "installed" indicator', '', 0, 0,
        'yellow', 'yellow', 0, '', '', '', '', '', '')
    theme_config_option['color_running'] = weechat.config_new_option(
        theme_config_file, section_color,
        'running', 'color', 'Color for "running" indicator', '', 0, 0,
        'lightgreen', 'lightgreen', 0, '', '', '', '', '', '')
    theme_config_option['color_obsolete'] = weechat.config_new_option(
        theme_config_file, section_color,
        'obsolete', 'color', 'Color for "obsolete" indicator', '', 0, 0,
        'lightmagenta', 'lightmagenta', 0, '', '', '', '', '', '')
    theme_config_option['color_unknown'] = weechat.config_new_option(
        theme_config_file, section_color,
        'unknown', 'color', 'Color for "unknown status" indicator', '', 0, 0,
        'lightred', 'lightred', 0, '', '', '', '', '', '')
    theme_config_option['color_language'] = weechat.config_new_option(
        theme_config_file, section_color,
        'language', 'color', 'Color for language names', '', 0, 0,
        'lightblue', 'lightblue', 0, '', '', '', '', '', '')
    
    # section "themes"
    section_themes = weechat.config_new_section(
        theme_config_file, 'themes', 0, 0, '', '', '', '', '', '', '', '', '', '')
    if not section_themes:
        weechat.config_free(theme_config_file)
        return
    theme_config_option['themes_url'] = weechat.config_new_option(
        theme_config_file, section_themes,
        'url', 'string', 'URL for file with list of themes', '', 0, 0,
        'http://www.weechat.org/files/themes.json.gz',
        'http://www.weechat.org/files/themes.json.gz', 0, '', '', '', '', '', '')
    theme_config_option['themes_cache_expire'] = weechat.config_new_option(
        theme_config_file, section_themes,
        'cache_expire', 'integer', 'Local cache expiration time, in minutes '
        '(-1 = never expires, 0 = always expires)', '',
        -1, 60*24*365, '60', '60', 0, '', '', '', '', '', '')
    theme_config_option['themes_dir'] = weechat.config_new_option(
        theme_config_file, section_themes,
        'dir', 'string', 'Local directory for themes', '', 0, 0,
        '%h/themes', '%h/themes', 0, '', '', '', '', '', '')
示例#5
0
	def __init__(self, filename):
		''' Initialize the configuration. '''

		self.filename         = filename
		self.config_file      = weechat.config_new(self.filename, '', '')
		self.sorting_section  = None

		self.case_sensitive   = False
		self.group_irc        = True
		self.rules            = []
		self.highest          = 0

		self.__case_sensitive = None
		self.__group_irc      = None
		self.__rules          = None

		if not self.config_file:
			log('Failed to initialize configuration file "{}".'.format(self.filename))
			return

		self.sorting_section = weechat.config_new_section(self.config_file, 'sorting', False, False, '', '', '', '', '', '', '', '', '', '')

		if not self.sorting_section:
			log('Failed to initialize section "sorting" of configuration file.')
			weechat.config_free(self.config_file)
			return

		self.__case_sensitive = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'case_sensitive', 'boolean',
			'If this option is on, sorting is case sensitive.',
			'', 0, 0, 'off', 'off', 0,
			'', '', '', '', '', ''
		)

		self.__group_irc = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'group_irc', 'boolean',
			'If this option is on, the script pretends that IRC channel/private buffers are renamed to "irc.server.{network}.{channel}" rather than "irc.{network}.{channel}".' +
			'This ensures that thsee buffers are grouped with their respective server buffer.',
			'', 0, 0, 'on', 'on', 0,
			'', '', '', '', '', ''
		)

		self.__rules = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'rules', 'string',
			'An ordered list of sorting rules encoded as JSON. See /help autosort for commands to manipulate these rules.',
			'', 0, 0, Config.default_rules, Config.default_rules, 0,
			'', '', '', '', '', ''
		)

		if weechat.config_read(self.config_file) != weechat.WEECHAT_RC_OK:
			log('Failed to load configuration file.')

		if weechat.config_write(self.config_file) != weechat.WEECHAT_RC_OK:
			log('Failed to write configuration file.')

		self.reload()
示例#6
0
def execbot_config_init():
    '''Init configuration file'''
    global execbot_config_file
    execbot_config_file = weechat.config_new('execbot', 'execbot_config_reload_cb', '')
    if not execbot_config_file:
        return

    execbot_config_section['allows'] = weechat.config_new_section(
        execbot_config_file, 'allows', 0, 0, 'execbot_config_allows_read_cb', '',
        'execbot_config_allows_write_cb', '', '', '', '', '', '', '')
    if not execbot_config_section['allows']:
        weechat.config_free(execbot_config_file)
示例#7
0
def ircrypt_config_init():
	''' This method initializes the configuration file. It creates sections and
	options in memory and prepares the handling of key sections.
	'''
	global ircrypt_config_file, ircrypt_config_section, ircrypt_config_option
	ircrypt_config_file = weechat.config_new('ircrypt-keyex', 'ircrypt_config_reload_cb', '')
	if not ircrypt_config_file:
		return

	# public key identifier
	ircrypt_config_section['asym_id'] = weechat.config_new_section(
			ircrypt_config_file, 'asym_id', 0, 0,
			'ircrypt_config_asym_id_read_cb', '',
			'ircrypt_config_asym_id_write_cb', '', '', '', '', '', '', '')
	if not ircrypt_config_section['asym_id']:
		weechat.config_free(ircrypt_config_file)
示例#8
0
def bas_config_init():
    """
    Initialization of configuration file.
    Sections: buffer.
    """
    global bas_config_file
    bas_config_file = weechat.config_new(CONFIG_FILE_NAME, "bas_config_reload_cb", "")
    if bas_config_file == "":
        return

    # section "buffer"
    section_buffer = weechat.config_new_section(
        bas_config_file, "buffer", 1, 1, "", "", "", "", "", "", "bas_config_buffer_create_option_cb", "", "", ""
    )
    if section_buffer == "":
        weechat.config_free(bas_config_file)
        return
示例#9
0
def colorize_config_init():
    '''
    Initialization of configuration file.
    Sections: look.
    '''
    global colorize_config_file, colorize_config_option
    colorize_config_file = weechat.config_new(CONFIG_FILE_NAME,
                                              "colorize_config_reload_cb", "")
    if colorize_config_file == "":
        return

    # section "look"
    section_look = weechat.config_new_section(
        colorize_config_file, "look", 0, 0, "", "", "", "", "", "", "", "", "", "")
    if section_look == "":
        weechat.config_free(colorize_config_file)
        return
    colorize_config_option["blacklist_channels"] = weechat.config_new_option(
        colorize_config_file, section_look, "blacklist_channels",
        "string", "Comma separated list of channels", "", 0, 0,
        "", "", 0, "", "", "", "", "", "")
    colorize_config_option["blacklist_nicks"] = weechat.config_new_option(
        colorize_config_file, section_look, "blacklist_nicks",
        "string", "Comma separated list of nicks", "", 0, 0,
        "so,root", "so,root", 0, "", "", "", "", "", "")
    colorize_config_option["min_nick_length"] = weechat.config_new_option(
        colorize_config_file, section_look, "min_nick_length",
        "integer", "Minimum length nick to colorize", "",
        2, 20, "", "", 0, "", "", "", "", "", "")
    colorize_config_option["colorize_input"] = weechat.config_new_option(
        colorize_config_file, section_look, "colorize_input",
        "boolean", "Whether to colorize input", "", 0,
        0, "off", "off", 0, "", "", "", "", "", "")
    colorize_config_option["ignore_tags"] = weechat.config_new_option(
        colorize_config_file, section_look, "ignore_tags",
        "string", "Comma separated list of tags to ignore; i.e. irc_join,irc_part,irc_quit", "", 0, 0,
        "", "", 0, "", "", "", "", "", "")
    colorize_config_option["greedy_matching"] = weechat.config_new_option(
        colorize_config_file, section_look, "greedy_matching",
        "boolean", "If off, then use lazy matching instead", "", 0,
        0, "on", "on", 0, "", "", "", "", "", "")
    colorize_config_option["ignore_nicks_in_urls"] = weechat.config_new_option(
        colorize_config_file, section_look, "ignore_nicks_in_urls",
        "boolean", "If on, don't colorize nicks inside URLs", "", 0,
        0, "off", "off", 0, "", "", "", "", "", "")
示例#10
0
    def setup_config_file(self):
        """Initialize the configuration."""
        config_file = weechat.config_new(
            self._config_name,
            self._reload_cb,
            self._reload_cb_data)

        if not config_file:
            return None

        for section in SCRIPT_CONFIG:
            config_section = weechat.config_new_section(
                config_file,
                section,
                0, 0, "", "", "", "", "", "", "", "", "", ""
            )

            if not config_section:
                weechat.config_free(config_file)
                return None

            for option_name, props in SCRIPT_CONFIG[section].items():
                weechat.config_new_option(
                    config_file,
                    config_section,
                    option_name,
                    props['type'],
                    props['desc'],
                    props['string_values'],
                    props['min'],
                    props['max'],
                    props['default'],
                    props['default'],
                    0,
                    props['check_cb'],
                    "",
                    props['change_cb'],
                    props['change_data'],
                    props['delete_cb'],
                    ""
                )

        return config_file
示例#11
0
def jmh_config_init():
    """ Initialize config file: create sections and options in memory. """
    global jmh_config_file, jmh_config_section
    jmh_config_file = weechat.config_new("jabber_message_handler",
            "jmh_config_reload_cb", "")
    if not jmh_config_file:
        return
    # options
    jmh_config_section["options"] = weechat.config_new_section(
        jmh_config_file, "options", 0, 0, "", "", "", "", "",
        "", "", "", "", "")
    if not jmh_config_section["options"]:
        weechat.config_free(jmh_config_file)
        return
    # prototype option = weechat.config_new_option(
    #    config_file, section,
    #    name, type, description,
    #    string_values, min, max, default_value, value, null_value_allowed,
    #    callback_check_value, callback_check_value_data,
    #    callback_change, callback_change_data,
    #    callback_delete, callback_delete_data)
    jmh_config_option["enabled"] = weechat.config_new_option(
        jmh_config_file, jmh_config_section["options"],
        "enabled", "boolean", "jabber_message_handler service enabled",
        "", 0, 0, "off", "off", 0,
        "", "", "", "", "", "")
    jmh_config_option["log"] = weechat.config_new_option(
        jmh_config_file, jmh_config_section["options"],
        "log", "string", "jabber_message_handler events log file",
        "", 0, 0, "~/.weechat/logs/events", "~/.weechat/logs/events", 0,
        "", "", "", "", "", "")
    jmh_config_option["verbose"] = weechat.config_new_option(
        jmh_config_file, jmh_config_section["options"],
        "verbose", "boolean", "set verbose on/off",
        "", 0, 0, "off", "off", 0,
        "", "", "", "", "", "")
示例#12
0
def fish_config_init():
    global fish_config_file, fish_config_section, fish_config_option

    fish_config_file = weechat.config_new(CONFIG_FILE_NAME,
            "fish_config_reload_cb", "")
    if not fish_config_file:
        return

    # look
    fish_config_section["look"] = weechat.config_new_section(fish_config_file,
            "look", 0, 0, "", "", "", "", "", "", "", "", "", "")
    if not fish_config_section["look"]:
        weechat.config_free(fish_config_file)
        return

    fish_config_option["announce"] = weechat.config_new_option(
            fish_config_file, fish_config_section["look"], "announce",
            "boolean", "annouce if messages are being encrypted or not", "", 0,
            0, "on", "on", 0, "", "", "", "", "", "")
    fish_config_option["marker"] = weechat.config_new_option(
            fish_config_file, fish_config_section["look"], "marker",
            "string", "marker for important FiSH messages", "", 0, 0,
            "O<", "O<", 0, "", "", "", "", "", "")

    fish_config_option["mark_position"] = weechat.config_new_option(
            fish_config_file, fish_config_section["look"], "mark_position",
            "integer", "put marker for encrypted INCOMING messages at start or end", "off|begin|end",
            0,2, "off", "off", 0, "", "", "", "", "", "")

    fish_config_option["mark_encrypted"] = weechat.config_new_option(
            fish_config_file, fish_config_section["look"], "mark_encrypted",
            "string", "marker for encrypted INCOMING messages", "", 0, 0,
            "*", "*", 0, "", "", "", "", "", "")

    # color
    fish_config_section["color"] = weechat.config_new_section(fish_config_file,
            "color", 0, 0, "", "", "", "", "", "", "", "", "", "")
    if not fish_config_section["color"]:
        weechat.config_free(fish_config_file)
        return

    fish_config_option["alert"] = weechat.config_new_option(
            fish_config_file, fish_config_section["color"], "alert",
            "color", "color for important FiSH message markers", "", 0, 0,
            "lightblue", "lightblue", 0, "", "", "", "", "", "")

    # keys
    fish_config_section["keys"] = weechat.config_new_section(fish_config_file,
            "keys", 0, 0,
            "fish_config_keys_read_cb", "",
            "fish_config_keys_write_cb", "", "",
            "", "", "", "", "")
    if not fish_config_section["keys"]:
        weechat.config_free(fish_config_file)
        return
示例#13
0
def wg_config_init():
    """
    Initialization of configuration file.
    Sections: color, scripts.
    """
    global wg_config_file, wg_config_option
    wg_config_file = weechat.config_new(CONFIG_FILE_NAME,
                                        "wg_config_reload_cb", "")
    if wg_config_file == "":
        return

    # section "color"
    section_color = weechat.config_new_section(
        wg_config_file, "color", 0, 0, "", "", "", "", "", "", "", "", "", "")
    if section_color == "":
        weechat.config_free(wg_config_file)
        return
    wg_config_option["color_script"] = weechat.config_new_option(
        wg_config_file, section_color,
        "script", "color", "Color for script names", "", 0, 0,
        "cyan", "cyan", 0, "", "", "", "", "", "")
    wg_config_option["color_installed"] = weechat.config_new_option(
        wg_config_file, section_color,
        "installed", "color", "Color for \"installed\" indicator", "", 0, 0,
        "yellow", "yellow", 0, "", "", "", "", "", "")
    wg_config_option["color_running"] = weechat.config_new_option(
        wg_config_file, section_color,
        "running", "color", "Color for \"running\" indicator", "", 0, 0,
        "lightgreen", "lightgreen", 0, "", "", "", "", "", "")
    wg_config_option["color_obsolete"] = weechat.config_new_option(
        wg_config_file, section_color,
        "obsolete", "color", "Color for \"obsolete\" indicator", "", 0, 0,
        "lightmagenta", "lightmagenta", 0, "", "", "", "", "", "")
    wg_config_option["color_unknown"] = weechat.config_new_option(
        wg_config_file, section_color,
        "unknown", "color", "Color for \"unknown status\" indicator", "", 0, 0,
        "lightred", "lightred", 0, "", "", "", "", "", "")
    wg_config_option["color_language"] = weechat.config_new_option(
        wg_config_file, section_color,
        "language", "color", "Color for language names", "", 0, 0,
        "lightblue", "lightblue", 0, "", "", "", "", "", "")

    # section "scripts"
    section_scripts = weechat.config_new_section(
        wg_config_file, "scripts", 0, 0, "", "", "", "", "", "", "", "", "", "")
    if section_scripts == "":
        weechat.config_free(wg_config_file)
        return
    wg_config_option["scripts_url"] = weechat.config_new_option(
        wg_config_file, section_scripts,
        "url", "string", "URL for file with list of plugins", "", 0, 0,
        "http://www.weechat.org/files/plugins.xml.gz",
        "http://www.weechat.org/files/plugins.xml.gz", 0, "", "", "", "", "", "")
    wg_config_option["scripts_dir"] = weechat.config_new_option(
        wg_config_file, section_scripts,
        "dir", "string", "Local cache directory for" + SCRIPT_NAME, "", 0, 0,
        "%h/" + SCRIPT_NAME, "%h/" + SCRIPT_NAME, 0, "", "", "", "", "", "")
    wg_config_option["scripts_cache_expire"] = weechat.config_new_option(
        wg_config_file, section_scripts,
        "cache_expire", "integer", "Local cache expiration time, in minutes "
        "(-1 = never expires, 0 = always expires)", "",
        -1, 60*24*365, "60", "60", 0, "", "", "", "", "", "")
示例#14
0
	def __init__(self, filename):
		''' Initialize the configuration. '''

		self.filename         = filename
		self.config_file      = weechat.config_new(self.filename, '', '')
		self.sorting_section  = None
		self.v3_section       = None

		self.case_sensitive   = False
		self.rules            = []
		self.helpers          = {}
		self.signals          = []
		self.signal_delay     = Config.default_signal_delay,
		self.sort_on_config   = True

		self.__case_sensitive = None
		self.__rules          = None
		self.__helpers        = None
		self.__signals        = None
		self.__signal_delay   = None
		self.__sort_on_config = None

		if not self.config_file:
			log('Failed to initialize configuration file "{0}".'.format(self.filename))
			return

		self.sorting_section = weechat.config_new_section(self.config_file, 'sorting', False, False, '', '', '', '', '', '', '', '', '', '')
		self.v3_section      = weechat.config_new_section(self.config_file, 'v3',      False, False, '', '', '', '', '', '', '', '', '', '')

		if not self.sorting_section:
			log('Failed to initialize section "sorting" of configuration file.')
			weechat.config_free(self.config_file)
			return

		self.__case_sensitive = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'case_sensitive', 'boolean',
			'If this option is on, sorting is case sensitive.',
			'', 0, 0, 'off', 'off', 0,
			'', '', '', '', '', ''
		)

		weechat.config_new_option(
			self.config_file, self.sorting_section,
			'rules', 'string',
			'Sort rules used by autosort v2.x and below. Not used by autosort anymore.',
			'', 0, 0, '', '', 0,
			'', '', '', '', '', ''
		)

		weechat.config_new_option(
			self.config_file, self.sorting_section,
			'replacements', 'string',
			'Replacement patterns used by autosort v2.x and below. Not used by autosort anymore.',
			'', 0, 0, '', '', 0,
			'', '', '', '', '', ''
		)

		self.__rules = weechat.config_new_option(
			self.config_file, self.v3_section,
			'rules', 'string',
			'An ordered list of sorting rules encoded as JSON. See /help autosort for commands to manipulate these rules.',
			'', 0, 0, Config.default_rules, Config.default_rules, 0,
			'', '', '', '', '', ''
		)

		self.__helpers = weechat.config_new_option(
			self.config_file, self.v3_section,
			'helpers', 'string',
			'A dictionary helper variables to use in the sorting rules, encoded as JSON. See /help autosort for commands to manipulate these helpers.',
			'', 0, 0, Config.default_helpers, Config.default_helpers, 0,
			'', '', '', '', '', ''
		)

		self.__signals = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'signals', 'string',
			'A space separated list of signals that will cause autosort to resort your buffer list.',
			'', 0, 0, Config.default_signals, Config.default_signals, 0,
			'', '', '', '', '', ''
		)

		self.__signal_delay = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'signal_delay', 'integer',
			'Delay in milliseconds to wait after a signal before sorting the buffer list. This prevents triggering many times if multiple signals arrive in a short time. It can also be needed to wait for buffer localvars to be available.',
			'', 0, 1000, str(Config.default_signal_delay), str(Config.default_signal_delay), 0,
			'', '', '', '', '', ''
		)

		self.__sort_on_config = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'sort_on_config_change', 'boolean',
			'Decides if the buffer list should be sorted when autosort configuration changes.',
			'', 0, 0, 'on', 'on', 0,
			'', '', '', '', '', ''
		)

		if weechat.config_read(self.config_file) != weechat.WEECHAT_RC_OK:
			log('Failed to load configuration file.')

		if weechat.config_write(self.config_file) != weechat.WEECHAT_RC_OK:
			log('Failed to write configuration file.')

		self.reload()
示例#15
0
def ircrypt_config_init():
	''' This method initializes the configuration file. It creates sections and
	options in memory and prepares the handling of key sections.
	'''
	global ircrypt_config_file
	ircrypt_config_file = weechat.config_new('ircrypt', 'ircrypt_config_reload_cb', '')
	if not ircrypt_config_file:
		return

	# marker
	ircrypt_config_section['marker'] = weechat.config_new_section(
			ircrypt_config_file, 'marker', 0, 0, '', '', '', '', '', '', '', '',
			'', '')
	if not ircrypt_config_section['marker']:
		weechat.config_free(ircrypt_config_file)
		return
	ircrypt_config_option['encrypted'] = weechat.config_new_option(
			ircrypt_config_file, ircrypt_config_section['marker'],
			'encrypted', 'string', 'Marker for encrypted messages', '', 0, 0,
			'encrypted', 'encrypted', 0, '', '', '', '', '', '')
	ircrypt_config_option['unencrypted'] = weechat.config_new_option(
			ircrypt_config_file, ircrypt_config_section['marker'], 'unencrypted',
			'string', 'Marker for unencrypted messages received in an encrypted channel',
			'', 0, 0, '', 'u', 0, '', '', '', '', '', '')

	# cipher options
	ircrypt_config_section['cipher'] = weechat.config_new_section(
			ircrypt_config_file, 'cipher', 0, 0, '', '', '', '', '', '', '', '',
			'', '')
	if not ircrypt_config_section['cipher']:
		weechat.config_free(ircrypt_config_file)
		return
	ircrypt_config_option['sym_cipher'] = weechat.config_new_option(
			ircrypt_config_file, ircrypt_config_section['cipher'],
			'sym_cipher', 'string', 'symmetric cipher used by default', '', 0, 0,
			'TWOFISH', 'TWOFISH', 0, '', '', '', '', '', '')

	# general options
	ircrypt_config_section['general'] = weechat.config_new_section(
			ircrypt_config_file, 'general', 0, 0, '', '', '', '', '', '', '', '',
			'', '')
	if not ircrypt_config_section['general']:
		weechat.config_free(ircrypt_config_file)
		return
	ircrypt_config_option['binary'] = weechat.config_new_option(
			ircrypt_config_file, ircrypt_config_section['general'],
			'binary', 'string', 'GnuPG binary to use', '', 0, 0,
			'', '', 0, '', '', '', '', '', '')

	# keys
	ircrypt_config_section['keys'] = weechat.config_new_section(
			ircrypt_config_file, 'keys', 0, 0, 'ircrypt_config_keys_read_cb', '',
			'ircrypt_config_keys_write_cb', '', '', '', '', '', '', '')
	if not ircrypt_config_section['keys']:
		weechat.config_free(ircrypt_config_file)

	# Special Ciphers
	ircrypt_config_section['special_cipher'] = weechat.config_new_section(
			ircrypt_config_file, 'special_cipher', 0, 0,
			'ircrypt_config_special_cipher_read_cb', '',
			'ircrypt_config_special_cipher_write_cb', '', '', '', '', '', '', '')
	if not ircrypt_config_section['special_cipher']:
		weechat.config_free(ircrypt_config_file)
示例#16
0
def theme_config_init():
    """Initialization of configuration file. Sections: ???."""
    global theme_config_file, theme_config_option
    theme_config_file = weechat.config_new(THEME_CONFIG_FILE_NAME,
                                           'theme_config_reload_cb', '')
    if not theme_config_file:
        return

    # section "color"
    section_color = weechat.config_new_section(theme_config_file, 'color', 0,
                                               0, '', '', '', '', '', '', '',
                                               '', '', '')
    if not section_color:
        weechat.config_free(theme_config_file)
        return
    theme_config_option['color_script'] = weechat.config_new_option(
        theme_config_file, section_color, 'script', 'color',
        'Color for script names', '', 0, 0, 'cyan', 'cyan', 0, '', '', '', '',
        '', '')
    theme_config_option['color_installed'] = weechat.config_new_option(
        theme_config_file, section_color, 'installed', 'color',
        'Color for "installed" indicator', '', 0, 0, 'yellow', 'yellow', 0, '',
        '', '', '', '', '')
    theme_config_option['color_running'] = weechat.config_new_option(
        theme_config_file, section_color, 'running', 'color',
        'Color for "running" indicator', '', 0, 0, 'lightgreen', 'lightgreen',
        0, '', '', '', '', '', '')
    theme_config_option['color_obsolete'] = weechat.config_new_option(
        theme_config_file, section_color, 'obsolete', 'color',
        'Color for "obsolete" indicator', '', 0, 0, 'lightmagenta',
        'lightmagenta', 0, '', '', '', '', '', '')
    theme_config_option['color_unknown'] = weechat.config_new_option(
        theme_config_file, section_color, 'unknown', 'color',
        'Color for "unknown status" indicator', '', 0, 0, 'lightred',
        'lightred', 0, '', '', '', '', '', '')
    theme_config_option['color_language'] = weechat.config_new_option(
        theme_config_file, section_color, 'language', 'color',
        'Color for language names', '', 0, 0, 'lightblue', 'lightblue', 0, '',
        '', '', '', '', '')

    # section "themes"
    section_themes = weechat.config_new_section(theme_config_file, 'themes', 0,
                                                0, '', '', '', '', '', '', '',
                                                '', '', '')
    if not section_themes:
        weechat.config_free(theme_config_file)
        return
    theme_config_option['themes_url'] = weechat.config_new_option(
        theme_config_file, section_themes, 'url', 'string',
        'URL for file with list of themes', '', 0, 0,
        'http://www.weechat.org/files/themes.json.gz',
        'http://www.weechat.org/files/themes.json.gz', 0, '', '', '', '', '',
        '')
    theme_config_option['themes_cache_expire'] = weechat.config_new_option(
        theme_config_file, section_themes, 'cache_expire', 'integer',
        'Local cache expiration time, in minutes '
        '(-1 = never expires, 0 = always expires)', '', -1, 60 * 24 * 365,
        '60', '60', 0, '', '', '', '', '', '')
    theme_config_option['themes_dir'] = weechat.config_new_option(
        theme_config_file, section_themes, 'dir', 'string',
        'Local directory for themes', '', 0, 0, '%h/themes', '%h/themes', 0,
        '', '', '', '', '', '')
示例#17
0
def ircrypt_config_init():
    ''' This method initializes the configuration file. It creates sections and
	options in memory and prepares the handling of key sections.
	'''
    global ircrypt_config_file
    ircrypt_config_file = weechat.config_new('ircrypt',
                                             'ircrypt_config_reload_cb', '')
    if not ircrypt_config_file:
        return

    # marker
    ircrypt_config_section['marker'] = weechat.config_new_section(
        ircrypt_config_file, 'marker', 0, 0, '', '', '', '', '', '', '', '',
        '', '')
    if not ircrypt_config_section['marker']:
        weechat.config_free(ircrypt_config_file)
        return
    ircrypt_config_option['encrypted'] = weechat.config_new_option(
        ircrypt_config_file, ircrypt_config_section['marker'], 'encrypted',
        'string', 'Marker for encrypted messages', '', 0, 0, 'encrypted',
        'encrypted', 0, '', '', '', '', '', '')
    ircrypt_config_option['unencrypted'] = weechat.config_new_option(
        ircrypt_config_file, ircrypt_config_section['marker'], 'unencrypted',
        'string',
        'Marker for unencrypted messages received in an encrypted channel', '',
        0, 0, '', 'u', 0, '', '', '', '', '', '')

    # cipher options
    ircrypt_config_section['cipher'] = weechat.config_new_section(
        ircrypt_config_file, 'cipher', 0, 0, '', '', '', '', '', '', '', '',
        '', '')
    if not ircrypt_config_section['cipher']:
        weechat.config_free(ircrypt_config_file)
        return
    ircrypt_config_option['sym_cipher'] = weechat.config_new_option(
        ircrypt_config_file, ircrypt_config_section['cipher'], 'sym_cipher',
        'string', 'symmetric cipher used by default', '', 0, 0, 'TWOFISH',
        'TWOFISH', 0, '', '', '', '', '', '')

    # general options
    ircrypt_config_section['general'] = weechat.config_new_section(
        ircrypt_config_file, 'general', 0, 0, '', '', '', '', '', '', '', '',
        '', '')
    if not ircrypt_config_section['general']:
        weechat.config_free(ircrypt_config_file)
        return
    ircrypt_config_option['binary'] = weechat.config_new_option(
        ircrypt_config_file, ircrypt_config_section['general'], 'binary',
        'string', 'GnuPG binary to use', '', 0, 0, '', '', 0, '', '', '', '',
        '', '')

    # keys
    ircrypt_config_section['keys'] = weechat.config_new_section(
        ircrypt_config_file, 'keys', 0, 0, 'ircrypt_config_keys_read_cb', '',
        'ircrypt_config_keys_write_cb', '', '', '', '', '', '', '')
    if not ircrypt_config_section['keys']:
        weechat.config_free(ircrypt_config_file)

    # Special Ciphers
    ircrypt_config_section['special_cipher'] = weechat.config_new_section(
        ircrypt_config_file, 'special_cipher', 0, 0,
        'ircrypt_config_special_cipher_read_cb', '',
        'ircrypt_config_special_cipher_write_cb', '', '', '', '', '', '', '')
    if not ircrypt_config_section['special_cipher']:
        weechat.config_free(ircrypt_config_file)
示例#18
0
    def __init__(self, filename):
        ''' Initialize the configuration. '''

        self.filename = filename
        self.config_file = weechat.config_new(self.filename, '', '')
        self.sorting_section = None
        self.v3_section = None

        self.case_sensitive = False
        self.rules = []
        self.helpers = {}
        self.signals = []
        self.signal_delay = Config.default_signal_delay,
        self.sort_limit = Config.default_sort_limit,
        self.sort_on_config = True
        self.debug_log = False

        self.__case_sensitive = None
        self.__rules = None
        self.__helpers = None
        self.__signals = None
        self.__signal_delay = None
        self.__sort_limit = None
        self.__sort_on_config = None
        self.__debug_log = None

        if not self.config_file:
            log('Failed to initialize configuration file "{0}".'.format(
                self.filename))
            return

        self.sorting_section = weechat.config_new_section(
            self.config_file, 'sorting', False, False, '', '', '', '', '', '',
            '', '', '', '')
        self.v3_section = weechat.config_new_section(self.config_file, 'v3',
                                                     False, False, '', '', '',
                                                     '', '', '', '', '', '',
                                                     '')

        if not self.sorting_section:
            log('Failed to initialize section "sorting" of configuration file.'
                )
            weechat.config_free(self.config_file)
            return

        self.__case_sensitive = weechat.config_new_option(
            self.config_file, self.sorting_section, 'case_sensitive',
            'boolean', 'If this option is on, sorting is case sensitive.', '',
            0, 0, 'off', 'off', 0, '', '', '', '', '', '')

        weechat.config_new_option(
            self.config_file, self.sorting_section, 'rules', 'string',
            'Sort rules used by autosort v2.x and below. Not used by autosort anymore.',
            '', 0, 0, '', '', 0, '', '', '', '', '', '')

        weechat.config_new_option(
            self.config_file, self.sorting_section, 'replacements', 'string',
            'Replacement patterns used by autosort v2.x and below. Not used by autosort anymore.',
            '', 0, 0, '', '', 0, '', '', '', '', '', '')

        self.__rules = weechat.config_new_option(
            self.config_file, self.v3_section, 'rules', 'string',
            'An ordered list of sorting rules encoded as JSON. See /help autosort for commands to manipulate these rules.',
            '', 0, 0, Config.default_rules, Config.default_rules, 0, '', '',
            '', '', '', '')

        self.__helpers = weechat.config_new_option(
            self.config_file, self.v3_section, 'helpers', 'string',
            'A dictionary helper variables to use in the sorting rules, encoded as JSON. See /help autosort for commands to manipulate these helpers.',
            '', 0, 0, Config.default_helpers, Config.default_helpers, 0, '',
            '', '', '', '', '')

        self.__signals = weechat.config_new_option(
            self.config_file, self.sorting_section, 'signals', 'string',
            'A space separated list of signals that will cause autosort to resort your buffer list.',
            '', 0, 0, Config.default_signals, Config.default_signals, 0, '',
            '', '', '', '', '')

        self.__signal_delay = weechat.config_new_option(
            self.config_file, self.sorting_section, 'signal_delay', 'integer',
            'Delay in milliseconds to wait after a signal before sorting the buffer list. This prevents triggering many times if multiple signals arrive in a short time. It can also be needed to wait for buffer localvars to be available.',
            '', 0, 1000, str(Config.default_signal_delay),
            str(Config.default_signal_delay), 0, '', '', '', '', '', '')

        self.__sort_limit = weechat.config_new_option(
            self.config_file, self.sorting_section, 'sort_limit', 'integer',
            'Minimum delay in milliseconds to wait after sorting before signals can trigger a sort again. This is effectively a rate limit on sorting. Keeping signal_delay low while setting this higher can reduce excessive sorting without a long initial delay.',
            '', 0, 1000, str(Config.default_sort_limit),
            str(Config.default_sort_limit), 0, '', '', '', '', '', '')

        self.__sort_on_config = weechat.config_new_option(
            self.config_file, self.sorting_section, 'sort_on_config_change',
            'boolean',
            'Decides if the buffer list should be sorted when autosort configuration changes.',
            '', 0, 0, 'on', 'on', 0, '', '', '', '', '', '')

        self.__debug_log = weechat.config_new_option(
            self.config_file, self.sorting_section, 'debug_log', 'boolean',
            'If enabled, print more debug messages. Not recommended for normal usage.',
            '', 0, 0, 'off', 'off', 0, '', '', '', '', '', '')

        if weechat.config_read(self.config_file) != weechat.WEECHAT_RC_OK:
            log('Failed to load configuration file.')

        if weechat.config_write(self.config_file) != weechat.WEECHAT_RC_OK:
            log('Failed to write configuration file.')

        self.reload()
示例#19
0
    def __init__(self, filename):
        ''' Initialize the configuration. '''

        self.filename = filename
        self.config_file = weechat.config_new(self.filename, '', '')
        self.sorting_section = None
        self.v3_section = None

        self.case_sensitive = False
        self.rules = []
        self.helpers = {}
        self.signals = []
        self.signal_delay = Config.default_signal_delay
        self.sort_on_config = True

        self.__case_sensitive = None
        self.__rules = None
        self.__helpers = None
        self.__signals = None
        self.__signal_delay = None
        self.__sort_on_config = None

        if not self.config_file:
            log('Failed to initialize configuration file "{0}".'.format(
                self.filename))
            return

        self.sorting_section = weechat.config_new_section(
            self.config_file, 'sorting', False, False, '', '', '', '', '', '',
            '', '', '', '')
        self.v3_section = weechat.config_new_section(self.config_file, 'v3',
                                                     False, False, '', '', '',
                                                     '', '', '', '', '', '',
                                                     '')

        if not self.sorting_section:
            log('Failed to initialize section "sorting" of configuration file.'
                )
            weechat.config_free(self.config_file)
            return

        self.__case_sensitive = weechat.config_new_option(
            self.config_file, self.sorting_section, 'case_sensitive',
            'boolean', 'If this option is on, sorting is case sensitive.', '',
            0, 0, 'off', 'off', 0, '', '', '', '', '', '')

        self.__rules = weechat.config_new_option(
            self.config_file, self.v3_section, 'rules', 'string',
            'An ordered list of sorting rules encoded as JSON. See /help '
            'autosort for commands to manipulate these rules.', '', 0, 0,
            Config.default_rules, Config.default_rules, 0, '', '', '', '', '',
            '')

        self.__helpers = weechat.config_new_option(
            self.config_file, self.v3_section, 'helpers', 'string',
            'A dictionary helper variables to use in the sorting rules, '
            'encoded as JSON. See /help autosort for commands to manipulate '
            'these helpers.', '', 0, 0, Config.default_helpers,
            Config.default_helpers, 0, '', '', '', '', '', '')

        self.__signals = weechat.config_new_option(
            self.config_file, self.sorting_section, 'signals', 'string',
            'A space separated list of signals that will cause autosort to '
            'resort your buffer list.', '', 0, 0, Config.default_signals,
            Config.default_signals, 0, '', '', '', '', '', '')

        self.__signal_delay = weechat.config_new_option(
            self.config_file, self.sorting_section, 'signal_delay', 'integer',
            'Delay in milliseconds to wait after a signal before sorting the '
            'buffer list. This prevents triggering many times if multiple '
            'signals arrive in a short time. It can also be needed to wait '
            'for buffer localvars to be available.', '', 0, 1000,
            str(Config.default_signal_delay), str(Config.default_signal_delay),
            0, '', '', '', '', '', '')

        self.__sort_on_config = weechat.config_new_option(
            self.config_file, self.sorting_section, 'sort_on_config_change',
            'boolean',
            'Decides if the buffer list should be sorted when autosort '
            'configuration changes.', '', 0, 0, 'on', 'on', 0, '', '', '', '',
            '', '')

        if weechat.config_read(self.config_file) != weechat.WEECHAT_RC_OK:
            log('Failed to load configuration file.')

        if weechat.config_write(self.config_file) != weechat.WEECHAT_RC_OK:
            log('Failed to write configuration file.')

        self.reload()
示例#20
0
	def __init__(self, filename):
		''' Initialize the configuration. '''

		self.filename         = filename
		self.config_file      = weechat.config_new(self.filename, '', '')
		self.sorting_section  = None

		self.case_sensitive   = False
		self.group_irc        = True
		self.rules            = []
		self.replacements     = []
		self.signals          = []
		self.sort_on_config   = True

		self.__case_sensitive = None
		self.__group_irc      = None
		self.__rules          = None
		self.__replacements   = None
		self.__signals        = None
		self.__sort_on_config = None

		if not self.config_file:
			log('Failed to initialize configuration file "{0}".'.format(self.filename))
			return

		self.sorting_section = weechat.config_new_section(self.config_file, 'sorting', False, False, '', '', '', '', '', '', '', '', '', '')

		if not self.sorting_section:
			log('Failed to initialize section "sorting" of configuration file.')
			weechat.config_free(self.config_file)
			return

		self.__case_sensitive = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'case_sensitive', 'boolean',
			'If this option is on, sorting is case sensitive.',
			'', 0, 0, 'off', 'off', 0,
			'', '', '', '', '', ''
		)

		self.__group_irc = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'group_irc', 'boolean',
			'If this option is on, the script pretends that IRC channel/private buffers are renamed to "irc.server.{network}.{channel}" rather than "irc.{network}.{channel}".' +
			'This ensures that these buffers are grouped with their respective server buffer.',
			'', 0, 0, 'on', 'on', 0,
			'', '', '', '', '', ''
		)

		self.__rules = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'rules', 'string',
			'An ordered list of sorting rules encoded as JSON. See /help autosort for commands to manipulate these rules.',
			'', 0, 0, Config.default_rules, Config.default_rules, 0,
			'', '', '', '', '', ''
		)

		self.__replacements = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'replacements', 'string',
			'An ordered list of replacement patterns to use on buffer name components, encoded as JSON. See /help autosort for commands to manipulate these replacements.',
			'', 0, 0, Config.default_replacements, Config.default_replacements, 0,
			'', '', '', '', '', ''
		)

		self.__signals = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'signals', 'string',
			'The signals that will cause autosort to resort your buffer list. Seperate signals with spaces.',
			'', 0, 0, Config.default_signals, Config.default_signals, 0,
			'', '', '', '', '', ''
		)

		self.__sort_on_config = weechat.config_new_option(
			self.config_file, self.sorting_section,
			'sort_on_config_change', 'boolean',
			'Decides if the buffer list should be sorted when autosort configuration changes.',
			'', 0, 0, 'on', 'on', 0,
			'', '', '', '', '', ''
		)

		if weechat.config_read(self.config_file) != weechat.WEECHAT_RC_OK:
			log('Failed to load configuration file.')

		if weechat.config_write(self.config_file) != weechat.WEECHAT_RC_OK:
			log('Failed to write configuration file.')

		self.reload()
示例#21
0
    def __init__(self, filename):
        ''' Initialize the configuration. '''

        self.filename = filename
        self.config_file = weechat.config_new(self.filename, '', '')
        self.sorting_section = None

        self.case_sensitive = False
        self.group_irc = True
        self.rules = []
        self.replacements = []
        self.signals = []
        self.sort_on_config = True

        self.__case_sensitive = None
        self.__group_irc = None
        self.__rules = None
        self.__replacements = None
        self.__signals = None
        self.__sort_on_config = None

        if not self.config_file:
            log('Failed to initialize configuration file "{0}".'.format(
                self.filename))
            return

        self.sorting_section = weechat.config_new_section(
            self.config_file, 'sorting', False, False, '', '', '', '', '', '',
            '', '', '', '')

        if not self.sorting_section:
            log('Failed to initialize section "sorting" of configuration file.'
                )
            weechat.config_free(self.config_file)
            return

        self.__case_sensitive = weechat.config_new_option(
            self.config_file, self.sorting_section, 'case_sensitive',
            'boolean', 'If this option is on, sorting is case sensitive.', '',
            0, 0, 'off', 'off', 0, '', '', '', '', '', '')

        self.__group_irc = weechat.config_new_option(
            self.config_file, self.sorting_section, 'group_irc', 'boolean',
            'If this option is on, the script pretends that IRC channel/private buffers are renamed to "irc.server.{network}.{channel}" rather than "irc.{network}.{channel}".'
            +
            'This ensures that these buffers are grouped with their respective server buffer.',
            '', 0, 0, 'on', 'on', 0, '', '', '', '', '', '')

        self.__rules = weechat.config_new_option(
            self.config_file, self.sorting_section, 'rules', 'string',
            'An ordered list of sorting rules encoded as JSON. See /help autosort for commands to manipulate these rules.',
            '', 0, 0, Config.default_rules, Config.default_rules, 0, '', '',
            '', '', '', '')

        self.__replacements = weechat.config_new_option(
            self.config_file, self.sorting_section, 'replacements', 'string',
            'An ordered list of replacement patterns to use on buffer name components, encoded as JSON. See /help autosort for commands to manipulate these replacements.',
            '', 0, 0, Config.default_replacements, Config.default_replacements,
            0, '', '', '', '', '', '')

        self.__signals = weechat.config_new_option(
            self.config_file, self.sorting_section, 'signals', 'string',
            'The signals that will cause autosort to resort your buffer list. Seperate signals with spaces.',
            '', 0, 0, Config.default_signals, Config.default_signals, 0, '',
            '', '', '', '', '')

        self.__sort_on_config = weechat.config_new_option(
            self.config_file, self.sorting_section, 'sort_on_config_change',
            'boolean',
            'Decides if the buffer list should be sorted when autosort configuration changes.',
            '', 0, 0, 'on', 'on', 0, '', '', '', '', '', '')

        if weechat.config_read(self.config_file) != weechat.WEECHAT_RC_OK:
            log('Failed to load configuration file.')

        if weechat.config_write(self.config_file) != weechat.WEECHAT_RC_OK:
            log('Failed to write configuration file.')

        self.reload()
示例#22
0
def wg_config_init():
    """
    Initialization of configuration file.
    Sections: color, scripts.
    """
    global wg_config_file, wg_config_option
    wg_config_file = weechat.config_new(CONFIG_FILE_NAME,
                                        "wg_config_reload_cb", "")
    if wg_config_file == "":
        return

    # section "color"
    section_color = weechat.config_new_section(
        wg_config_file, "color", 0, 0, "", "", "", "", "", "", "", "", "", "")
    if section_color == "":
        weechat.config_free(wg_config_file)
        return
    wg_config_option["color_script"] = weechat.config_new_option(
        wg_config_file, section_color,
        "script", "color", "Color for script names", "", 0, 0,
        "cyan", "cyan", 0, "", "", "", "", "", "")
    wg_config_option["color_installed"] = weechat.config_new_option(
        wg_config_file, section_color,
        "installed", "color", "Color for \"installed\" indicator", "", 0, 0,
        "yellow", "yellow", 0, "", "", "", "", "", "")
    wg_config_option["color_running"] = weechat.config_new_option(
        wg_config_file, section_color,
        "running", "color", "Color for \"running\" indicator", "", 0, 0,
        "lightgreen", "lightgreen", 0, "", "", "", "", "", "")
    wg_config_option["color_obsolete"] = weechat.config_new_option(
        wg_config_file, section_color,
        "obsolete", "color", "Color for \"obsolete\" indicator", "", 0, 0,
        "lightmagenta", "lightmagenta", 0, "", "", "", "", "", "")
    wg_config_option["color_unknown"] = weechat.config_new_option(
        wg_config_file, section_color,
        "unknown", "color", "Color for \"unknown status\" indicator", "", 0, 0,
        "lightred", "lightred", 0, "", "", "", "", "", "")
    wg_config_option["color_language"] = weechat.config_new_option(
        wg_config_file, section_color,
        "language", "color", "Color for language names", "", 0, 0,
        "lightblue", "lightblue", 0, "", "", "", "", "", "")

    # section "scripts"
    section_scripts = weechat.config_new_section(
        wg_config_file, "scripts", 0, 0, "", "", "", "", "", "", "", "", "", "")
    if section_scripts == "":
        weechat.config_free(wg_config_file)
        return
    wg_config_option["scripts_url"] = weechat.config_new_option(
        wg_config_file, section_scripts,
        "url", "string", "URL for file with list of plugins", "", 0, 0,
        "http://www.weechat.org/files/plugins.xml.gz",
        "http://www.weechat.org/files/plugins.xml.gz", 0, "", "", "", "", "", "")
    wg_config_option["scripts_dir"] = weechat.config_new_option(
        wg_config_file, section_scripts,
        "dir", "string", "Local cache directory for" + SCRIPT_NAME, "", 0, 0,
        "%h/" + SCRIPT_NAME, "%h/" + SCRIPT_NAME, 0, "", "", "", "", "", "")
    wg_config_option["scripts_cache_expire"] = weechat.config_new_option(
        wg_config_file, section_scripts,
        "cache_expire", "integer", "Local cache expiration time, in minutes "
        "(-1 = never expires, 0 = always expires)", "",
        -1, 60*24*365, "60", "60", 0, "", "", "", "", "", "")
示例#23
0
文件: fish.py 项目: nikster2/scripts
def fish_config_init():
    global fish_config_file, fish_config_section, fish_config_option
    global fish_secure_cipher

    fish_config_file = weechat.config_new(CONFIG_FILE_NAME,
                                          "fish_config_reload_cb", "")
    if not fish_config_file:
        return

    # look
    fish_config_section["look"] = weechat.config_new_section(
        fish_config_file, "look", 0, 0, "", "", "", "", "", "", "", "", "", "")
    if not fish_config_section["look"]:
        weechat.config_free(fish_config_file)
        return

    fish_config_option["announce"] = weechat.config_new_option(
        fish_config_file, fish_config_section["look"], "announce", "boolean",
        "annouce if messages are being encrypted or not", "", 0, 0, "on", "on",
        0, "", "", "", "", "", "")

    fish_config_option["marker"] = weechat.config_new_option(
        fish_config_file, fish_config_section["look"], "marker", "string",
        "marker for important FiSH messages", "", 0, 0, "O<", "O<", 0, "", "",
        "", "", "", "")

    fish_config_option["mark_position"] = weechat.config_new_option(
        fish_config_file, fish_config_section["look"], "mark_position",
        "integer", "put marker for encrypted messages at start or end",
        "off|begin|end", 0, 2, "off", "off", 0, "", "", "", "", "", "")

    fish_config_option["mark_encrypted"] = weechat.config_new_option(
        fish_config_file, fish_config_section["look"], "mark_encrypted",
        "string", "marker for encrypted messages", "", 0, 0, "*", "*", 0, "",
        "", "", "", "", "")

    # color
    fish_config_section["color"] = weechat.config_new_section(
        fish_config_file, "color", 0, 0, "", "", "", "", "", "", "", "", "",
        "")
    if not fish_config_section["color"]:
        weechat.config_free(fish_config_file)
        return

    fish_config_option["alert"] = weechat.config_new_option(
        fish_config_file, fish_config_section["color"], "alert", "color",
        "color for important FiSH message markers", "", 0, 0, "lightblue",
        "lightblue", 0, "", "", "", "", "", "")

    # secure
    fish_config_section["secure"] = weechat.config_new_section(
        fish_config_file, "secure", 0, 0, "", "", "", "", "", "", "", "", "",
        "")
    if not fish_config_section["secure"]:
        weechat.config_free(fish_config_file)
        return

    fish_config_option["key"] = weechat.config_new_option(
        fish_config_file, fish_config_section["secure"], "key", "string",
        "key for securing blowfish keys", "", 0, 0, "", "", 0, "", "", "", "",
        "", "")

    # keys
    fish_config_section["keys"] = weechat.config_new_section(
        fish_config_file, "keys", 0, 0, "fish_config_keys_read_cb", "",
        "fish_config_keys_write_cb", "", "", "", "", "", "", "")
    if not fish_config_section["keys"]:
        weechat.config_free(fish_config_file)
        return