diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/alias/alias-config.c | 31 | ||||
-rw-r--r-- | src/plugins/buflist/buflist-config.c | 663 | ||||
-rw-r--r-- | src/plugins/exec/exec-config.c | 134 | ||||
-rw-r--r-- | src/plugins/fifo/fifo-config.c | 67 | ||||
-rw-r--r-- | src/plugins/fset/fset-config.c | 1545 | ||||
-rw-r--r-- | src/plugins/irc/irc-config.c | 1921 | ||||
-rw-r--r-- | src/plugins/logger/logger-config.c | 466 | ||||
-rw-r--r-- | src/plugins/plugin-config.c | 5 | ||||
-rw-r--r-- | src/plugins/plugin-script-config.c | 41 | ||||
-rw-r--r-- | src/plugins/relay/relay-config.c | 811 | ||||
-rw-r--r-- | src/plugins/script/script-config.c | 812 | ||||
-rw-r--r-- | src/plugins/spell/spell-config.c | 290 | ||||
-rw-r--r-- | src/plugins/trigger/trigger-config.c | 229 | ||||
-rw-r--r-- | src/plugins/trigger/trigger-config.h | 3 | ||||
-rw-r--r-- | src/plugins/typing/typing-config.c | 148 | ||||
-rw-r--r-- | src/plugins/xfer/xfer-config.c | 595 |
16 files changed, 3817 insertions, 3944 deletions
diff --git a/src/plugins/alias/alias-config.c b/src/plugins/alias/alias-config.c index f6b72f4b0..7d65a1c1b 100644 --- a/src/plugins/alias/alias-config.c +++ b/src/plugins/alias/alias-config.c @@ -432,35 +432,31 @@ alias_config_update_cb (const void *pointer, void *data, int alias_config_init () { - struct t_config_section *ptr_section; - alias_config_file = weechat_config_new (ALIAS_CONFIG_PRIO_NAME, &alias_config_reload, NULL, NULL); if (!alias_config_file) return 0; - weechat_config_set_version (alias_config_file, ALIAS_CONFIG_VERSION, - &alias_config_update_cb, NULL, NULL); + if (!weechat_config_set_version (alias_config_file, ALIAS_CONFIG_VERSION, + &alias_config_update_cb, NULL, NULL)) + { + weechat_config_free (alias_config_file); + alias_config_file = NULL; + return 0; + } /* cmd */ - ptr_section = weechat_config_new_section ( + alias_config_section_cmd = weechat_config_new_section ( alias_config_file, "cmd", 1, 1, NULL, NULL, NULL, NULL, NULL, NULL, &alias_config_cmd_write_default_cb, NULL, NULL, &alias_config_cmd_create_option_cb, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (alias_config_file); - alias_config_file = NULL; - return 0; - } - alias_config_section_cmd = ptr_section; + NULL, NULL, NULL); /* completion */ - ptr_section = weechat_config_new_section ( + alias_config_section_completion = weechat_config_new_section ( alias_config_file, "completion", 1, 1, NULL, NULL, NULL, @@ -468,13 +464,6 @@ alias_config_init () &alias_config_completion_write_default_cb, NULL, NULL, &alias_config_completion_create_option_cb, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (alias_config_file); - alias_config_file = NULL; - return 0; - } - alias_config_section_completion = ptr_section; return 1; } diff --git a/src/plugins/buflist/buflist-config.c b/src/plugins/buflist/buflist-config.c index 2e63e934f..7a2f94a0d 100644 --- a/src/plugins/buflist/buflist-config.c +++ b/src/plugins/buflist/buflist-config.c @@ -31,35 +31,42 @@ struct t_config_file *buflist_config_file = NULL; +/* sections */ + +struct t_config_section *buflist_config_section_look = NULL; +struct t_config_section *buflist_config_section_format = NULL; + /* buflist config, look section */ -struct t_config_option *buflist_config_look_add_newline; -struct t_config_option *buflist_config_look_auto_scroll; -struct t_config_option *buflist_config_look_display_conditions; -struct t_config_option *buflist_config_look_enabled; -struct t_config_option *buflist_config_look_mouse_jump_visited_buffer; -struct t_config_option *buflist_config_look_mouse_move_buffer; -struct t_config_option *buflist_config_look_mouse_wheel; -struct t_config_option *buflist_config_look_nick_prefix; -struct t_config_option *buflist_config_look_nick_prefix_empty; -struct t_config_option *buflist_config_look_signals_refresh; -struct t_config_option *buflist_config_look_sort; -struct t_config_option *buflist_config_look_use_items; +struct t_config_option *buflist_config_look_add_newline = NULL; +struct t_config_option *buflist_config_look_auto_scroll = NULL; +struct t_config_option *buflist_config_look_display_conditions = NULL; +struct t_config_option *buflist_config_look_enabled = NULL; +struct t_config_option *buflist_config_look_mouse_jump_visited_buffer = NULL; +struct t_config_option *buflist_config_look_mouse_move_buffer = NULL; +struct t_config_option *buflist_config_look_mouse_wheel = NULL; +struct t_config_option *buflist_config_look_nick_prefix = NULL; +struct t_config_option *buflist_config_look_nick_prefix_empty = NULL; +struct t_config_option *buflist_config_look_signals_refresh = NULL; +struct t_config_option *buflist_config_look_sort = NULL; +struct t_config_option *buflist_config_look_use_items = NULL; /* buflist config, format section */ -struct t_config_option *buflist_config_format_buffer; -struct t_config_option *buflist_config_format_buffer_current; -struct t_config_option *buflist_config_format_hotlist; -struct t_config_option *buflist_config_format_hotlist_level[4]; -struct t_config_option *buflist_config_format_hotlist_level_none; -struct t_config_option *buflist_config_format_hotlist_separator; -struct t_config_option *buflist_config_format_indent; -struct t_config_option *buflist_config_format_lag; -struct t_config_option *buflist_config_format_name; -struct t_config_option *buflist_config_format_nick_prefix; -struct t_config_option *buflist_config_format_number; -struct t_config_option *buflist_config_format_tls_version; +struct t_config_option *buflist_config_format_buffer = NULL; +struct t_config_option *buflist_config_format_buffer_current = NULL; +struct t_config_option *buflist_config_format_hotlist = NULL; +struct t_config_option *buflist_config_format_hotlist_level[4] = { + NULL, NULL, NULL, NULL, +}; +struct t_config_option *buflist_config_format_hotlist_level_none = NULL; +struct t_config_option *buflist_config_format_hotlist_separator = NULL; +struct t_config_option *buflist_config_format_indent = NULL; +struct t_config_option *buflist_config_format_lag = NULL; +struct t_config_option *buflist_config_format_name = NULL; +struct t_config_option *buflist_config_format_nick_prefix = NULL; +struct t_config_option *buflist_config_format_number = NULL; +struct t_config_option *buflist_config_format_tls_version = NULL; struct t_hook **buflist_config_signals_refresh = NULL; int buflist_config_num_signals_refresh = 0; @@ -466,8 +473,6 @@ buflist_config_change_format (const void *pointer, void *data, int buflist_config_init () { - struct t_config_section *ptr_section; - buflist_config_file = weechat_config_new ( BUFLIST_CONFIG_PRIO_NAME, &buflist_config_reload, NULL, NULL); @@ -475,324 +480,320 @@ buflist_config_init () return 0; /* look */ - ptr_section = weechat_config_new_section (buflist_config_file, "look", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (buflist_config_file); - buflist_config_file = NULL; - return 0; - } - - buflist_config_look_add_newline = weechat_config_new_option ( - buflist_config_file, ptr_section, - "add_newline", "boolean", - N_("add newline between the buffers displayed, so each buffer is " - "displayed on a separate line (recommended); if disabled, newlines " - "must be manually added in the formats with \"${\\n}\", " - "and the mouse actions are not possible any more"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_auto_scroll = weechat_config_new_option ( - buflist_config_file, ptr_section, - "auto_scroll", "integer", - N_("automatically scroll the buflist bar to always see the current " - "buffer (this works only with a bar on the left/right position " - "with a \"vertical\" filling); this value is the percent number " - "of lines displayed before the current buffer when scrolling " - "(-1 = disable scroll); for example 50 means that after a scroll, " - "the current buffer is at the middle of bar, 0 means on top of " - "bar, 100 means at bottom of bar"), - NULL, -1, 100, "50", NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_display_conditions = weechat_config_new_option ( - buflist_config_file, ptr_section, - "display_conditions", "string", - N_("conditions to display a buffer " - "(note: content is evaluated, see /help buflist); for example " - "to hide server buffers if they are merged with core buffer: " - "\"${buffer.hidden}==0 && ((${type}!=server && " - "${buffer.full_name}!=core.weechat) || ${buffer.active}==1)\""), - NULL, 0, 0, "${buffer.hidden}==0", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_enabled = weechat_config_new_option ( - buflist_config_file, ptr_section, - "enabled", "boolean", - N_("enable buflist; it is recommended to use this option instead of " - "just hiding the bar because it also removes some internal hooks " - "that are not needed any more when the bar is hidden; you can " - "also use the command \"/buflist toggle\" or use the default key " - "alt+shift+b"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_enabled, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_mouse_jump_visited_buffer = weechat_config_new_option ( - buflist_config_file, ptr_section, - "mouse_jump_visited_buffer", "boolean", - N_("if enabled, clicks with left/right buttons on the line with " - "current buffer jump to previous/next visited buffer"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_mouse_move_buffer = weechat_config_new_option ( - buflist_config_file, ptr_section, - "mouse_move_buffer", "boolean", - N_("if enabled, mouse gestures (drag & drop) move buffers in list"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_mouse_wheel = weechat_config_new_option ( - buflist_config_file, ptr_section, - "mouse_wheel", "boolean", - N_("if enabled, mouse wheel up/down actions jump to previous/next " - "buffer in list"), - NULL, 0, 0, "on", NULL, 0, + buflist_config_section_look = weechat_config_new_section ( + buflist_config_file, "look", + 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_nick_prefix = weechat_config_new_option ( - buflist_config_file, ptr_section, - "nick_prefix", "boolean", - N_("get the nick prefix and its color from nicklist so that " - "${nick_prefix} can be used in format; this can be slow on buffers " - "with lot of nicks in nicklist, so this option is disabled " - "by default"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_nick_prefix, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_nick_prefix_empty = weechat_config_new_option ( - buflist_config_file, ptr_section, - "nick_prefix_empty", "boolean", - N_("when the nick prefix is enabled, display a space instead if there " - "is no nick prefix on the buffer"), - NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_signals_refresh = weechat_config_new_option ( - buflist_config_file, ptr_section, - "signals_refresh", "string", - N_("comma-separated list of extra signals that are hooked and trigger " - "the refresh of buffers list; this can be useful if some custom " - "variables are used in formats and need specific refresh"), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_signals_refresh, NULL, NULL, - NULL, NULL, NULL); - buflist_config_look_sort = weechat_config_new_option ( - buflist_config_file, ptr_section, - "sort", "string", - N_("comma-separated list of fields to sort buffers; each field is " - "a hdata variable of buffer (\"var\"), a hdata variable of " - "IRC server (\"irc_server.var\") or a hdata variable of " - "IRC channel (\"irc_channel.var\"); " - "char \"-\" can be used before field to reverse order, " - "char \"~\" can be used to do a case insensitive comparison; " - "example: \"-~short_name\" for case insensitive and reverse " - "sort on buffer short name " - "(note: the content is evaluated, before being split into fields, " - "but at that time \"bar_item\" is the only variable that can be " - "used, to distinguish between different buflist items, for example " - "\"${bar_item.name}\")"), - NULL, 0, 0, "number,-active", NULL, 0, NULL, NULL, NULL, - &buflist_config_change_sort, NULL, NULL, NULL, NULL, NULL); - buflist_config_look_use_items = weechat_config_new_option ( - buflist_config_file, ptr_section, - "use_items", "integer", - N_("number of buflist bar items that can be used; the item names are: " - "\"buflist\", \"buflist2\", \"buflist3\"; be careful, using more " - "than one bar item slows down the display of buffers list"), - NULL, 1, BUFLIST_BAR_NUM_ITEMS, "1", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_use_items, NULL, NULL, - NULL, NULL, NULL); - - /* format */ - ptr_section = weechat_config_new_section (buflist_config_file, "format", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (buflist_config_section_look) { - weechat_config_free (buflist_config_file); - buflist_config_file = NULL; - return 0; + buflist_config_look_add_newline = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "add_newline", "boolean", + N_("add newline between the buffers displayed, so each buffer is " + "displayed on a separate line (recommended); if disabled, " + "newlines must be manually added in the formats with \"${\\n}\", " + "and the mouse actions are not possible any more"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_auto_scroll = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "auto_scroll", "integer", + N_("automatically scroll the buflist bar to always see the current " + "buffer (this works only with a bar on the left/right position " + "with a \"vertical\" filling); this value is the percent number " + "of lines displayed before the current buffer when scrolling " + "(-1 = disable scroll); for example 50 means that after a scroll, " + "the current buffer is at the middle of bar, 0 means on top of " + "bar, 100 means at bottom of bar"), + NULL, -1, 100, "50", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_display_conditions = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "display_conditions", "string", + N_("conditions to display a buffer " + "(note: content is evaluated, see /help buflist); for example " + "to hide server buffers if they are merged with core buffer: " + "\"${buffer.hidden}==0 && ((${type}!=server && " + "${buffer.full_name}!=core.weechat) || ${buffer.active}==1)\""), + NULL, 0, 0, "${buffer.hidden}==0", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_enabled = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "enabled", "boolean", + N_("enable buflist; it is recommended to use this option instead of " + "just hiding the bar because it also removes some internal hooks " + "that are not needed any more when the bar is hidden; you can " + "also use the command \"/buflist toggle\" or use the default key " + "alt+shift+b"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_enabled, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_mouse_jump_visited_buffer = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "mouse_jump_visited_buffer", "boolean", + N_("if enabled, clicks with left/right buttons on the line with " + "current buffer jump to previous/next visited buffer"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_mouse_move_buffer = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "mouse_move_buffer", "boolean", + N_("if enabled, mouse gestures (drag & drop) move buffers in list"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_mouse_wheel = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "mouse_wheel", "boolean", + N_("if enabled, mouse wheel up/down actions jump to previous/next " + "buffer in list"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_nick_prefix = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "nick_prefix", "boolean", + N_("get the nick prefix and its color from nicklist so that " + "${nick_prefix} can be used in format; this can be slow on " + "buffers with lot of nicks in nicklist, so this option is " + "disabled by default"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_nick_prefix, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_nick_prefix_empty = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "nick_prefix_empty", "boolean", + N_("when the nick prefix is enabled, display a space instead if " + "there is no nick prefix on the buffer"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_signals_refresh = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "signals_refresh", "string", + N_("comma-separated list of extra signals that are hooked and " + "trigger the refresh of buffers list; this can be useful if " + "some custom variables are used in formats and need specific " + "refresh"), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_signals_refresh, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_sort = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "sort", "string", + N_("comma-separated list of fields to sort buffers; each field is " + "a hdata variable of buffer (\"var\"), a hdata variable of " + "IRC server (\"irc_server.var\") or a hdata variable of " + "IRC channel (\"irc_channel.var\"); " + "char \"-\" can be used before field to reverse order, " + "char \"~\" can be used to do a case insensitive comparison; " + "example: \"-~short_name\" for case insensitive and reverse " + "sort on buffer short name " + "(note: the content is evaluated, before being split into " + "fields, but at that time \"bar_item\" is the only variable " + "that can be used, to distinguish between different buflist " + "items, for example \"${bar_item.name}\")"), + NULL, 0, 0, "number,-active", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_sort, NULL, NULL, + NULL, NULL, NULL); + buflist_config_look_use_items = weechat_config_new_option ( + buflist_config_file, buflist_config_section_look, + "use_items", "integer", + N_("number of buflist bar items that can be used; the item names " + "are: \"buflist\", \"buflist2\", \"buflist3\"; be careful, " + "using more than one bar item slows down the display of " + "buffers list"), + NULL, 1, BUFLIST_BAR_NUM_ITEMS, "1", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_use_items, NULL, NULL, + NULL, NULL, NULL); } - buflist_config_format_buffer = weechat_config_new_option ( - buflist_config_file, ptr_section, - "buffer", "string", - N_("format of each line with a buffer " - "(note: content is evaluated, see /help buflist); " - "example: standard format for bar item \"buflist\" and only the " - "buffer number between square brackets for other bar items " - "(\"buflist2\" and \"buflist3\"): " - "\"${if:${bar_item.name}==buflist?${format_number}${indent}" - "${format_nick_prefix}${color_hotlist}${format_name}:" - "[${number}]}\""), - NULL, 0, 0, - "${format_number}${indent}${format_nick_prefix}${color_hotlist}" - "${format_name}", - NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_format, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_buffer_current = weechat_config_new_option ( - buflist_config_file, ptr_section, - "buffer_current", "string", - N_("format for the line with current buffer " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, "${color:,blue}${format_buffer}", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_format, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_hotlist = weechat_config_new_option ( - buflist_config_file, ptr_section, - "hotlist", "string", - N_("format for hotlist " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, - " ${color:green}(${hotlist}${color:green})", - NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_format, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_hotlist_level[3] = weechat_config_new_option ( - buflist_config_file, ptr_section, - "hotlist_highlight", "string", - N_("format for a buffer with hotlist level \"highlight\" " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, "${color:magenta}", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_hotlist_level[0] = weechat_config_new_option ( - buflist_config_file, ptr_section, - "hotlist_low", "string", - N_("format for a buffer with hotlist level \"low\" " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, "${color:white}", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_hotlist_level[1] = weechat_config_new_option ( - buflist_config_file, ptr_section, - "hotlist_message", "string", - N_("format for a buffer with hotlist level \"message\" " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, "${color:brown}", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_hotlist_level_none = weechat_config_new_option ( - buflist_config_file, ptr_section, - "hotlist_none", "string", - N_("format for a buffer not in hotlist " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, "${color:default}", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_hotlist_level[2] = weechat_config_new_option ( - buflist_config_file, ptr_section, - "hotlist_private", "string", - N_("format for a buffer with hotlist level \"private\" " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, "${color:green}", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_hotlist_separator = weechat_config_new_option ( - buflist_config_file, ptr_section, - "hotlist_separator", "string", - N_("separator for counts in hotlist " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, "${color:default},", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_indent = weechat_config_new_option ( - buflist_config_file, ptr_section, - "indent", "string", - N_("string displayed to indent channel and private buffers " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, " ", NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_lag = weechat_config_new_option ( - buflist_config_file, ptr_section, - "lag", "string", - N_("format for lag on an IRC server buffer " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, - " ${color:green}[${color:brown}${lag}${color:green}]", - NULL, 0, - NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_name = weechat_config_new_option ( - buflist_config_file, ptr_section, - "name", "string", - N_("format for buffer name " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, "${name}", NULL, 0, + /* format */ + buflist_config_section_format = weechat_config_new_section ( + buflist_config_file, "format", + 0, 0, NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_nick_prefix = weechat_config_new_option ( - buflist_config_file, ptr_section, - "nick_prefix", "string", - N_("format for nick prefix on a channel " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, "${color_nick_prefix}${nick_prefix}", NULL, 0, NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_number = weechat_config_new_option ( - buflist_config_file, ptr_section, - "number", "string", - N_("format for buffer number, ${number} is the indented number " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, - "${color:green}${number}${if:${number_displayed}?.: }", - NULL, 0, NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, - NULL, NULL, NULL); - buflist_config_format_tls_version = weechat_config_new_option ( - buflist_config_file, ptr_section, - "tls_version", "string", - N_("format for TLS version on an IRC server buffer " - "(note: content is evaluated, see /help buflist)"), - NULL, 0, 0, - " ${color:default}(${if:${tls_version}==TLS1.3?${color:green}:" - "${if:${tls_version}==TLS1.2?${color:yellow}:${color:red}}}" - "${translate:${tls_version}}${color:default})", - NULL, 0, NULL, NULL, NULL, - &buflist_config_change_buflist, NULL, NULL, NULL, NULL, NULL); + if (buflist_config_section_format) + { + buflist_config_format_buffer = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "buffer", "string", + N_("format of each line with a buffer " + "(note: content is evaluated, see /help buflist); " + "example: standard format for bar item \"buflist\" and only the " + "buffer number between square brackets for other bar items " + "(\"buflist2\" and \"buflist3\"): " + "\"${if:${bar_item.name}==buflist?${format_number}${indent}" + "${format_nick_prefix}${color_hotlist}${format_name}:" + "[${number}]}\""), + NULL, 0, 0, + "${format_number}${indent}${format_nick_prefix}${color_hotlist}" + "${format_name}", + NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_format, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_buffer_current = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "buffer_current", "string", + N_("format for the line with current buffer " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, "${color:,blue}${format_buffer}", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_format, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_hotlist = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "hotlist", "string", + N_("format for hotlist " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, + " ${color:green}(${hotlist}${color:green})", + NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_format, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_hotlist_level[3] = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "hotlist_highlight", "string", + N_("format for a buffer with hotlist level \"highlight\" " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, "${color:magenta}", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_hotlist_level[0] = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "hotlist_low", "string", + N_("format for a buffer with hotlist level \"low\" " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, "${color:white}", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_hotlist_level[1] = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "hotlist_message", "string", + N_("format for a buffer with hotlist level \"message\" " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, "${color:brown}", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_hotlist_level_none = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "hotlist_none", "string", + N_("format for a buffer not in hotlist " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, "${color:default}", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_hotlist_level[2] = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "hotlist_private", "string", + N_("format for a buffer with hotlist level \"private\" " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, "${color:green}", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_hotlist_separator = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "hotlist_separator", "string", + N_("separator for counts in hotlist " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, "${color:default},", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_indent = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "indent", "string", + N_("string displayed to indent channel and private buffers " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, " ", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_lag = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "lag", "string", + N_("format for lag on an IRC server buffer " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, + " ${color:green}[${color:brown}${lag}${color:green}]", + NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_name = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "name", "string", + N_("format for buffer name " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, "${name}", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_nick_prefix = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "nick_prefix", "string", + N_("format for nick prefix on a channel " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, "${color_nick_prefix}${nick_prefix}", NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_number = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "number", "string", + N_("format for buffer number, ${number} is the indented number " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, + "${color:green}${number}${if:${number_displayed}?.: }", + NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + buflist_config_format_tls_version = weechat_config_new_option ( + buflist_config_file, buflist_config_section_format, + "tls_version", "string", + N_("format for TLS version on an IRC server buffer " + "(note: content is evaluated, see /help buflist)"), + NULL, 0, 0, + " ${color:default}(${if:${tls_version}==TLS1.3?${color:green}:" + "${if:${tls_version}==TLS1.2?${color:yellow}:${color:red}}}" + "${translate:${tls_version}}${color:default})", + NULL, 0, + NULL, NULL, NULL, + &buflist_config_change_buflist, NULL, NULL, + NULL, NULL, NULL); + } return 1; } diff --git a/src/plugins/exec/exec-config.c b/src/plugins/exec/exec-config.c index 6c6ef8783..ba21ac65b 100644 --- a/src/plugins/exec/exec-config.c +++ b/src/plugins/exec/exec-config.c @@ -30,16 +30,21 @@ struct t_config_file *exec_config_file = NULL; +/* sections */ + +struct t_config_section *exec_config_section_command = NULL; +struct t_config_section *exec_config_section_color = NULL; + /* exec config, command section */ -struct t_config_option *exec_config_command_default_options; -struct t_config_option *exec_config_command_purge_delay; -struct t_config_option *exec_config_command_shell; +struct t_config_option *exec_config_command_default_options = NULL; +struct t_config_option *exec_config_command_purge_delay = NULL; +struct t_config_option *exec_config_command_shell = NULL; /* exec config, color section */ -struct t_config_option *exec_config_color_flag_finished; -struct t_config_option *exec_config_color_flag_running; +struct t_config_option *exec_config_color_flag_finished = NULL; +struct t_config_option *exec_config_color_flag_running = NULL; char **exec_config_cmd_options = NULL; int exec_config_cmd_num_options = 0; @@ -98,85 +103,78 @@ exec_config_reload_cb (const void *pointer, void *data, int exec_config_init () { - struct t_config_section *ptr_section; - exec_config_file = weechat_config_new (EXEC_CONFIG_PRIO_NAME, &exec_config_reload_cb, NULL, NULL); if (!exec_config_file) return 0; /* command */ - ptr_section = weechat_config_new_section (exec_config_file, "command", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + exec_config_section_command = weechat_config_new_section ( + exec_config_file, "command", + 0, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + if (exec_config_section_command) { - weechat_config_free (exec_config_file); - exec_config_file = NULL; - return 0; + exec_config_command_default_options = weechat_config_new_option ( + exec_config_file, exec_config_section_command, + "default_options", "string", + N_("default options for command /exec (see /help exec); example: " + "\"-nosh -bg\" to run all commands in background (no output), " + "and without using the shell"), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, + &exec_config_change_command_default_options, NULL, NULL, + NULL, NULL, NULL); + exec_config_command_purge_delay = weechat_config_new_option ( + exec_config_file, exec_config_section_command, + "purge_delay", "integer", + N_("delay for purging finished commands (in seconds, 0 = purge " + "commands immediately, -1 = never purge)"), + NULL, -1, 36000 * 24 * 30, "0", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + exec_config_command_shell = weechat_config_new_option ( + exec_config_file, exec_config_section_command, + "shell", "string", + N_("shell to use with command \"/exec -sh\"; it can be just the " + "name of shell if it is in PATH (for example \"bash\") or the " + "absolute path to the shell (for example \"/bin/bash\"); if " + "value is empty, \"sh\" is used (note: content is evaluated, " + "see /help eval)"), + NULL, 0, 0, "${env:SHELL}", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); } - exec_config_command_default_options = weechat_config_new_option ( - exec_config_file, ptr_section, - "default_options", "string", - N_("default options for command /exec (see /help exec); example: " - "\"-nosh -bg\" to run all commands in background (no output), and " - "without using the shell"), - NULL, 0, 0, "", NULL, 0, + /* color */ + exec_config_section_color = weechat_config_new_section ( + exec_config_file, "color", + 0, 0, + NULL, NULL, NULL, NULL, NULL, NULL, - &exec_config_change_command_default_options, NULL, NULL, - NULL, NULL, NULL); - exec_config_command_purge_delay = weechat_config_new_option ( - exec_config_file, ptr_section, - "purge_delay", "integer", - N_("delay for purging finished commands (in seconds, 0 = purge " - "commands immediately, -1 = never purge)"), - NULL, -1, 36000 * 24 * 30, "0", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - exec_config_command_shell = weechat_config_new_option ( - exec_config_file, ptr_section, - "shell", "string", - N_("shell to use with command \"/exec -sh\"; it can be just the name " - "of shell if it is in PATH (for example \"bash\") or the absolute " - "path to the shell (for example \"/bin/bash\"); if value is empty, " - "\"sh\" is used (note: content is evaluated, see /help eval)"), - NULL, 0, 0, "${env:SHELL}", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - /* color */ - ptr_section = weechat_config_new_section (exec_config_file, "color", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (exec_config_section_color) { - weechat_config_free (exec_config_file); - exec_config_file = NULL; - return 0; + exec_config_color_flag_finished = weechat_config_new_option ( + exec_config_file, exec_config_section_color, + "flag_finished", "color", + N_("text color for a finished command flag in list of commands"), + NULL, 0, 0, "lightred", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + exec_config_color_flag_running = weechat_config_new_option ( + exec_config_file, exec_config_section_color, + "flag_running", "color", + N_("text color for a running command flag in list of commands"), + NULL, 0, 0, "lightgreen", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - exec_config_color_flag_finished = weechat_config_new_option ( - exec_config_file, ptr_section, - "flag_finished", "color", - N_("text color for a finished command flag in list of commands"), - NULL, 0, 0, "lightred", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - exec_config_color_flag_running = weechat_config_new_option ( - exec_config_file, ptr_section, - "flag_running", "color", - N_("text color for a running command flag in list of commands"), - NULL, 0, 0, "lightgreen", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - return 1; } diff --git a/src/plugins/fifo/fifo-config.c b/src/plugins/fifo/fifo-config.c index 11f03a9e9..e8dd23e9c 100644 --- a/src/plugins/fifo/fifo-config.c +++ b/src/plugins/fifo/fifo-config.c @@ -28,10 +28,14 @@ struct t_config_file *fifo_config_file = NULL; +/* sections */ + +struct t_config_section *fifo_config_section_file = NULL; + /* fifo config, file section */ -struct t_config_option *fifo_config_file_enabled; -struct t_config_option *fifo_config_file_path; +struct t_config_option *fifo_config_file_enabled = NULL; +struct t_config_option *fifo_config_file_path = NULL; /* @@ -85,47 +89,42 @@ fifo_config_change_file_path (const void *pointer, void *data, int fifo_config_init () { - struct t_config_section *ptr_section; - fifo_config_file = weechat_config_new (FIFO_CONFIG_PRIO_NAME, NULL, NULL, NULL); if (!fifo_config_file) return 0; /* file */ - ptr_section = weechat_config_new_section (fifo_config_file, "file", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (fifo_config_file); - fifo_config_file = NULL; - return 0; - } - - fifo_config_file_enabled = weechat_config_new_option ( - fifo_config_file, ptr_section, - "enabled", "boolean", - N_("enable FIFO pipe"), - NULL, 0, 0, "on", NULL, 0, + fifo_config_section_file = weechat_config_new_section ( + fifo_config_file, "file", + 0, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, - &fifo_config_change_file_enabled, NULL, NULL, - NULL, NULL, NULL); - fifo_config_file_path = weechat_config_new_option ( - fifo_config_file, ptr_section, - "path", "string", - N_("path for FIFO file; " - "WeeChat PID can be used in path with ${info:pid} " - "(path is evaluated, see function string_eval_path_home in " - "plugin API reference)"), - NULL, 0, 0, "${weechat_runtime_dir}/weechat_fifo_${info:pid}", NULL, 0, NULL, NULL, NULL, - fifo_config_change_file_path, NULL, NULL, NULL, NULL, NULL); + if (fifo_config_section_file) + { + fifo_config_file_enabled = weechat_config_new_option ( + fifo_config_file, fifo_config_section_file, + "enabled", "boolean", + N_("enable FIFO pipe"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &fifo_config_change_file_enabled, NULL, NULL, + NULL, NULL, NULL); + fifo_config_file_path = weechat_config_new_option ( + fifo_config_file, fifo_config_section_file, + "path", "string", + N_("path for FIFO file; " + "WeeChat PID can be used in path with ${info:pid} " + "(path is evaluated, see function string_eval_path_home in " + "plugin API reference)"), + NULL, 0, 0, "${weechat_runtime_dir}/weechat_fifo_${info:pid}", NULL, 0, + NULL, NULL, NULL, + fifo_config_change_file_path, NULL, NULL, + NULL, NULL, NULL); + } return 1; } diff --git a/src/plugins/fset/fset-config.c b/src/plugins/fset/fset-config.c index 26c73c7c2..08908d0a0 100644 --- a/src/plugins/fset/fset-config.c +++ b/src/plugins/fset/fset-config.c @@ -32,67 +32,73 @@ struct t_config_file *fset_config_file = NULL; +/* sections */ + +struct t_config_section *fset_config_section_look = NULL; +struct t_config_section *fset_config_section_format = NULL; +struct t_config_section *fset_config_section_color = NULL; + /* fset config, look section */ -struct t_config_option *fset_config_look_auto_refresh; -struct t_config_option *fset_config_look_auto_unmark; -struct t_config_option *fset_config_look_condition_catch_set; -struct t_config_option *fset_config_look_export_help_default; -struct t_config_option *fset_config_look_format_number; -struct t_config_option *fset_config_look_marked_string; -struct t_config_option *fset_config_look_scroll_horizontal; -struct t_config_option *fset_config_look_show_plugins_desc; -struct t_config_option *fset_config_look_sort; -struct t_config_option *fset_config_look_unmarked_string; -struct t_config_option *fset_config_look_use_color_value; -struct t_config_option *fset_config_look_use_keys; -struct t_config_option *fset_config_look_use_mute; +struct t_config_option *fset_config_look_auto_refresh = NULL; +struct t_config_option *fset_config_look_auto_unmark = NULL; +struct t_config_option *fset_config_look_condition_catch_set = NULL; +struct t_config_option *fset_config_look_export_help_default = NULL; +struct t_config_option *fset_config_look_format_number = NULL; +struct t_config_option *fset_config_look_marked_string = NULL; +struct t_config_option *fset_config_look_scroll_horizontal = NULL; +struct t_config_option *fset_config_look_show_plugins_desc = NULL; +struct t_config_option *fset_config_look_sort = NULL; +struct t_config_option *fset_config_look_unmarked_string = NULL; +struct t_config_option *fset_config_look_use_color_value = NULL; +struct t_config_option *fset_config_look_use_keys = NULL; +struct t_config_option *fset_config_look_use_mute = NULL; /* fset config, format section */ -struct t_config_option *fset_config_format_export_help; -struct t_config_option *fset_config_format_export_option; -struct t_config_option *fset_config_format_export_option_null; -struct t_config_option *fset_config_format_option[2]; +struct t_config_option *fset_config_format_export_help = NULL; +struct t_config_option *fset_config_format_export_option = NULL; +struct t_config_option *fset_config_format_export_option_null = NULL; +struct t_config_option *fset_config_format_option[2] = { NULL, NULL }; /* fset config, color section */ -struct t_config_option *fset_config_color_default_value[2]; -struct t_config_option *fset_config_color_description[2]; -struct t_config_option *fset_config_color_file[2]; -struct t_config_option *fset_config_color_file_changed[2]; -struct t_config_option *fset_config_color_help_default_value; -struct t_config_option *fset_config_color_help_description; -struct t_config_option *fset_config_color_help_name; -struct t_config_option *fset_config_color_help_quotes; -struct t_config_option *fset_config_color_help_values; -struct t_config_option *fset_config_color_index[2]; -struct t_config_option *fset_config_color_line_marked_bg[2]; -struct t_config_option *fset_config_color_line_selected_bg[2]; -struct t_config_option *fset_config_color_marked[2]; -struct t_config_option *fset_config_color_max[2]; -struct t_config_option *fset_config_color_min[2]; -struct t_config_option *fset_config_color_name[2]; -struct t_config_option *fset_config_color_name_changed[2]; -struct t_config_option *fset_config_color_option[2]; -struct t_config_option *fset_config_color_option_changed[2]; -struct t_config_option *fset_config_color_parent_name[2]; -struct t_config_option *fset_config_color_parent_value[2]; -struct t_config_option *fset_config_color_quotes[2]; -struct t_config_option *fset_config_color_quotes_changed[2]; -struct t_config_option *fset_config_color_section[2]; -struct t_config_option *fset_config_color_section_changed[2]; -struct t_config_option *fset_config_color_string_values[2]; -struct t_config_option *fset_config_color_title_count_options; -struct t_config_option *fset_config_color_title_current_option; -struct t_config_option *fset_config_color_title_filter; -struct t_config_option *fset_config_color_title_marked_options; -struct t_config_option *fset_config_color_title_sort; -struct t_config_option *fset_config_color_type[2]; -struct t_config_option *fset_config_color_unmarked[2]; -struct t_config_option *fset_config_color_value[2]; -struct t_config_option *fset_config_color_value_changed[2]; -struct t_config_option *fset_config_color_value_undef[2]; +struct t_config_option *fset_config_color_default_value[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_description[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_file[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_file_changed[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_help_default_value = NULL; +struct t_config_option *fset_config_color_help_description = NULL; +struct t_config_option *fset_config_color_help_name = NULL; +struct t_config_option *fset_config_color_help_quotes = NULL; +struct t_config_option *fset_config_color_help_values = NULL; +struct t_config_option *fset_config_color_index[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_line_marked_bg[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_line_selected_bg[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_marked[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_max[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_min[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_name[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_name_changed[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_option[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_option_changed[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_parent_name[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_parent_value[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_quotes[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_quotes_changed[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_section[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_section_changed[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_string_values[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_title_count_options = NULL; +struct t_config_option *fset_config_color_title_current_option = NULL; +struct t_config_option *fset_config_color_title_filter = NULL; +struct t_config_option *fset_config_color_title_marked_options = NULL; +struct t_config_option *fset_config_color_title_sort = NULL; +struct t_config_option *fset_config_color_type[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_unmarked[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_value[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_value_changed[2] = { NULL, NULL }; +struct t_config_option *fset_config_color_value_undef[2] = { NULL, NULL }; char **fset_config_auto_refresh = NULL; char **fset_config_sort_fields = NULL; @@ -363,755 +369,744 @@ fset_config_change_title_color_cb (const void *pointer, void *data, int fset_config_init () { - struct t_config_section *ptr_section; - fset_config_file = weechat_config_new (FSET_CONFIG_PRIO_NAME, &fset_config_reload, NULL, NULL); if (!fset_config_file) return 0; /* look */ - ptr_section = weechat_config_new_section (fset_config_file, "look", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (fset_config_file); - fset_config_file = NULL; - return 0; - } - - fset_config_look_auto_refresh = weechat_config_new_option ( - fset_config_file, ptr_section, - "auto_refresh", "string", - N_("comma separated list of options to automatically refresh on the " - "fset buffer (if opened); \"*\" means all options (recommended), " - "a name beginning with \"!\" is a negative value to prevent an " - "option to be refreshed, wildcard \"*\" is allowed in names " - "(example: \"*,!plugin.section.*\")"), - NULL, 0, 0, "*", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_auto_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_auto_unmark = weechat_config_new_option ( - fset_config_file, ptr_section, - "auto_unmark", "boolean", - N_("automatically unmark all options after an action on marked " - "options or after a refresh"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_condition_catch_set = weechat_config_new_option ( - fset_config_file, ptr_section, - "condition_catch_set", "string", - N_("condition to catch /set command and display results in the fset " - "buffer; following variables can be used: ${name} (name of option " - "given for the /set command), ${count} (number of options found " - "with the /set argument); an empty string disables the catch of " - "/set command; with value \"1\", the fset buffer is always used " - "with /set command"), - NULL, 0, 0, "${count} >= 1", NULL, 0, - NULL, NULL, NULL, + fset_config_section_look = weechat_config_new_section ( + fset_config_file, "look", + 0, 0, NULL, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_export_help_default = weechat_config_new_option ( - fset_config_file, ptr_section, - "export_help_default", "boolean", - N_("write help for each option exported by default (this can be " - "overridden with arguments \"-help\" and \"-nohelp\" for command " - "/fset -export)"), - NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_format_number = weechat_config_new_option ( - fset_config_file, ptr_section, - "format_number", "integer", - N_("number of format used to display options; this is dynamically " - "changed by the key ctrl-x on the fset buffer"), - NULL, 1, 2, "1", NULL, 0, NULL, NULL, NULL, - &fset_config_change_format_number_cb, NULL, NULL, NULL, NULL, NULL); - fset_config_look_marked_string = weechat_config_new_option ( - fset_config_file, ptr_section, - "marked_string", "string", - N_("string displayed when an option is marked (to do an action on " - "multiple options)"), - NULL, 0, 0, "*", NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_scroll_horizontal = weechat_config_new_option ( - fset_config_file, ptr_section, - "scroll_horizontal", "integer", - N_("left/right scroll in fset buffer (percent of width)"), - NULL, 1, 100, "10", NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_show_plugins_desc = weechat_config_new_option ( - fset_config_file, ptr_section, - "show_plugins_desc", "boolean", - N_("show the plugin description options (plugins.desc.*)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_show_plugins_desc_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_sort = weechat_config_new_option ( - fset_config_file, ptr_section, - "sort", "string", - N_("comma-separated list of fields to sort options (see /help fset " - "for a list of fields); char \"-\" can be used before field to " - "reverse order, char \"~\" can be used to do a case insensitive " - "comparison; example: \"-~name\" for case insensitive and reverse " - "sort on option name"), - NULL, 0, 0, "~name", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_sort_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_unmarked_string = weechat_config_new_option ( - fset_config_file, ptr_section, - "unmarked_string", "string", - N_("string displayed when an option is not marked"), - NULL, 0, 0, " ", NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_use_color_value = weechat_config_new_option ( - fset_config_file, ptr_section, - "use_color_value", "boolean", - N_("use the color to display value of color options"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_use_color_value_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_use_keys = weechat_config_new_option ( - fset_config_file, ptr_section, - "use_keys", "boolean", - N_("use keys alt+X in fset buffer to do actions on options; " - "if disabled, only the input is allowed"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_use_keys_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_look_use_mute = weechat_config_new_option ( - fset_config_file, ptr_section, - "use_mute", "boolean", - N_("use /mute command to set options"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_use_keys_cb, NULL, NULL, - NULL, NULL, NULL); - - /* format */ - ptr_section = weechat_config_new_section (fset_config_file, "format", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (fset_config_section_look) { - weechat_config_free (fset_config_file); - fset_config_file = NULL; - return 0; + fset_config_look_auto_refresh = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "auto_refresh", "string", + N_("comma separated list of options to automatically refresh on the " + "fset buffer (if opened); \"*\" means all options (recommended), " + "a name beginning with \"!\" is a negative value to prevent an " + "option to be refreshed, wildcard \"*\" is allowed in names " + "(example: \"*,!plugin.section.*\")"), + NULL, 0, 0, "*", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_auto_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_auto_unmark = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "auto_unmark", "boolean", + N_("automatically unmark all options after an action on marked " + "options or after a refresh"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_condition_catch_set = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "condition_catch_set", "string", + N_("condition to catch /set command and display results in the fset " + "buffer; following variables can be used: ${name} (name of option " + "given for the /set command), ${count} (number of options found " + "with the /set argument); an empty string disables the catch of " + "/set command; with value \"1\", the fset buffer is always used " + "with /set command"), + NULL, 0, 0, "${count} >= 1", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_export_help_default = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "export_help_default", "boolean", + N_("write help for each option exported by default (this can be " + "overridden with arguments \"-help\" and \"-nohelp\" for command " + "/fset -export)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_format_number = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "format_number", "integer", + N_("number of format used to display options; this is dynamically " + "changed by the key ctrl-x on the fset buffer"), + NULL, 1, 2, "1", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_format_number_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_marked_string = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "marked_string", "string", + N_("string displayed when an option is marked (to do an action on " + "multiple options)"), + NULL, 0, 0, "*", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_scroll_horizontal = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "scroll_horizontal", "integer", + N_("left/right scroll in fset buffer (percent of width)"), + NULL, 1, 100, "10", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_show_plugins_desc = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "show_plugins_desc", "boolean", + N_("show the plugin description options (plugins.desc.*)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_show_plugins_desc_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_sort = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "sort", "string", + N_("comma-separated list of fields to sort options (see /help fset " + "for a list of fields); char \"-\" can be used before field to " + "reverse order, char \"~\" can be used to do a case insensitive " + "comparison; example: \"-~name\" for case insensitive and " + "reverse sort on option name"), + NULL, 0, 0, "~name", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_sort_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_unmarked_string = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "unmarked_string", "string", + N_("string displayed when an option is not marked"), + NULL, 0, 0, " ", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_use_color_value = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "use_color_value", "boolean", + N_("use the color to display value of color options"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_use_color_value_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_use_keys = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "use_keys", "boolean", + N_("use keys alt+X in fset buffer to do actions on options; " + "if disabled, only the input is allowed"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_use_keys_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_look_use_mute = weechat_config_new_option ( + fset_config_file, fset_config_section_look, + "use_mute", "boolean", + N_("use /mute command to set options"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_use_keys_cb, NULL, NULL, + NULL, NULL, NULL); } - fset_config_format_export_help = weechat_config_new_option ( - fset_config_file, ptr_section, - "export_help", "string", - N_("format of help line written before each option exported in a file " - "(note: content is evaluated, see /help fset)"), - NULL, 0, 0, - "# ${description2}", - NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - fset_config_format_export_option = weechat_config_new_option ( - fset_config_file, ptr_section, - "export_option", "string", - N_("format of each option exported in a file " - "(note: content is evaluated, see /help fset)"), - NULL, 0, 0, - "/set ${name} ${quoted_value}", - NULL, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - fset_config_format_export_option_null = weechat_config_new_option ( - fset_config_file, ptr_section, - "export_option_null", "string", - N_("format of each option with \"null\" value exported in a file " - "(note: content is evaluated, see /help fset)"), - NULL, 0, 0, - "/unset ${name}", - NULL, 0, + /* format */ + fset_config_section_format = weechat_config_new_section ( + fset_config_file, "format", + 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL); - fset_config_format_option[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "option1", "string", - N_("first format of each line, used when option " - "fset.look.format_number is set to 1 " - "(note: content is evaluated, see /help fset); " - "an empty string uses the default format " - "(\"${marked} ${name} ${type} ${value2}\"), which is without " - "evaluation of string and then much faster; " - "formats can be switched with key ctrl-x"), - NULL, 0, 0, - "", - NULL, 0, NULL, NULL, NULL, - &fset_config_change_format_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_format_option[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "option2", "string", - N_("second format of each line, used when option " - "fset.look.format_number is set to 2 " - "(note: content is evaluated, see /help fset); " - "an empty string uses the default format " - "(\"${marked} ${name} ${type} ${value2}\"), which is without " - "evaluation of string and then much faster; " - "formats can be switched with key ctrl-x"), - NULL, 0, 0, - "${marked} ${name} ${type} ${value2}${newline}" - " ${empty_name} ${_default_value}${color:darkgray} -- " - "${min}..${max}${newline}" - " ${empty_name} ${description}", - NULL, 0, NULL, NULL, NULL, - &fset_config_change_format_cb, NULL, NULL, NULL, NULL, NULL); - - /* color */ - ptr_section = weechat_config_new_section (fset_config_file, "color", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (fset_config_section_format) { - weechat_config_free (fset_config_file); - fset_config_file = NULL; - return 0; + fset_config_format_export_help = weechat_config_new_option ( + fset_config_file, fset_config_section_format, + "export_help", "string", + N_("format of help line written before each option exported in a " + "file (note: content is evaluated, see /help fset)"), + NULL, 0, 0, + "# ${description2}", + NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + fset_config_format_export_option = weechat_config_new_option ( + fset_config_file, fset_config_section_format, + "export_option", "string", + N_("format of each option exported in a file " + "(note: content is evaluated, see /help fset)"), + NULL, 0, 0, + "/set ${name} ${quoted_value}", + NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + fset_config_format_export_option_null = weechat_config_new_option ( + fset_config_file, fset_config_section_format, + "export_option_null", "string", + N_("format of each option with \"null\" value exported in a file " + "(note: content is evaluated, see /help fset)"), + NULL, 0, 0, + "/unset ${name}", + NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + fset_config_format_option[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_format, + "option1", "string", + N_("first format of each line, used when option " + "fset.look.format_number is set to 1 " + "(note: content is evaluated, see /help fset); " + "an empty string uses the default format " + "(\"${marked} ${name} ${type} ${value2}\"), which is without " + "evaluation of string and then much faster; " + "formats can be switched with key ctrl-x"), + NULL, 0, 0, + "", + NULL, 0, + NULL, NULL, NULL, + &fset_config_change_format_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_format_option[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_format, + "option2", "string", + N_("second format of each line, used when option " + "fset.look.format_number is set to 2 " + "(note: content is evaluated, see /help fset); " + "an empty string uses the default format " + "(\"${marked} ${name} ${type} ${value2}\"), which is without " + "evaluation of string and then much faster; " + "formats can be switched with key ctrl-x"), + NULL, 0, 0, + "${marked} ${name} ${type} ${value2}${newline}" + " ${empty_name} ${_default_value}${color:darkgray} -- " + "${min}..${max}${newline}" + " ${empty_name} ${description}", + NULL, 0, + NULL, NULL, NULL, + &fset_config_change_format_cb, NULL, NULL, + NULL, NULL, NULL); } - fset_config_color_default_value[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "default_value", "color", - N_("color for default value"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_default_value[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "default_value_selected", "color", - N_("color for default value on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_description[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "description", "color", - N_("color for description"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_description[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "description_selected", "color", - N_("color for description on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_file[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "file", "color", - N_("color for file"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_file_changed[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "file_changed", "color", - N_("color for file if value is changed"), - NULL, 0, 0, "brown", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_file_changed[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "file_changed_selected", "color", - N_("color for file if value is changed on the selected line"), - NULL, 0, 0, "yellow", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_file[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "file_selected", "color", - N_("color for file on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_help_default_value = weechat_config_new_option ( - fset_config_file, ptr_section, - "help_default_value", "color", - N_("color for default value in help bar"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_help_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_help_description = weechat_config_new_option ( - fset_config_file, ptr_section, - "help_description", "color", - N_("color for description in help bar"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_help_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_help_name = weechat_config_new_option ( - fset_config_file, ptr_section, - "help_name", "color", - N_("color for name in help bar"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_help_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_help_quotes = weechat_config_new_option ( - fset_config_file, ptr_section, - "help_quotes", "color", - N_("color for quotes around string values"), - NULL, 0, 0, "darkgray", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_help_values = weechat_config_new_option ( - fset_config_file, ptr_section, - "help_values", "color", - N_("color for allowed values"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_index[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "index", "color", - N_("color for index of option"), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_index[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "index_selected", "color", - N_("color for index of option on the selected line"), - NULL, 0, 0, "lightcyan", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_line_marked_bg[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "line_marked_bg1", "color", - N_("background color for a marked line " - "(used with the first format, see option fset.format.option1)"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_line_marked_bg[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "line_marked_bg2", "color", - N_("background color for a marked line " - "(used with the second format, see option fset.format.option2)"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_line_selected_bg[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "line_selected_bg1", "color", - N_("background color for the selected line " - "(used with the first format, see option fset.format.option1)"), - NULL, 0, 0, "blue", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_line_selected_bg[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "line_selected_bg2", "color", - N_("background color for the selected line " - "(used with the second format, see option fset.format.option2)"), - NULL, 0, 0, "red", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_marked[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "marked", "color", - N_("color for mark indicator"), - NULL, 0, 0, "brown", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_marked[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "marked_selected", "color", - N_("color for mark indicator on the selected line"), - NULL, 0, 0, "yellow", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_max[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "max", "color", - N_("color for max value"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_max[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "max_selected", "color", - N_("color for max value on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_min[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "min", "color", - N_("color for min value"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_min[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "min_selected", "color", - N_("color for min value on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_name[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "name", "color", - N_("color for name"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_name_changed[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "name_changed", "color", - N_("color for name if value is changed"), - NULL, 0, 0, "brown", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_name_changed[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "name_changed_selected", "color", - N_("color for name if value is changed on the selected line"), - NULL, 0, 0, "yellow", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_name[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "name_selected", "color", - N_("color for name on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_option[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "option", "color", - N_("color for option"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_option_changed[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "option_changed", "color", - N_("color for option if value is changed"), - NULL, 0, 0, "brown", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_option_changed[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "option_changed_selected", "color", - N_("color for option if value is changed on the selected line"), - NULL, 0, 0, "yellow", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_option[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "option_selected", "color", - N_("color for option on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_parent_name[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "parent_name", "color", - N_("color for name of parent option"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_parent_name[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "parent_name_selected", "color", - N_("color for name of parent option on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_parent_value[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "parent_value", "color", - N_("color for value of parent option"), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_parent_value[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "parent_value_selected", "color", - N_("color for value of parent option on the selected line"), - NULL, 0, 0, "lightcyan", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_quotes[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "quotes", "color", - N_("color for quotes around string values"), - NULL, 0, 0, "darkgray", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_quotes_changed[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "quotes_changed", "color", - N_("color for quotes around string values which are changed"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_quotes_changed[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "quotes_changed_selected", "color", - N_("color for quotes around string values which are changed " - "on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_quotes[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "quotes_selected", "color", - N_("color for quotes around string values on the selected line"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_section[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "section", "color", - N_("color for section"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_section_changed[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "section_changed", "color", - N_("color for section if value is changed"), - NULL, 0, 0, "brown", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_section_changed[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "section_changed_selected", "color", - N_("color for section if value is changed on the selected line"), - NULL, 0, 0, "yellow", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_section[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "section_selected", "color", - N_("color for section on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_string_values[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "string_values", "color", - N_("color for string values"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_string_values[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "string_values_selected", "color", - N_("color for string values on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_title_count_options = weechat_config_new_option ( - fset_config_file, ptr_section, - "title_count_options", "color", - N_("color for the count of options found with the current filter " - "in title of buffer"), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_title_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_title_current_option = weechat_config_new_option ( - fset_config_file, ptr_section, - "title_current_option", "color", - N_("color for current option number in title of buffer"), - NULL, 0, 0, "lightcyan", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_title_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_title_filter = weechat_config_new_option ( - fset_config_file, ptr_section, - "title_filter", "color", - N_("color for filter in title of buffer"), - NULL, 0, 0, "yellow", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_title_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_title_marked_options = weechat_config_new_option ( - fset_config_file, ptr_section, - "title_marked_options", "color", - N_("color for number of marked options in title of buffer"), - NULL, 0, 0, "lightgreen", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_title_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_title_sort = weechat_config_new_option ( - fset_config_file, ptr_section, - "title_sort", "color", - N_("color for sort in title of buffer"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_title_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_type[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "type", "color", - N_("color for type"), - NULL, 0, 0, "green", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_type[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "type_selected", "color", - N_("color for type on the selected line"), - NULL, 0, 0, "lightgreen", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_unmarked[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "unmarked", "color", - N_("color for mark indicator when the option is not marked"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_unmarked[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "unmarked_selected", "color", - N_("color for mark indicator when the option is not marked " - "on the selected line"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_value[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "value", "color", - N_("color for value"), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_value_changed[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "value_changed", "color", - N_("color for value changed (different from default)"), - NULL, 0, 0, "brown", NULL, 0, - NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_value_changed[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "value_changed_selected", "color", - N_("color for value changed (different from default) on the selected " - "line"), - NULL, 0, 0, "yellow", NULL, 0, + /* color */ + fset_config_section_color = weechat_config_new_section ( + fset_config_file, "color", + 0, 0, NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_value[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "value_selected", "color", - N_("color for value on the selected line"), - NULL, 0, 0, "lightcyan", NULL, 0, NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_value_undef[0] = weechat_config_new_option ( - fset_config_file, ptr_section, - "value_undef", "color", - N_("color for undefined value"), - NULL, 0, 0, "magenta", NULL, 0, NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, - NULL, NULL, NULL); - fset_config_color_value_undef[1] = weechat_config_new_option ( - fset_config_file, ptr_section, - "value_undef_selected", "color", - N_("color for undefined value on the selected line"), - NULL, 0, 0, "lightmagenta", NULL, 0, NULL, NULL, NULL, - &fset_config_change_color_cb, NULL, NULL, NULL, NULL, NULL); + if (fset_config_section_color) + { + fset_config_color_default_value[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "default_value", "color", + N_("color for default value"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_default_value[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "default_value_selected", "color", + N_("color for default value on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_description[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "description", "color", + N_("color for description"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_description[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "description_selected", "color", + N_("color for description on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_file[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "file", "color", + N_("color for file"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_file_changed[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "file_changed", "color", + N_("color for file if value is changed"), + NULL, 0, 0, "brown", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_file_changed[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "file_changed_selected", "color", + N_("color for file if value is changed on the selected line"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_file[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "file_selected", "color", + N_("color for file on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_help_default_value = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "help_default_value", "color", + N_("color for default value in help bar"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_help_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_help_description = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "help_description", "color", + N_("color for description in help bar"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_help_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_help_name = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "help_name", "color", + N_("color for name in help bar"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_help_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_help_quotes = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "help_quotes", "color", + N_("color for quotes around string values"), + NULL, 0, 0, "darkgray", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_help_values = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "help_values", "color", + N_("color for allowed values"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_index[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "index", "color", + N_("color for index of option"), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_index[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "index_selected", "color", + N_("color for index of option on the selected line"), + NULL, 0, 0, "lightcyan", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_line_marked_bg[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "line_marked_bg1", "color", + N_("background color for a marked line " + "(used with the first format, see option fset.format.option1)"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_line_marked_bg[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "line_marked_bg2", "color", + N_("background color for a marked line " + "(used with the second format, see option fset.format.option2)"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_line_selected_bg[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "line_selected_bg1", "color", + N_("background color for the selected line " + "(used with the first format, see option fset.format.option1)"), + NULL, 0, 0, "blue", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_line_selected_bg[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "line_selected_bg2", "color", + N_("background color for the selected line " + "(used with the second format, see option fset.format.option2)"), + NULL, 0, 0, "red", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_marked[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "marked", "color", + N_("color for mark indicator"), + NULL, 0, 0, "brown", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_marked[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "marked_selected", "color", + N_("color for mark indicator on the selected line"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_max[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "max", "color", + N_("color for max value"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_max[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "max_selected", "color", + N_("color for max value on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_min[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "min", "color", + N_("color for min value"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_min[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "min_selected", "color", + N_("color for min value on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_name[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "name", "color", + N_("color for name"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_name_changed[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "name_changed", "color", + N_("color for name if value is changed"), + NULL, 0, 0, "brown", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_name_changed[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "name_changed_selected", "color", + N_("color for name if value is changed on the selected line"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_name[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "name_selected", "color", + N_("color for name on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_option[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "option", "color", + N_("color for option"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_option_changed[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "option_changed", "color", + N_("color for option if value is changed"), + NULL, 0, 0, "brown", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_option_changed[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "option_changed_selected", "color", + N_("color for option if value is changed on the selected line"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_option[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "option_selected", "color", + N_("color for option on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_parent_name[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "parent_name", "color", + N_("color for name of parent option"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_parent_name[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "parent_name_selected", "color", + N_("color for name of parent option on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_parent_value[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "parent_value", "color", + N_("color for value of parent option"), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_parent_value[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "parent_value_selected", "color", + N_("color for value of parent option on the selected line"), + NULL, 0, 0, "lightcyan", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_quotes[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "quotes", "color", + N_("color for quotes around string values"), + NULL, 0, 0, "darkgray", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_quotes_changed[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "quotes_changed", "color", + N_("color for quotes around string values which are changed"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_quotes_changed[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "quotes_changed_selected", "color", + N_("color for quotes around string values which are changed " + "on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_quotes[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "quotes_selected", "color", + N_("color for quotes around string values on the selected line"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_section[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "section", "color", + N_("color for section"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_section_changed[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "section_changed", "color", + N_("color for section if value is changed"), + NULL, 0, 0, "brown", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_section_changed[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "section_changed_selected", "color", + N_("color for section if value is changed on the selected line"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_section[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "section_selected", "color", + N_("color for section on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_string_values[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "string_values", "color", + N_("color for string values"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_string_values[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "string_values_selected", "color", + N_("color for string values on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_title_count_options = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "title_count_options", "color", + N_("color for the count of options found with the current filter " + "in title of buffer"), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_title_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_title_current_option = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "title_current_option", "color", + N_("color for current option number in title of buffer"), + NULL, 0, 0, "lightcyan", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_title_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_title_filter = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "title_filter", "color", + N_("color for filter in title of buffer"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_title_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_title_marked_options = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "title_marked_options", "color", + N_("color for number of marked options in title of buffer"), + NULL, 0, 0, "lightgreen", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_title_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_title_sort = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "title_sort", "color", + N_("color for sort in title of buffer"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_title_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_type[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "type", "color", + N_("color for type"), + NULL, 0, 0, "green", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_type[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "type_selected", "color", + N_("color for type on the selected line"), + NULL, 0, 0, "lightgreen", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_unmarked[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "unmarked", "color", + N_("color for mark indicator when the option is not marked"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_unmarked[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "unmarked_selected", "color", + N_("color for mark indicator when the option is not marked " + "on the selected line"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_value[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "value", "color", + N_("color for value"), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_value_changed[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "value_changed", "color", + N_("color for value changed (different from default)"), + NULL, 0, 0, "brown", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_value_changed[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "value_changed_selected", "color", + N_("color for value changed (different from default) on the " + "selected line"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_value[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "value_selected", "color", + N_("color for value on the selected line"), + NULL, 0, 0, "lightcyan", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_value_undef[0] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "value_undef", "color", + N_("color for undefined value"), + NULL, 0, 0, "magenta", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + fset_config_color_value_undef[1] = weechat_config_new_option ( + fset_config_file, fset_config_section_color, + "value_undef_selected", "color", + N_("color for undefined value on the selected line"), + NULL, 0, 0, "lightmagenta", NULL, 0, + NULL, NULL, NULL, + &fset_config_change_color_cb, NULL, NULL, + NULL, NULL, NULL); + } return 1; } diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 57304bf38..bc243b15f 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -42,8 +42,15 @@ struct t_config_file *irc_config_file = NULL; + +/* sections */ + +struct t_config_section *irc_config_section_look = NULL; +struct t_config_section *irc_config_section_color = NULL; +struct t_config_section *irc_config_section_network = NULL; struct t_config_section *irc_config_section_msgbuffer = NULL; struct t_config_section *irc_config_section_ctcp = NULL; +struct t_config_section *irc_config_section_ignore = NULL; struct t_config_section *irc_config_section_server_default = NULL; struct t_config_section *irc_config_section_server = NULL; @@ -51,119 +58,122 @@ int irc_config_loading = 0; /* IRC config, look section */ -struct t_config_option *irc_config_look_buffer_open_before_autojoin; -struct t_config_option *irc_config_look_buffer_open_before_join; -struct t_config_option *irc_config_look_buffer_switch_autojoin; -struct t_config_option *irc_config_look_buffer_switch_join; -struct t_config_option *irc_config_look_color_nicks_in_names; -struct t_config_option *irc_config_look_color_nicks_in_nicklist; -struct t_config_option *irc_config_look_color_nicks_in_server_messages; -struct t_config_option *irc_config_look_color_pv_nick_like_channel; -struct t_config_option *irc_config_look_ctcp_time_format; -struct t_config_option *irc_config_look_display_account_message; -struct t_config_option *irc_config_look_display_away; -struct t_config_option *irc_config_look_display_ctcp_blocked; -struct t_config_option *irc_config_look_display_ctcp_reply; -struct t_config_option *irc_config_look_display_ctcp_unknown; -struct t_config_option *irc_config_look_display_extended_join; -struct t_config_option *irc_config_look_display_host_join; -struct t_config_option *irc_config_look_display_host_join_local; -struct t_config_option *irc_config_look_display_host_quit; -struct t_config_option *irc_config_look_display_join_message; -struct t_config_option *irc_config_look_display_old_topic; -struct t_config_option *irc_config_look_display_pv_away_once; -struct t_config_option *irc_config_look_display_pv_back; -struct t_config_option *irc_config_look_display_pv_nick_change; -struct t_config_option *irc_config_look_display_pv_warning_address; -struct t_config_option *irc_config_look_highlight_channel; -struct t_config_option *irc_config_look_highlight_pv; -struct t_config_option *irc_config_look_highlight_server; -struct t_config_option *irc_config_look_highlight_tags_restrict; -struct t_config_option *irc_config_look_item_channel_modes_hide_args; -struct t_config_option *irc_config_look_item_display_server; -struct t_config_option *irc_config_look_item_nick_modes; -struct t_config_option *irc_config_look_item_nick_prefix; -struct t_config_option *irc_config_look_join_auto_add_chantype; -struct t_config_option *irc_config_look_msgbuffer_fallback; -struct t_config_option *irc_config_look_new_channel_position; -struct t_config_option *irc_config_look_new_pv_position; -struct t_config_option *irc_config_look_nick_completion_smart; -struct t_config_option *irc_config_look_nick_mode; -struct t_config_option *irc_config_look_nick_mode_empty; -struct t_config_option *irc_config_look_nicks_hide_password; -struct t_config_option *irc_config_look_notice_as_pv; -struct t_config_option *irc_config_look_notice_welcome_redirect; -struct t_config_option *irc_config_look_notice_welcome_tags; -struct t_config_option *irc_config_look_notify_tags_ison; -struct t_config_option *irc_config_look_notify_tags_whois; -struct t_config_option *irc_config_look_part_closes_buffer; -struct t_config_option *irc_config_look_pv_buffer; -struct t_config_option *irc_config_look_pv_tags; -struct t_config_option *irc_config_look_raw_messages; -struct t_config_option *irc_config_look_typing_status_nicks; -struct t_config_option *irc_config_look_typing_status_self; -struct t_config_option *irc_config_look_server_buffer; -struct t_config_option *irc_config_look_smart_filter; -struct t_config_option *irc_config_look_smart_filter_account; -struct t_config_option *irc_config_look_smart_filter_chghost; -struct t_config_option *irc_config_look_smart_filter_delay; -struct t_config_option *irc_config_look_smart_filter_join; -struct t_config_option *irc_config_look_smart_filter_join_unmask; -struct t_config_option *irc_config_look_smart_filter_mode; -struct t_config_option *irc_config_look_smart_filter_nick; -struct t_config_option *irc_config_look_smart_filter_quit; -struct t_config_option *irc_config_look_smart_filter_setname; -struct t_config_option *irc_config_look_temporary_servers; -struct t_config_option *irc_config_look_topic_strip_colors; +struct t_config_option *irc_config_look_buffer_open_before_autojoin = NULL; +struct t_config_option *irc_config_look_buffer_open_before_join = NULL; +struct t_config_option *irc_config_look_buffer_switch_autojoin = NULL; +struct t_config_option *irc_config_look_buffer_switch_join = NULL; +struct t_config_option *irc_config_look_color_nicks_in_names = NULL; +struct t_config_option *irc_config_look_color_nicks_in_nicklist = NULL; +struct t_config_option *irc_config_look_color_nicks_in_server_messages = NULL; +struct t_config_option *irc_config_look_color_pv_nick_like_channel = NULL; +struct t_config_option *irc_config_look_ctcp_time_format = NULL; +struct t_config_option *irc_config_look_display_account_message = NULL; +struct t_config_option *irc_config_look_display_away = NULL; +struct t_config_option *irc_config_look_display_ctcp_blocked = NULL; +struct t_config_option *irc_config_look_display_ctcp_reply = NULL; +struct t_config_option *irc_config_look_display_ctcp_unknown = NULL; +struct t_config_option *irc_config_look_display_extended_join = NULL; +struct t_config_option *irc_config_look_display_host_join = NULL; +struct t_config_option *irc_config_look_display_host_join_local = NULL; +struct t_config_option *irc_config_look_display_host_quit = NULL; +struct t_config_option *irc_config_look_display_join_message = NULL; +struct t_config_option *irc_config_look_display_old_topic = NULL; +struct t_config_option *irc_config_look_display_pv_away_once = NULL; +struct t_config_option *irc_config_look_display_pv_back = NULL; +struct t_config_option *irc_config_look_display_pv_nick_change = NULL; +struct t_config_option *irc_config_look_display_pv_warning_address = NULL; +struct t_config_option *irc_config_look_highlight_channel = NULL; +struct t_config_option *irc_config_look_highlight_pv = NULL; +struct t_config_option *irc_config_look_highlight_server = NULL; +struct t_config_option *irc_config_look_highlight_tags_restrict = NULL; +struct t_config_option *irc_config_look_item_channel_modes_hide_args = NULL; +struct t_config_option *irc_config_look_item_display_server = NULL; +struct t_config_option *irc_config_look_item_nick_modes = NULL; +struct t_config_option *irc_config_look_item_nick_prefix = NULL; +struct t_config_option *irc_config_look_join_auto_add_chantype = NULL; +struct t_config_option *irc_config_look_msgbuffer_fallback = NULL; +struct t_config_option *irc_config_look_new_channel_position = NULL; +struct t_config_option *irc_config_look_new_pv_position = NULL; +struct t_config_option *irc_config_look_nick_completion_smart = NULL; +struct t_config_option *irc_config_look_nick_mode = NULL; +struct t_config_option *irc_config_look_nick_mode_empty = NULL; +struct t_config_option *irc_config_look_nicks_hide_password = NULL; +struct t_config_option *irc_config_look_notice_as_pv = NULL; +struct t_config_option *irc_config_look_notice_welcome_redirect = NULL; +struct t_config_option *irc_config_look_notice_welcome_tags = NULL; +struct t_config_option *irc_config_look_notify_tags_ison = NULL; +struct t_config_option *irc_config_look_notify_tags_whois = NULL; +struct t_config_option *irc_config_look_part_closes_buffer = NULL; +struct t_config_option *irc_config_look_pv_buffer = NULL; +struct t_config_option *irc_config_look_pv_tags = NULL; +struct t_config_option *irc_config_look_raw_messages = NULL; +struct t_config_option *irc_config_look_typing_status_nicks = NULL; +struct t_config_option *irc_config_look_typing_status_self = NULL; +struct t_config_option *irc_config_look_server_buffer = NULL; +struct t_config_option *irc_config_look_smart_filter = NULL; +struct t_config_option *irc_config_look_smart_filter_account = NULL; +struct t_config_option *irc_config_look_smart_filter_chghost = NULL; +struct t_config_option *irc_config_look_smart_filter_delay = NULL; +struct t_config_option *irc_config_look_smart_filter_join = NULL; +struct t_config_option *irc_config_look_smart_filter_join_unmask = NULL; +struct t_config_option *irc_config_look_smart_filter_mode = NULL; +struct t_config_option *irc_config_look_smart_filter_nick = NULL; +struct t_config_option *irc_config_look_smart_filter_quit = NULL; +struct t_config_option *irc_config_look_smart_filter_setname = NULL; +struct t_config_option *irc_config_look_temporary_servers = NULL; +struct t_config_option *irc_config_look_topic_strip_colors = NULL; /* IRC config, color section */ -struct t_config_option *irc_config_color_input_nick; -struct t_config_option *irc_config_color_item_channel_modes; -struct t_config_option *irc_config_color_item_lag_counting; -struct t_config_option *irc_config_color_item_lag_finished; -struct t_config_option *irc_config_color_item_nick_modes; -struct t_config_option *irc_config_color_item_tls_version_deprecated; -struct t_config_option *irc_config_color_item_tls_version_insecure; -struct t_config_option *irc_config_color_item_tls_version_ok; -struct t_config_option *irc_config_color_message_account; -struct t_config_option *irc_config_color_message_join; -struct t_config_option *irc_config_color_message_chghost; -struct t_config_option *irc_config_color_message_join; -struct t_config_option *irc_config_color_message_kick; -struct t_config_option *irc_config_color_message_quit; -struct t_config_option *irc_config_color_message_setname; -struct t_config_option *irc_config_color_mirc_remap; -struct t_config_option *irc_config_color_nick_prefixes; -struct t_config_option *irc_config_color_notice; -struct t_config_option *irc_config_color_reason_kick; -struct t_config_option *irc_config_color_reason_quit; -struct t_config_option *irc_config_color_topic_current; -struct t_config_option *irc_config_color_topic_new; -struct t_config_option *irc_config_color_topic_old; +struct t_config_option *irc_config_color_input_nick = NULL; +struct t_config_option *irc_config_color_item_channel_modes = NULL; +struct t_config_option *irc_config_color_item_lag_counting = NULL; +struct t_config_option *irc_config_color_item_lag_finished = NULL; +struct t_config_option *irc_config_color_item_nick_modes = NULL; +struct t_config_option *irc_config_color_item_tls_version_deprecated = NULL; +struct t_config_option *irc_config_color_item_tls_version_insecure = NULL; +struct t_config_option *irc_config_color_item_tls_version_ok = NULL; +struct t_config_option *irc_config_color_message_account = NULL; +struct t_config_option *irc_config_color_message_chghost = NULL; +struct t_config_option *irc_config_color_message_join = NULL; +struct t_config_option *irc_config_color_message_kick = NULL; +struct t_config_option *irc_config_color_message_quit = NULL; +struct t_config_option *irc_config_color_message_setname = NULL; +struct t_config_option *irc_config_color_mirc_remap = NULL; +struct t_config_option *irc_config_color_nick_prefixes = NULL; +struct t_config_option *irc_config_color_notice = NULL; +struct t_config_option *irc_config_color_reason_kick = NULL; +struct t_config_option *irc_config_color_reason_quit = NULL; +struct t_config_option *irc_config_color_topic_current = NULL; +struct t_config_option *irc_config_color_topic_new = NULL; +struct t_config_option *irc_config_color_topic_old = NULL; /* IRC config, network section */ -struct t_config_option *irc_config_network_autoreconnect_delay_growing; -struct t_config_option *irc_config_network_autoreconnect_delay_max; -struct t_config_option *irc_config_network_ban_mask_default; -struct t_config_option *irc_config_network_colors_receive; -struct t_config_option *irc_config_network_colors_send; -struct t_config_option *irc_config_network_lag_check; -struct t_config_option *irc_config_network_lag_max; -struct t_config_option *irc_config_network_lag_min_show; -struct t_config_option *irc_config_network_lag_reconnect; -struct t_config_option *irc_config_network_lag_refresh_interval; -struct t_config_option *irc_config_network_notify_check_ison; -struct t_config_option *irc_config_network_notify_check_whois; -struct t_config_option *irc_config_network_sasl_fail_unavailable; -struct t_config_option *irc_config_network_send_unknown_commands; -struct t_config_option *irc_config_network_whois_double_nick; +struct t_config_option *irc_config_network_autoreconnect_delay_growing = NULL; +struct t_config_option *irc_config_network_autoreconnect_delay_max = NULL; +struct t_config_option *irc_config_network_ban_mask_default = NULL; +struct t_config_option *irc_config_network_colors_receive = NULL; +struct t_config_option *irc_config_network_colors_send = NULL; +struct t_config_option *irc_config_network_lag_check = NULL; +struct t_config_option *irc_config_network_lag_max = NULL; +struct t_config_option *irc_config_network_lag_min_show = NULL; +struct t_config_option *irc_config_network_lag_reconnect = NULL; +struct t_config_option *irc_config_network_lag_refresh_interval = NULL; +struct t_config_option *irc_config_network_notify_check_ison = NULL; +struct t_config_option *irc_config_network_notify_check_whois = NULL; +struct t_config_option *irc_config_network_sasl_fail_unavailable = NULL; +struct t_config_option *irc_config_network_send_unknown_commands = NULL; +struct t_config_option *irc_config_network_whois_double_nick = NULL; /* IRC config, server section */ -struct t_config_option *irc_config_server_default[IRC_SERVER_NUM_OPTIONS]; - +struct t_config_option *irc_config_server_default[IRC_SERVER_NUM_OPTIONS] = { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +}; struct t_hook *irc_config_hook_config_nick_color_options = NULL; struct t_hook *irc_config_hook_config_chat_nick_colors = NULL; struct t_hashtable *irc_config_hashtable_display_join_message = NULL; @@ -2751,8 +2761,6 @@ irc_config_server_create_default_options (struct t_config_section *section) int irc_config_init () { - struct t_config_section *ptr_section; - irc_config_hashtable_display_join_message = weechat_hashtable_new ( 32, WEECHAT_HASHTABLE_STRING, @@ -2775,858 +2783,857 @@ irc_config_init () return 0; /* look */ - ptr_section = weechat_config_new_section (irc_config_file, "look", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (irc_config_file); - irc_config_file = NULL; - return 0; - } - - irc_config_look_buffer_open_before_autojoin = weechat_config_new_option ( - irc_config_file, ptr_section, - "buffer_open_before_autojoin", "boolean", - N_("open channel buffer before the JOIN is received from server " - "when it is auto joined (with server option \"autojoin\"); " - "this is useful to open channels with always the same buffer " - "numbers on startup"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_buffer_open_before_join = weechat_config_new_option ( - irc_config_file, ptr_section, - "buffer_open_before_join", "boolean", - N_("open channel buffer before the JOIN is received from server " - "when it is manually joined (with /join command)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_buffer_switch_autojoin = weechat_config_new_option ( - irc_config_file, ptr_section, - "buffer_switch_autojoin", "boolean", - N_("auto switch to channel buffer when it is auto joined (with " - "server option \"autojoin\")"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_buffer_switch_join = weechat_config_new_option ( - irc_config_file, ptr_section, - "buffer_switch_join", "boolean", - N_("auto switch to channel buffer when it is manually joined " - "(with /join command)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_color_nicks_in_names = weechat_config_new_option ( - irc_config_file, ptr_section, - "color_nicks_in_names", "boolean", - N_("use nick color in output of /names (or list of nicks displayed " - "when joining a channel)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_color_nicks_in_nicklist = weechat_config_new_option ( - irc_config_file, ptr_section, - "color_nicks_in_nicklist", "boolean", - N_("use nick color in nicklist"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_look_color_nicks_in_nicklist, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_color_nicks_in_server_messages = weechat_config_new_option ( - irc_config_file, ptr_section, - "color_nicks_in_server_messages", "boolean", - N_("use nick color in messages from server"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_color_pv_nick_like_channel = weechat_config_new_option ( - irc_config_file, ptr_section, - "color_pv_nick_like_channel", "boolean", - N_("use same nick color for channel and private"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_ctcp_time_format = weechat_config_new_option ( - irc_config_file, ptr_section, - "ctcp_time_format", "string", - N_("time format used in answer to message CTCP TIME (see man strftime " - "for date/time specifiers)"), - NULL, 0, 0, "%a, %d %b %Y %T %z", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_account_message = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_account_message", "boolean", - N_("display ACCOUNT messages received when capability account-notify " - "is enabled"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_away = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_away", "integer", - N_("display message when (un)marking as away (off: do not display/send " - "anything, local: display locally, channel: send action to channels)"), - "off|local|channel", 0, 0, "local", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_look_display_away, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_display_ctcp_blocked = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_ctcp_blocked", "boolean", - N_("display CTCP message even if it is blocked"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_ctcp_reply = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_ctcp_reply", "boolean", - N_("display CTCP reply sent by WeeChat"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_ctcp_unknown = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_ctcp_unknown", "boolean", - N_("display CTCP message even if it is unknown CTCP"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_extended_join = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_extended_join", "boolean", - N_("display extra information in the JOIN messages: account name " - "and real name (capability extended-join must be enabled)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_host_join = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_host_join", "boolean", - N_("display host in join messages"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_host_join_local = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_host_join_local", "boolean", - N_("display host in join messages from local client"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_host_quit = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_host_quit", "boolean", - N_("display host in part/quit messages"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_join_message = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_join_message", "string", - N_("comma-separated list of messages to display after joining a " - "channel: 324 = channel modes, 329 = channel creation date, " - "332 = topic, 333 = nick/date for topic, 353 = names on channel, " - "366 = names count"), - NULL, 0, 0, "329,332,333,366", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_look_display_join_message, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_display_old_topic = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_old_topic", "boolean", - N_("display old topic when channel topic is changed"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_pv_away_once = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_pv_away_once", "boolean", - N_("display remote away message only once in private"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_pv_back = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_pv_back", "boolean", - N_("display a message in private when user is back (after quit on " - "server)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_pv_nick_change = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_pv_nick_change", "boolean", - N_("display nick change in private"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_display_pv_warning_address = weechat_config_new_option ( - irc_config_file, ptr_section, - "display_pv_warning_address", "boolean", - N_("display a warning in private buffer if the address of remote nick " - "has changed; this option is disabled by default because servers " - "like bitlbee are causing this warning to be displayed when it is " - "not expected (the address of remote nick changes multiple times " - "on login)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_highlight_channel = weechat_config_new_option ( - irc_config_file, ptr_section, - "highlight_channel", "string", - N_("comma separated list of words to highlight in channel buffers " - "(case insensitive, use \"(?-i)\" at beginning of words to " - "make them case sensitive; special variables $nick, $channel and " - "$server are replaced by their values), these words are added to " - "buffer property \"highlight_words\" only when buffer is created " - "(it does not affect current buffers), an empty string disables " - "default highlight on nick, examples: \"$nick\", \"(?-i)$nick\""), - NULL, 0, 0, "$nick", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_highlight_pv = weechat_config_new_option ( - irc_config_file, ptr_section, - "highlight_pv", "string", - N_("comma separated list of words to highlight in private buffers " - "(case insensitive, use \"(?-i)\" at beginning of words to " - "make them case sensitive; special variables $nick, $channel and " - "$server are replaced by their values), these words are added to " - "buffer property \"highlight_words\" only when buffer is created " - "(it does not affect current buffers), an empty string disables " - "default highlight on nick, examples: \"$nick\", \"(?-i)$nick\""), - NULL, 0, 0, "$nick", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_highlight_server = weechat_config_new_option ( - irc_config_file, ptr_section, - "highlight_server", "string", - N_("comma separated list of words to highlight in server buffers " - "(case insensitive, use \"(?-i)\" at beginning of words to " - "make them case sensitive; special variables $nick, $channel and " - "$server are replaced by their values), these words are added to " - "buffer property \"highlight_words\" only when buffer is created " - "(it does not affect current buffers), an empty string disables " - "default highlight on nick, examples: \"$nick\", \"(?-i)$nick\""), - NULL, 0, 0, "$nick", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_highlight_tags_restrict = weechat_config_new_option ( - irc_config_file, ptr_section, - "highlight_tags_restrict", "string", - N_("restrict highlights to these tags on irc buffers (to have " - "highlight on user messages but not server messages); tags " - "must be separated by a comma and \"+\" can be used to make a " - "logical \"and\" between tags; wildcard \"*\" is allowed in tags; " - "an empty value allows highlight on any tag"), - NULL, 0, 0, "irc_privmsg,irc_notice", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_look_highlight_tags_restrict, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_item_channel_modes_hide_args = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_channel_modes_hide_args", "string", - N_("hide channel modes arguments if at least one of these modes is in " - "channel modes (\"*\" to always hide all arguments, empty value to " - "never hide arguments); example: \"kf\" to hide arguments if \"k\" " - "or \"f\" are in channel modes"), - NULL, 0, 0, "k", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_look_item_channel_modes_hide_args, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_item_display_server = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_display_server", "integer", - N_("name of bar item where IRC server is displayed (for status bar)"), - "buffer_plugin|buffer_name", 0, 0, "buffer_plugin", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_look_item_display_server, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_item_nick_modes = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_nick_modes", "boolean", - N_("display nick modes in bar item \"input_prompt\""), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_bar_item_input_prompt, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_item_nick_prefix = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_nick_prefix", "boolean", - N_("display nick prefix in bar item \"input_prompt\""), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_bar_item_input_prompt, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_join_auto_add_chantype = weechat_config_new_option ( - irc_config_file, ptr_section, - "join_auto_add_chantype", "boolean", - N_("automatically add channel type in front of channel name on " - "command /join if the channel name does not start with a valid " - "channel type for the server; for example: \"/join weechat\" will " - "in fact send: \"/join #weechat\""), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_msgbuffer_fallback = weechat_config_new_option ( - irc_config_file, ptr_section, - "msgbuffer_fallback", "integer", - N_("default target buffer for msgbuffer options when target is " - "private and that private buffer is not found"), - "current|server", 0, 0, "current", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_new_channel_position = weechat_config_new_option ( - irc_config_file, ptr_section, - "new_channel_position", "integer", - N_("force position of new channel in list of buffers " - "(none = default position (should be last buffer), " - "next = current buffer + 1, near_server = after last channel/pv " - "of server)"), - "none|next|near_server", 0, 0, "none", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_new_pv_position = weechat_config_new_option ( - irc_config_file, ptr_section, - "new_pv_position", "integer", - N_("force position of new private in list of buffers " - "(none = default position (should be last buffer), " - "next = current buffer + 1, near_server = after last channel/pv " - "of server)"), - "none|next|near_server", 0, 0, "none", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_nick_completion_smart = weechat_config_new_option ( - irc_config_file, ptr_section, - "nick_completion_smart", "integer", - N_("smart completion for nicks (completes first with last speakers): " - "speakers = all speakers (including highlights), " - "speakers_highlights = only speakers with highlight"), - "off|speakers|speakers_highlights", 0, 0, "speakers", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_nick_mode = weechat_config_new_option ( - irc_config_file, ptr_section, - "nick_mode", "integer", - N_("display nick mode (op, voice, ...) before nick (none = never, " - "prefix = in prefix only (default), action = in action messages " - "only, both = prefix + action messages)"), - "none|prefix|action|both", 0, 0, "prefix", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_nick_mode_empty = weechat_config_new_option ( - irc_config_file, ptr_section, - "nick_mode_empty", "boolean", - N_("display a space if nick mode is enabled but nick has no mode (not " - "op, voice, ...)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_bar_item_input_prompt, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_nicks_hide_password = weechat_config_new_option ( - irc_config_file, ptr_section, - "nicks_hide_password", "string", - N_("comma separated list of nicks for which passwords will be hidden " - "when a message is sent, for example to hide password in message " - "displayed by \"/msg nickserv identify password\", example: " - "\"nickserv,nickbot\""), - NULL, 0, 0, "nickserv", NULL, 0, + irc_config_section_look = weechat_config_new_section ( + irc_config_file, "look", + 0, 0, NULL, NULL, NULL, - &irc_config_change_look_nicks_hide_password, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_notice_as_pv = weechat_config_new_option ( - irc_config_file, ptr_section, - "notice_as_pv", "integer", - N_("display notices as private messages (if auto, use private buffer " - "if found)"), - "auto|never|always", 0, 0, "auto", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_notice_welcome_redirect = weechat_config_new_option ( - irc_config_file, ptr_section, - "notice_welcome_redirect", "boolean", - N_("automatically redirect channel welcome notices to the channel " - "buffer; such notices have the nick as target but a channel name " - "in beginning of notice message, for example the ENTRYMSG notices " - "sent by Atheme IRC Services which look like: " - "\"[#channel] Welcome to this channel...\""), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_notice_welcome_tags = weechat_config_new_option ( - irc_config_file, ptr_section, - "notice_welcome_tags", "string", - N_("comma separated list of tags used in a welcome notices redirected " - "to a channel, for example: \"notify_private\""), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_notify_tags_ison = weechat_config_new_option ( - irc_config_file, ptr_section, - "notify_tags_ison", "string", - N_("comma separated list of tags used in messages displayed by notify " - "when a nick joins or quits server (result of command ison or " - "monitor), for example: \"notify_message\", \"notify_private\" or " - "\"notify_highlight\""), - NULL, 0, 0, "notify_message", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_notify_tags_whois = weechat_config_new_option ( - irc_config_file, ptr_section, - "notify_tags_whois", "string", - N_("comma separated list of tags used in messages displayed by notify " - "when a nick away status changes (result of command whois), " - "for example: \"notify_message\", \"notify_private\" or " - "\"notify_highlight\""), - NULL, 0, 0, "notify_message", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_part_closes_buffer = weechat_config_new_option ( - irc_config_file, ptr_section, - "part_closes_buffer", "boolean", - N_("close buffer when /part is issued on a channel"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_pv_buffer = weechat_config_new_option ( - irc_config_file, ptr_section, - "pv_buffer", "integer", - N_("merge private buffers"), - "independent|merge_by_server|merge_all", 0, 0, "independent", NULL, 0, NULL, NULL, NULL, - &irc_config_change_look_pv_buffer, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_pv_tags = weechat_config_new_option ( - irc_config_file, ptr_section, - "pv_tags", "string", - N_("comma separated list of tags used in private messages, for example: " - "\"notify_message\", \"notify_private\" or \"notify_highlight\""), - NULL, 0, 0, "notify_private", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_raw_messages = weechat_config_new_option ( - irc_config_file, ptr_section, - "raw_messages", "integer", - N_("number of raw messages to save in memory when raw data buffer is " - "closed (messages will be displayed when opening raw data buffer)"), - NULL, 0, 65535, "256", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_typing_status_nicks = weechat_config_new_option ( - irc_config_file, ptr_section, - "typing_status_nicks", "boolean", - N_("display nicks typing on the channel in bar item \"typing\" " - "(option typing.look.enabled_nicks must be enabled and capability " - "\"message-tags\" must be enabled on the server)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_typing_status_self = weechat_config_new_option ( - irc_config_file, ptr_section, - "typing_status_self", "boolean", - N_("send self typing status to channels so that other users see when " - "you are typing a message " - "(option typing.look.enabled_self must be enabled and capability " - "\"message-tags\" must be enabled on the server)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_server_buffer = weechat_config_new_option ( - irc_config_file, ptr_section, - "server_buffer", "integer", - N_("merge server buffers; this option has no effect if a layout " - "is saved and is conflicting with this value (see /help layout)"), - "merge_with_core|merge_without_core|independent", 0, 0, "merge_with_core", - NULL, 0, NULL, NULL, NULL, - &irc_config_change_look_server_buffer, NULL, NULL, - NULL, NULL, NULL); - irc_config_look_smart_filter = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter", "boolean", - N_("filter join/part/quit/nick messages for a nick if not speaking " - "for some minutes on channel (you must create a filter on tag " - "\"irc_smart_filter\", see /help filter)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_smart_filter_account = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter_account", "boolean", - /* TRANSLATORS: please do not translate "account" */ - N_("enable smart filter for \"account\" messages"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_smart_filter_chghost = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter_chghost", "boolean", - /* TRANSLATORS: please do not translate "chghost" */ - N_("enable smart filter for \"chghost\" messages"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_smart_filter_delay = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter_delay", "integer", - N_("delay for filtering join/part/quit messages (in minutes): if the " - "nick did not speak during the last N minutes, the join/part/quit is " - "filtered"), - NULL, 1, 60*24*7, "5", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_smart_filter_join = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter_join", "boolean", - /* TRANSLATORS: please do not translate "join" */ - N_("enable smart filter for \"join\" messages"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_smart_filter_join_unmask = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter_join_unmask", "integer", - N_("delay for unmasking a join message that was filtered with tag " - "\"irc_smart_filter\" (in minutes): if a nick has joined max N " - "minutes ago and then says something on channel (message, notice or " - "update on topic), the join is unmasked, as well as nick changes " - "after this join (0 = disable: never unmask a join)"), - NULL, 0, 60*24*7, "30", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_smart_filter_mode = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter_mode", "string", - /* TRANSLATORS: please do not translate "mode" */ - N_("enable smart filter for \"mode\" messages: \"*\" to filter all " - "modes, \"+\" to filter all modes in server prefixes (for example " - "\"ovh\"), \"xyz\" to filter only modes x/y/z, \"-xyz\" to filter " - "all modes but not x/y/z; examples: \"ovh\": filter modes o/v/h, " - "\"-bkl\": filter all modes but not b/k/l"), - NULL, 0, 0, "+", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_smart_filter_nick = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter_nick", "boolean", - /* TRANSLATORS: please do not translate "nick" */ - N_("enable smart filter for \"nick\" messages (nick changes)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_smart_filter_quit = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter_quit", "boolean", - /* TRANSLATORS: please do not translate "part" and "quit" */ - N_("enable smart filter for \"part\" and \"quit\" messages"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_smart_filter_setname = weechat_config_new_option ( - irc_config_file, ptr_section, - "smart_filter_setname", "boolean", - /* TRANSLATORS: please do not translate "setname" */ - N_("enable smart filter for \"setname\" messages"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_temporary_servers = weechat_config_new_option ( - irc_config_file, ptr_section, - "temporary_servers", "boolean", - N_("enable automatic addition of temporary servers with command " - "/connect"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_look_topic_strip_colors = weechat_config_new_option ( - irc_config_file, ptr_section, - "topic_strip_colors", "boolean", - N_("strip colors in topic (used only when displaying buffer title)"), - NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, - &irc_config_change_look_topic_strip_colors, NULL, NULL, NULL, NULL, NULL); - - /* color */ - ptr_section = weechat_config_new_section (irc_config_file, "color", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (irc_config_section_look) { - weechat_config_free (irc_config_file); - irc_config_file = NULL; - return 0; + irc_config_look_buffer_open_before_autojoin = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "buffer_open_before_autojoin", "boolean", + N_("open channel buffer before the JOIN is received from server " + "when it is auto joined (with server option \"autojoin\"); " + "this is useful to open channels with always the same buffer " + "numbers on startup"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_buffer_open_before_join = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "buffer_open_before_join", "boolean", + N_("open channel buffer before the JOIN is received from server " + "when it is manually joined (with /join command)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_buffer_switch_autojoin = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "buffer_switch_autojoin", "boolean", + N_("auto switch to channel buffer when it is auto joined (with " + "server option \"autojoin\")"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_buffer_switch_join = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "buffer_switch_join", "boolean", + N_("auto switch to channel buffer when it is manually joined " + "(with /join command)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_color_nicks_in_names = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "color_nicks_in_names", "boolean", + N_("use nick color in output of /names (or list of nicks displayed " + "when joining a channel)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_color_nicks_in_nicklist = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "color_nicks_in_nicklist", "boolean", + N_("use nick color in nicklist"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_color_nicks_in_nicklist, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_color_nicks_in_server_messages = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "color_nicks_in_server_messages", "boolean", + N_("use nick color in messages from server"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_color_pv_nick_like_channel = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "color_pv_nick_like_channel", "boolean", + N_("use same nick color for channel and private"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_ctcp_time_format = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "ctcp_time_format", "string", + N_("time format used in answer to message CTCP TIME (see man " + "strftime for date/time specifiers)"), + NULL, 0, 0, "%a, %d %b %Y %T %z", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_account_message = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_account_message", "boolean", + N_("display ACCOUNT messages received when capability account-notify " + "is enabled"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_away = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_away", "integer", + N_("display message when (un)marking as away (off: do not " + "display/send anything, local: display locally, channel: send " + "action to channels)"), + "off|local|channel", 0, 0, "local", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_display_away, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_display_ctcp_blocked = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_ctcp_blocked", "boolean", + N_("display CTCP message even if it is blocked"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_ctcp_reply = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_ctcp_reply", "boolean", + N_("display CTCP reply sent by WeeChat"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_ctcp_unknown = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_ctcp_unknown", "boolean", + N_("display CTCP message even if it is unknown CTCP"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_extended_join = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_extended_join", "boolean", + N_("display extra information in the JOIN messages: account name " + "and real name (capability extended-join must be enabled)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_host_join = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_host_join", "boolean", + N_("display host in join messages"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_host_join_local = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_host_join_local", "boolean", + N_("display host in join messages from local client"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_host_quit = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_host_quit", "boolean", + N_("display host in part/quit messages"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_join_message = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_join_message", "string", + N_("comma-separated list of messages to display after joining a " + "channel: 324 = channel modes, 329 = channel creation date, " + "332 = topic, 333 = nick/date for topic, 353 = names on channel, " + "366 = names count"), + NULL, 0, 0, "329,332,333,366", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_display_join_message, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_display_old_topic = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_old_topic", "boolean", + N_("display old topic when channel topic is changed"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_pv_away_once = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_pv_away_once", "boolean", + N_("display remote away message only once in private"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_pv_back = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_pv_back", "boolean", + N_("display a message in private when user is back (after quit on " + "server)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_pv_nick_change = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_pv_nick_change", "boolean", + N_("display nick change in private"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_display_pv_warning_address = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "display_pv_warning_address", "boolean", + N_("display a warning in private buffer if the address of remote " + "nick has changed; this option is disabled by default because " + "servers like bitlbee are causing this warning to be displayed " + "when it is not expected (the address of remote nick changes " + "multiple times on login)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_highlight_channel = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "highlight_channel", "string", + N_("comma separated list of words to highlight in channel buffers " + "(case insensitive, use \"(?-i)\" at beginning of words to " + "make them case sensitive; special variables $nick, $channel and " + "$server are replaced by their values), these words are added to " + "buffer property \"highlight_words\" only when buffer is created " + "(it does not affect current buffers), an empty string disables " + "default highlight on nick, examples: \"$nick\", \"(?-i)$nick\""), + NULL, 0, 0, "$nick", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_highlight_pv = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "highlight_pv", "string", + N_("comma separated list of words to highlight in private buffers " + "(case insensitive, use \"(?-i)\" at beginning of words to " + "make them case sensitive; special variables $nick, $channel and " + "$server are replaced by their values), these words are added to " + "buffer property \"highlight_words\" only when buffer is created " + "(it does not affect current buffers), an empty string disables " + "default highlight on nick, examples: \"$nick\", \"(?-i)$nick\""), + NULL, 0, 0, "$nick", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_highlight_server = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "highlight_server", "string", + N_("comma separated list of words to highlight in server buffers " + "(case insensitive, use \"(?-i)\" at beginning of words to " + "make them case sensitive; special variables $nick, $channel and " + "$server are replaced by their values), these words are added to " + "buffer property \"highlight_words\" only when buffer is created " + "(it does not affect current buffers), an empty string disables " + "default highlight on nick, examples: \"$nick\", \"(?-i)$nick\""), + NULL, 0, 0, "$nick", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_highlight_tags_restrict = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "highlight_tags_restrict", "string", + N_("restrict highlights to these tags on irc buffers (to have " + "highlight on user messages but not server messages); tags " + "must be separated by a comma and \"+\" can be used to make a " + "logical \"and\" between tags; wildcard \"*\" is allowed in tags; " + "an empty value allows highlight on any tag"), + NULL, 0, 0, "irc_privmsg,irc_notice", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_highlight_tags_restrict, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_item_channel_modes_hide_args = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "item_channel_modes_hide_args", "string", + N_("hide channel modes arguments if at least one of these modes is " + "in channel modes (\"*\" to always hide all arguments, empty " + "value to never hide arguments); example: \"kf\" to hide " + "arguments if \"k\" or \"f\" are in channel modes"), + NULL, 0, 0, "k", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_item_channel_modes_hide_args, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_item_display_server = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "item_display_server", "integer", + N_("name of bar item where IRC server is displayed (for status bar)"), + "buffer_plugin|buffer_name", 0, 0, "buffer_plugin", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_item_display_server, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_item_nick_modes = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "item_nick_modes", "boolean", + N_("display nick modes in bar item \"input_prompt\""), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_bar_item_input_prompt, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_item_nick_prefix = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "item_nick_prefix", "boolean", + N_("display nick prefix in bar item \"input_prompt\""), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_bar_item_input_prompt, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_join_auto_add_chantype = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "join_auto_add_chantype", "boolean", + N_("automatically add channel type in front of channel name on " + "command /join if the channel name does not start with a valid " + "channel type for the server; for example: \"/join weechat\" " + "will in fact send: \"/join #weechat\""), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_msgbuffer_fallback = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "msgbuffer_fallback", "integer", + N_("default target buffer for msgbuffer options when target is " + "private and that private buffer is not found"), + "current|server", 0, 0, "current", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_new_channel_position = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "new_channel_position", "integer", + N_("force position of new channel in list of buffers " + "(none = default position (should be last buffer), " + "next = current buffer + 1, near_server = after last channel/pv " + "of server)"), + "none|next|near_server", 0, 0, "none", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_new_pv_position = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "new_pv_position", "integer", + N_("force position of new private in list of buffers " + "(none = default position (should be last buffer), " + "next = current buffer + 1, near_server = after last channel/pv " + "of server)"), + "none|next|near_server", 0, 0, "none", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_nick_completion_smart = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "nick_completion_smart", "integer", + N_("smart completion for nicks (completes first with last speakers): " + "speakers = all speakers (including highlights), " + "speakers_highlights = only speakers with highlight"), + "off|speakers|speakers_highlights", 0, 0, "speakers", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_nick_mode = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "nick_mode", "integer", + N_("display nick mode (op, voice, ...) before nick (none = never, " + "prefix = in prefix only (default), action = in action messages " + "only, both = prefix + action messages)"), + "none|prefix|action|both", 0, 0, "prefix", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_nick_mode_empty = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "nick_mode_empty", "boolean", + N_("display a space if nick mode is enabled but nick has no mode " + "(not op, voice, ...)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_bar_item_input_prompt, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_nicks_hide_password = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "nicks_hide_password", "string", + N_("comma separated list of nicks for which passwords will be " + "hidden when a message is sent, for example to hide password " + "in message displayed by \"/msg nickserv identify password\", " + "example: \"nickserv,nickbot\""), + NULL, 0, 0, "nickserv", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_nicks_hide_password, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_notice_as_pv = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "notice_as_pv", "integer", + N_("display notices as private messages (if auto, use private " + "buffer if found)"), + "auto|never|always", 0, 0, "auto", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_notice_welcome_redirect = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "notice_welcome_redirect", "boolean", + N_("automatically redirect channel welcome notices to the channel " + "buffer; such notices have the nick as target but a channel name " + "in beginning of notice message, for example the ENTRYMSG " + "notices sent by Atheme IRC Services which look like: " + "\"[#channel] Welcome to this channel...\""), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_notice_welcome_tags = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "notice_welcome_tags", "string", + N_("comma separated list of tags used in a welcome notices " + "redirected to a channel, for example: \"notify_private\""), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_notify_tags_ison = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "notify_tags_ison", "string", + N_("comma separated list of tags used in messages displayed by " + "notify when a nick joins or quits server (result of command " + "ison or monitor), for example: \"notify_message\", " + "\"notify_private\" or \"notify_highlight\""), + NULL, 0, 0, "notify_message", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_notify_tags_whois = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "notify_tags_whois", "string", + N_("comma separated list of tags used in messages displayed by " + "notify when a nick away status changes (result of command " + "whois), for example: \"notify_message\", \"notify_private\" or " + "\"notify_highlight\""), + NULL, 0, 0, "notify_message", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_part_closes_buffer = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "part_closes_buffer", "boolean", + N_("close buffer when /part is issued on a channel"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_pv_buffer = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "pv_buffer", "integer", + N_("merge private buffers"), + "independent|merge_by_server|merge_all", 0, 0, "independent", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_pv_buffer, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_pv_tags = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "pv_tags", "string", + N_("comma separated list of tags used in private messages, for " + "example: \"notify_message\", \"notify_private\" or " + "\"notify_highlight\""), + NULL, 0, 0, "notify_private", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_raw_messages = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "raw_messages", "integer", + N_("number of raw messages to save in memory when raw data buffer " + "is closed (messages will be displayed when opening raw data " + "buffer)"), + NULL, 0, 65535, "256", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_typing_status_nicks = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "typing_status_nicks", "boolean", + N_("display nicks typing on the channel in bar item \"typing\" " + "(option typing.look.enabled_nicks must be enabled and " + "capability \"message-tags\" must be enabled on the server)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_typing_status_self = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "typing_status_self", "boolean", + N_("send self typing status to channels so that other users see " + "when you are typing a message " + "(option typing.look.enabled_self must be enabled and capability " + "\"message-tags\" must be enabled on the server)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_server_buffer = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "server_buffer", "integer", + N_("merge server buffers; this option has no effect if a layout " + "is saved and is conflicting with this value (see /help layout)"), + "merge_with_core|merge_without_core|independent", 0, 0, "merge_with_core", + NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_server_buffer, NULL, NULL, + NULL, NULL, NULL); + irc_config_look_smart_filter = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter", "boolean", + N_("filter join/part/quit/nick messages for a nick if not speaking " + "for some minutes on channel (you must create a filter on tag " + "\"irc_smart_filter\", see /help filter)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_account = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter_account", "boolean", + /* TRANSLATORS: please do not translate "account" */ + N_("enable smart filter for \"account\" messages"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_chghost = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter_chghost", "boolean", + /* TRANSLATORS: please do not translate "chghost" */ + N_("enable smart filter for \"chghost\" messages"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_delay = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter_delay", "integer", + N_("delay for filtering join/part/quit messages (in minutes): if " + "the nick did not speak during the last N minutes, the " + "join/part/quit is filtered"), + NULL, 1, 60*24*7, "5", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_join = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter_join", "boolean", + /* TRANSLATORS: please do not translate "join" */ + N_("enable smart filter for \"join\" messages"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_join_unmask = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter_join_unmask", "integer", + N_("delay for unmasking a join message that was filtered with tag " + "\"irc_smart_filter\" (in minutes): if a nick has joined max N " + "minutes ago and then says something on channel (message, " + "notice or update on topic), the join is unmasked, as well as " + "nick changes after this join (0 = disable: never unmask a " + "join)"), + NULL, 0, 60*24*7, "30", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_mode = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter_mode", "string", + /* TRANSLATORS: please do not translate "mode" */ + N_("enable smart filter for \"mode\" messages: \"*\" to filter all " + "modes, \"+\" to filter all modes in server prefixes (for example " + "\"ovh\"), \"xyz\" to filter only modes x/y/z, \"-xyz\" to filter " + "all modes but not x/y/z; examples: \"ovh\": filter modes o/v/h, " + "\"-bkl\": filter all modes but not b/k/l"), + NULL, 0, 0, "+", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_nick = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter_nick", "boolean", + /* TRANSLATORS: please do not translate "nick" */ + N_("enable smart filter for \"nick\" messages (nick changes)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_quit = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter_quit", "boolean", + /* TRANSLATORS: please do not translate "part" and "quit" */ + N_("enable smart filter for \"part\" and \"quit\" messages"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_smart_filter_setname = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "smart_filter_setname", "boolean", + /* TRANSLATORS: please do not translate "setname" */ + N_("enable smart filter for \"setname\" messages"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_temporary_servers = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "temporary_servers", "boolean", + N_("enable automatic addition of temporary servers with command " + "/connect"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_look_topic_strip_colors = weechat_config_new_option ( + irc_config_file, irc_config_section_look, + "topic_strip_colors", "boolean", + N_("strip colors in topic (used only when displaying buffer title)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_look_topic_strip_colors, NULL, NULL, + NULL, NULL, NULL); } - irc_config_color_input_nick = weechat_config_new_option ( - irc_config_file, ptr_section, - "input_nick", "color", - N_("color for nick in input bar"), - NULL, -1, 0, "lightcyan", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_bar_item_input_prompt, NULL, NULL, - NULL, NULL, NULL); - irc_config_color_item_channel_modes = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_channel_modes", "color", - N_("color for channel modes, near channel name"), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_color_item_channel_modes, NULL, NULL, - NULL, NULL, NULL); - irc_config_color_item_lag_counting = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_lag_counting", "color", - N_("color for lag indicator, when counting (pong not received from " - "server, lag is increasing)"), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_color_item_lag, NULL, NULL, - NULL, NULL, NULL); - irc_config_color_item_lag_finished = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_lag_finished", "color", - N_("color for lag indicator, when pong has been received from server"), - NULL, -1, 0, "yellow", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_color_item_lag, NULL, NULL, - NULL, NULL, NULL); - irc_config_color_item_nick_modes = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_nick_modes", "color", - N_("color for nick modes in bar item \"input_prompt\""), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_color_item_nick_modes, NULL, NULL, - NULL, NULL, NULL); - irc_config_color_item_tls_version_deprecated = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_tls_version_deprecated", "color", - N_("color for deprecated TLS versions in bar item \"tls_version\""), - NULL, -1, 0, "yellow", NULL, 0, + /* color */ + irc_config_section_color = weechat_config_new_section ( + irc_config_file, "color", + 0, 0, NULL, NULL, NULL, - &irc_config_change_color_item_tls_version, NULL, NULL, - NULL, NULL, NULL); - irc_config_color_item_tls_version_insecure = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_tls_version_insecure", "color", - N_("color for insecure TLS versions in bar item \"tls_version\""), - NULL, -1, 0, "red", NULL, 0, NULL, NULL, NULL, - &irc_config_change_color_item_tls_version, NULL, NULL, - NULL, NULL, NULL); - irc_config_color_item_tls_version_ok = weechat_config_new_option ( - irc_config_file, ptr_section, - "item_tls_version_ok", "color", - N_("color for higher supported TLS version in bar item \"tls_version\""), - NULL, -1, 0, "green", NULL, 0, NULL, NULL, NULL, - &irc_config_change_color_item_tls_version, NULL, NULL, - NULL, NULL, NULL); - irc_config_color_message_account = weechat_config_new_option ( - irc_config_file, ptr_section, - "message_account", "color", - N_("color for text in account messages"), - NULL, -1, 0, "cyan", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_message_chghost = weechat_config_new_option ( - irc_config_file, ptr_section, - "message_chghost", "color", - /* TRANSLATORS: please do not translate "chghost" */ - N_("color for text in \"chghost\" messages"), - NULL, -1, 0, "brown", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_message_join = weechat_config_new_option ( - irc_config_file, ptr_section, - "message_join", "color", - N_("color for text in join messages"), - NULL, -1, 0, "green", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_message_kick = weechat_config_new_option ( - irc_config_file, ptr_section, - "message_kick", "color", - N_("color for text in kick/kill messages"), - NULL, -1, 0, "red", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_message_quit = weechat_config_new_option ( - irc_config_file, ptr_section, - "message_quit", "color", - N_("color for text in part/quit messages"), - NULL, -1, 0, "red", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_message_setname = weechat_config_new_option ( - irc_config_file, ptr_section, - "message_setname", "color", - /* TRANSLATORS: please do not translate "setname" */ - N_("color for text in \"setname\" messages"), - NULL, -1, 0, "brown", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_mirc_remap = weechat_config_new_option ( - irc_config_file, ptr_section, - "mirc_remap", "string", - /* TRANSLATORS: please do not translate the list of WeeChat color names at the end of string */ - N_("remap mirc colors in messages using a hashtable: keys are \"fg,bg\" " - "as integers between -1 (not specified) and 15, values are WeeChat " - "color names or numbers (format is: \"1,-1:color1;2,7:color2\"), " - "example: \"1,-1:darkgray;1,2:white,blue\" to remap black to " - "\"darkgray\" and black on blue to \"white,blue\"; default " - "WeeChat colors for IRC codes: 0=white, 1=black, 2=blue, 3=green, " - "4=lightred, 5=red, 6=magenta, 7=brown, 8=yellow, 9=lightgreen, " - "10=cyan, 11=lightcyan, 12=lightblue, 13=lightmagenta, " - "14=darkgray, 15=gray"), - NULL, 0, 0, "1,-1:darkgray", NULL, 0, NULL, NULL, NULL, - &irc_config_change_color_mirc_remap, NULL, NULL, NULL, NULL, NULL); - irc_config_color_nick_prefixes = weechat_config_new_option ( - irc_config_file, ptr_section, - "nick_prefixes", "string", - N_("color for nick prefixes using mode char (o=op, h=halfop, v=voice, " - "..), format is: \"o:color1;h:color2;v:color3\" (if a mode is not " - "found, WeeChat will try with next modes received from server " - "(\"PREFIX\"); a special mode \"*\" can be used as default color " - "if no mode has been found in list)"), - NULL, 0, 0, "y:lightred;q:lightred;a:lightcyan;o:lightgreen;" - "h:lightmagenta;v:yellow;*:lightblue", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_color_nick_prefixes, NULL, NULL, - NULL, NULL, NULL); - irc_config_color_notice = weechat_config_new_option ( - irc_config_file, ptr_section, - "notice", "color", - N_("color for text \"Notice\" in notices"), - NULL, -1, 0, "green", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_reason_kick = weechat_config_new_option ( - irc_config_file, ptr_section, - "reason_kick", "color", - N_("color for reason in kick/kill messages"), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_reason_quit = weechat_config_new_option ( - irc_config_file, ptr_section, - "reason_quit", "color", - N_("color for reason in part/quit messages"), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_topic_current = weechat_config_new_option ( - irc_config_file, ptr_section, - "topic_current", "color", - N_("color for current channel topic (when joining a channel or " - "using /topic)"), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_topic_new = weechat_config_new_option ( - irc_config_file, ptr_section, - "topic_new", "color", - N_("color for new channel topic (when topic is changed)"), - NULL, -1, 0, "white", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_color_topic_old = weechat_config_new_option ( - irc_config_file, ptr_section, - "topic_old", "color", - N_("color for old channel topic (when topic is changed)"), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - /* network */ - ptr_section = weechat_config_new_section (irc_config_file, "network", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (irc_config_section_color) { - weechat_config_free (irc_config_file); - irc_config_file = NULL; - return 0; + irc_config_color_input_nick = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "input_nick", "color", + N_("color for nick in input bar"), + NULL, -1, 0, "lightcyan", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_bar_item_input_prompt, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_item_channel_modes = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "item_channel_modes", "color", + N_("color for channel modes, near channel name"), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_color_item_channel_modes, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_item_lag_counting = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "item_lag_counting", "color", + N_("color for lag indicator, when counting (pong not received from " + "server, lag is increasing)"), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_color_item_lag, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_item_lag_finished = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "item_lag_finished", "color", + N_("color for lag indicator, when pong has been received from server"), + NULL, -1, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_color_item_lag, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_item_nick_modes = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "item_nick_modes", "color", + N_("color for nick modes in bar item \"input_prompt\""), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_color_item_nick_modes, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_item_tls_version_deprecated = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "item_tls_version_deprecated", "color", + N_("color for deprecated TLS versions in bar item \"tls_version\""), + NULL, -1, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_color_item_tls_version, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_item_tls_version_insecure = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "item_tls_version_insecure", "color", + N_("color for insecure TLS versions in bar item \"tls_version\""), + NULL, -1, 0, "red", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_color_item_tls_version, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_item_tls_version_ok = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "item_tls_version_ok", "color", + N_("color for higher supported TLS version in bar item " + "\"tls_version\""), + NULL, -1, 0, "green", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_color_item_tls_version, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_message_account = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "message_account", "color", + N_("color for text in account messages"), + NULL, -1, 0, "cyan", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_message_chghost = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "message_chghost", "color", + /* TRANSLATORS: please do not translate "chghost" */ + N_("color for text in \"chghost\" messages"), + NULL, -1, 0, "brown", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_message_join = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "message_join", "color", + N_("color for text in join messages"), + NULL, -1, 0, "green", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_message_kick = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "message_kick", "color", + N_("color for text in kick/kill messages"), + NULL, -1, 0, "red", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_message_quit = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "message_quit", "color", + N_("color for text in part/quit messages"), + NULL, -1, 0, "red", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_message_setname = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "message_setname", "color", + /* TRANSLATORS: please do not translate "setname" */ + N_("color for text in \"setname\" messages"), + NULL, -1, 0, "brown", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_mirc_remap = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "mirc_remap", "string", + /* TRANSLATORS: please do not translate the list of WeeChat color names at the end of string */ + N_("remap mirc colors in messages using a hashtable: keys are " + "\"fg,bg\" as integers between -1 (not specified) and 15, " + "values are WeeChat color names or numbers (format is: " + "\"1,-1:color1;2,7:color2\"), example: " + "\"1,-1:darkgray;1,2:white,blue\" to remap black to " + "\"darkgray\" and black on blue to \"white,blue\"; default " + "WeeChat colors for IRC codes: 0=white, 1=black, 2=blue, " + "3=green, 4=lightred, 5=red, 6=magenta, 7=brown, 8=yellow, " + "9=lightgreen, 10=cyan, 11=lightcyan, 12=lightblue, " + "13=lightmagenta, 14=darkgray, 15=gray"), + NULL, 0, 0, "1,-1:darkgray", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_color_mirc_remap, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_nick_prefixes = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "nick_prefixes", "string", + N_("color for nick prefixes using mode char (o=op, h=halfop, " + "v=voice, ..), format is: \"o:color1;h:color2;v:color3\" (if a " + "mode is not found, WeeChat will try with next modes received " + "from server (\"PREFIX\"); a special mode \"*\" can be used as " + "default color if no mode has been found in list)"), + NULL, 0, 0, "y:lightred;q:lightred;a:lightcyan;o:lightgreen;" + "h:lightmagenta;v:yellow;*:lightblue", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_color_nick_prefixes, NULL, NULL, + NULL, NULL, NULL); + irc_config_color_notice = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "notice", "color", + N_("color for text \"Notice\" in notices"), + NULL, -1, 0, "green", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_reason_kick = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "reason_kick", "color", + N_("color for reason in kick/kill messages"), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_reason_quit = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "reason_quit", "color", + N_("color for reason in part/quit messages"), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_topic_current = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "topic_current", "color", + N_("color for current channel topic (when joining a channel or " + "using /topic)"), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_topic_new = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "topic_new", "color", + N_("color for new channel topic (when topic is changed)"), + NULL, -1, 0, "white", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_color_topic_old = weechat_config_new_option ( + irc_config_file, irc_config_section_color, + "topic_old", "color", + N_("color for old channel topic (when topic is changed)"), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - irc_config_network_autoreconnect_delay_growing = weechat_config_new_option ( - irc_config_file, ptr_section, - "autoreconnect_delay_growing", "integer", - N_("growing factor for autoreconnect delay to server (1 = always same " - "delay, 2 = delay*2 for each retry, etc.)"), - NULL, 1, 100, "2", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_autoreconnect_delay_max = weechat_config_new_option ( - irc_config_file, ptr_section, - "autoreconnect_delay_max", "integer", - N_("maximum autoreconnect delay to server (in seconds, 0 = no maximum)"), - NULL, 0, 3600 * 24 * 7, "600", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_ban_mask_default = weechat_config_new_option ( - irc_config_file, ptr_section, - "ban_mask_default", "string", - N_("default ban mask for commands /ban, /unban and /kickban; variables " - "$nick, $user, $ident and $host are replaced by their values " - "(extracted from \"nick!user@host\"); $ident is the same as $user if " - "$user does not start with \"~\", otherwise it is set to \"*\"; this " - "default mask is used only if WeeChat knows the host for the nick"), - NULL, 0, 0, "*!$ident@$host", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_colors_receive = weechat_config_new_option ( - irc_config_file, ptr_section, - "colors_receive", "boolean", - N_("when off, colors codes are ignored in incoming messages"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_colors_send = weechat_config_new_option ( - irc_config_file, ptr_section, - "colors_send", "boolean", - N_("allow user to send colors with special codes (ctrl-c + a code and " - "optional color: b=bold, cxx=color, cxx,yy=color+background, " - "i=italic, o=disable color/attributes, r=reverse, u=underline)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_lag_check = weechat_config_new_option ( - irc_config_file, ptr_section, - "lag_check", "integer", - N_("interval between two checks for lag (in seconds, 0 = never " - "check)"), - NULL, 0, 3600 * 24 * 7, "60", NULL, 0, - NULL, NULL, NULL, - &irc_config_change_network_lag_check, NULL, NULL, - NULL, NULL, NULL); - irc_config_network_lag_max = weechat_config_new_option ( - irc_config_file, ptr_section, - "lag_max", "integer", - N_("maximum lag (in seconds): if this lag is reached, WeeChat will " - "consider that the answer from server (pong) will never be received " - "and will give up counting the lag (0 = never give up)"), - NULL, 0, 3600 * 24 * 7, "1800", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_lag_min_show = weechat_config_new_option ( - irc_config_file, ptr_section, - "lag_min_show", "integer", - N_("minimum lag to show (in milliseconds)"), - NULL, 0, 1000 * 3600 * 24, "500", NULL, 0, + /* network */ + irc_config_section_network = weechat_config_new_section ( + irc_config_file, "network", + 0, 0, NULL, NULL, NULL, - &irc_config_change_network_lag_min_show, NULL, NULL, - NULL, NULL, NULL); - irc_config_network_lag_reconnect = weechat_config_new_option ( - irc_config_file, ptr_section, - "lag_reconnect", "integer", - N_("reconnect to server if lag is greater than or equal to this value " - "(in seconds, 0 = never reconnect); this value must be less than or " - "equal to irc.network.lag_max"), - NULL, 0, 3600 * 24 * 7, "300", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_lag_refresh_interval = weechat_config_new_option ( - irc_config_file, ptr_section, - "lag_refresh_interval", "integer", - N_("interval between two refreshes of lag item, when lag is " - "increasing (in seconds)"), - NULL, 1, 3600, "1", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_notify_check_ison = weechat_config_new_option ( - irc_config_file, ptr_section, - "notify_check_ison", "integer", - N_("interval between two checks for notify with IRC command \"ison\" " - "(in minutes)"), - NULL, 1, 60 * 24 * 7, "1", NULL, 0, NULL, NULL, NULL, - &irc_config_change_network_notify_check_ison, NULL, NULL, - NULL, NULL, NULL); - irc_config_network_notify_check_whois = weechat_config_new_option ( - irc_config_file, ptr_section, - "notify_check_whois", "integer", - N_("interval between two checks for notify with IRC command \"whois\" " - "(in minutes)"), - NULL, 1, 60 * 24 * 7, "5", NULL, 0, NULL, NULL, NULL, - &irc_config_change_network_notify_check_whois, NULL, NULL, - NULL, NULL, NULL); - irc_config_network_sasl_fail_unavailable = weechat_config_new_option ( - irc_config_file, ptr_section, - "sasl_fail_unavailable", "boolean", - N_("cause SASL authentication failure when SASL is requested but " - "unavailable on the server; when this option is enabled, it has " - "effect only if option \"sasl_fail\" is set to \"reconnect\" or " - "\"disconnect\" in the server"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - irc_config_network_send_unknown_commands = weechat_config_new_option ( - irc_config_file, ptr_section, - "send_unknown_commands", "boolean", - N_("send unknown commands to server"), - NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, - &irc_config_change_network_send_unknown_commands, NULL, NULL, NULL, NULL, NULL); - irc_config_network_whois_double_nick = weechat_config_new_option ( - irc_config_file, ptr_section, - "whois_double_nick", "boolean", - N_("double the nick in /whois command (if only one nick is given), to " - "get idle time in answer; for example: \"/whois nick\" will send " - "\"whois nick nick\""), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + if (irc_config_section_network) + { + irc_config_network_autoreconnect_delay_growing = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "autoreconnect_delay_growing", "integer", + N_("growing factor for autoreconnect delay to server (1 = always " + "same delay, 2 = delay*2 for each retry, etc.)"), + NULL, 1, 100, "2", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_autoreconnect_delay_max = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "autoreconnect_delay_max", "integer", + N_("maximum autoreconnect delay to server (in seconds, 0 = no " + "maximum)"), + NULL, 0, 3600 * 24 * 7, "600", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_ban_mask_default = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "ban_mask_default", "string", + N_("default ban mask for commands /ban, /unban and /kickban; " + "variables $nick, $user, $ident and $host are replaced by their " + "values (extracted from \"nick!user@host\"); $ident is the same " + "as $user if $user does not start with \"~\", otherwise it is " + "set to \"*\"; this default mask is used only if WeeChat knows " + "the host for the nick"), + NULL, 0, 0, "*!$ident@$host", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_colors_receive = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "colors_receive", "boolean", + N_("when off, colors codes are ignored in incoming messages"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_colors_send = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "colors_send", "boolean", + N_("allow user to send colors with special codes (ctrl-c + a code " + "and optional color: b=bold, cxx=color, cxx,yy=color+background, " + "i=italic, o=disable color/attributes, r=reverse, u=underline)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_lag_check = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "lag_check", "integer", + N_("interval between two checks for lag (in seconds, 0 = never " + "check)"), + NULL, 0, 3600 * 24 * 7, "60", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_network_lag_check, NULL, NULL, + NULL, NULL, NULL); + irc_config_network_lag_max = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "lag_max", "integer", + N_("maximum lag (in seconds): if this lag is reached, WeeChat will " + "consider that the answer from server (pong) will never be " + "received and will give up counting the lag (0 = never give up)"), + NULL, 0, 3600 * 24 * 7, "1800", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_lag_min_show = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "lag_min_show", "integer", + N_("minimum lag to show (in milliseconds)"), + NULL, 0, 1000 * 3600 * 24, "500", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_network_lag_min_show, NULL, NULL, + NULL, NULL, NULL); + irc_config_network_lag_reconnect = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "lag_reconnect", "integer", + N_("reconnect to server if lag is greater than or equal to this " + "value (in seconds, 0 = never reconnect); this value must be " + "less than or equal to irc.network.lag_max"), + NULL, 0, 3600 * 24 * 7, "300", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_lag_refresh_interval = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "lag_refresh_interval", "integer", + N_("interval between two refreshes of lag item, when lag is " + "increasing (in seconds)"), + NULL, 1, 3600, "1", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_notify_check_ison = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "notify_check_ison", "integer", + N_("interval between two checks for notify with IRC command " + "\"ison\" (in minutes)"), + NULL, 1, 60 * 24 * 7, "1", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_network_notify_check_ison, NULL, NULL, + NULL, NULL, NULL); + irc_config_network_notify_check_whois = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "notify_check_whois", "integer", + N_("interval between two checks for notify with IRC command " + "\"whois\" (in minutes)"), + NULL, 1, 60 * 24 * 7, "5", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_network_notify_check_whois, NULL, NULL, + NULL, NULL, NULL); + irc_config_network_sasl_fail_unavailable = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "sasl_fail_unavailable", "boolean", + N_("cause SASL authentication failure when SASL is requested but " + "unavailable on the server; when this option is enabled, it has " + "effect only if option \"sasl_fail\" is set to \"reconnect\" or " + "\"disconnect\" in the server"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + irc_config_network_send_unknown_commands = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "send_unknown_commands", "boolean", + N_("send unknown commands to server"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &irc_config_change_network_send_unknown_commands, NULL, NULL, + NULL, NULL, NULL); + irc_config_network_whois_double_nick = weechat_config_new_option ( + irc_config_file, irc_config_section_network, + "whois_double_nick", "boolean", + N_("double the nick in /whois command (if only one nick is given), " + "to get idle time in answer; for example: \"/whois nick\" will " + "send \"whois nick nick\""), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + } /* msgbuffer */ - ptr_section = weechat_config_new_section ( + irc_config_section_msgbuffer = weechat_config_new_section ( irc_config_file, "msgbuffer", 1, 1, NULL, NULL, NULL, @@ -3634,16 +3641,9 @@ irc_config_init () NULL, NULL, NULL, &irc_config_msgbuffer_create_option, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (irc_config_file); - irc_config_file = NULL; - return 0; - } - irc_config_section_msgbuffer = ptr_section; /* CTCP */ - ptr_section = weechat_config_new_section ( + irc_config_section_ctcp = weechat_config_new_section ( irc_config_file, "ctcp", 1, 1, NULL, NULL, NULL, @@ -3651,16 +3651,9 @@ irc_config_init () NULL, NULL, NULL, &irc_config_ctcp_create_option, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (irc_config_file); - irc_config_file = NULL; - return 0; - } - irc_config_section_ctcp = ptr_section; /* ignore */ - ptr_section = weechat_config_new_section ( + irc_config_section_ignore = weechat_config_new_section ( irc_config_file, "ignore", 0, 0, &irc_config_ignore_read_cb, NULL, NULL, @@ -3668,15 +3661,9 @@ irc_config_init () &irc_config_ignore_write_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (irc_config_file); - irc_config_file = NULL; - return 0; - } /* server_default */ - ptr_section = weechat_config_new_section ( + irc_config_section_server_default = weechat_config_new_section ( irc_config_file, "server_default", 0, 0, NULL, NULL, NULL, @@ -3684,18 +3671,11 @@ irc_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (irc_config_file); - irc_config_file = NULL; - return 0; - } - irc_config_section_server_default = ptr_section; - irc_config_server_create_default_options (ptr_section); + irc_config_server_create_default_options (irc_config_section_server_default); /* server */ - ptr_section = weechat_config_new_section ( + irc_config_section_server = weechat_config_new_section ( irc_config_file, "server", 0, 0, &irc_config_server_read_cb, NULL, NULL, @@ -3703,13 +3683,6 @@ irc_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (irc_config_file); - irc_config_file = NULL; - return 0; - } - irc_config_section_server = ptr_section; irc_config_hook_config_nick_color_options = weechat_hook_config ( "weechat.look.nick_color_*", diff --git a/src/plugins/logger/logger-config.c b/src/plugins/logger/logger-config.c index d254cabe3..646d3a0ba 100644 --- a/src/plugins/logger/logger-config.c +++ b/src/plugins/logger/logger-config.c @@ -30,6 +30,12 @@ struct t_config_file *logger_config_file = NULL; + +/* sections */ + +struct t_config_section *logger_config_section_look = NULL; +struct t_config_section *logger_config_section_color = NULL; +struct t_config_section *logger_config_section_file = NULL; struct t_config_section *logger_config_section_level = NULL; struct t_config_section *logger_config_section_mask = NULL; @@ -37,31 +43,31 @@ int logger_config_loading = 0; /* logger config, look section */ -struct t_config_option *logger_config_look_backlog; -struct t_config_option *logger_config_look_backlog_conditions; +struct t_config_option *logger_config_look_backlog = NULL; +struct t_config_option *logger_config_look_backlog_conditions = NULL; /* logger config, color section */ -struct t_config_option *logger_config_color_backlog_end; -struct t_config_option *logger_config_color_backlog_line; +struct t_config_option *logger_config_color_backlog_end = NULL; +struct t_config_option *logger_config_color_backlog_line = NULL; /* logger config, file section */ -struct t_config_option *logger_config_file_auto_log; -struct t_config_option *logger_config_file_color_lines; -struct t_config_option *logger_config_file_flush_delay; -struct t_config_option *logger_config_file_fsync; -struct t_config_option *logger_config_file_info_lines; -struct t_config_option *logger_config_file_mask; -struct t_config_option *logger_config_file_name_lower_case; -struct t_config_option *logger_config_file_nick_prefix; -struct t_config_option *logger_config_file_nick_suffix; -struct t_config_option *logger_config_file_path; -struct t_config_option *logger_config_file_replacement_char; -struct t_config_option *logger_config_file_rotation_compression_level; -struct t_config_option *logger_config_file_rotation_compression_type; -struct t_config_option *logger_config_file_rotation_size_max; -struct t_config_option *logger_config_file_time_format; +struct t_config_option *logger_config_file_auto_log = NULL; +struct t_config_option *logger_config_file_color_lines = NULL; +struct t_config_option *logger_config_file_flush_delay = NULL; +struct t_config_option *logger_config_file_fsync = NULL; +struct t_config_option *logger_config_file_info_lines = NULL; +struct t_config_option *logger_config_file_mask = NULL; +struct t_config_option *logger_config_file_name_lower_case = NULL; +struct t_config_option *logger_config_file_nick_prefix = NULL; +struct t_config_option *logger_config_file_nick_suffix = NULL; +struct t_config_option *logger_config_file_path = NULL; +struct t_config_option *logger_config_file_replacement_char = NULL; +struct t_config_option *logger_config_file_rotation_compression_level = NULL; +struct t_config_option *logger_config_file_rotation_compression_type = NULL; +struct t_config_option *logger_config_file_rotation_size_max = NULL; +struct t_config_option *logger_config_file_time_format = NULL; /* other */ @@ -460,234 +466,224 @@ logger_config_get_mask (const char *name) int logger_config_init () { - struct t_config_section *ptr_section; - logger_config_file = weechat_config_new (LOGGER_CONFIG_PRIO_NAME, NULL, NULL, NULL); if (!logger_config_file) return 0; /* look */ - ptr_section = weechat_config_new_section (logger_config_file, "look", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + logger_config_section_look = weechat_config_new_section ( + logger_config_file, "look", + 0, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + if (logger_config_section_look) { - weechat_config_free (logger_config_file); - logger_config_file = NULL; - return 0; + logger_config_look_backlog = weechat_config_new_option ( + logger_config_file, logger_config_section_look, + "backlog", "integer", + N_("maximum number of lines to display from log file when creating " + "new buffer (0 = no backlog)"), + NULL, 0, INT_MAX, "20", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_look_backlog_conditions = weechat_config_new_option ( + logger_config_file, logger_config_section_look, + "backlog_conditions", "string", + N_("conditions to display the backlog " + "(note: content is evaluated, see /help eval); " + "empty value displays the backlog on all buffers; " + "for example to display backlog on private buffers only: " + "\"${type} == private\""), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - logger_config_look_backlog = weechat_config_new_option ( - logger_config_file, ptr_section, - "backlog", "integer", - N_("maximum number of lines to display from log file when creating " - "new buffer (0 = no backlog)"), - NULL, 0, INT_MAX, "20", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - logger_config_look_backlog_conditions = weechat_config_new_option ( - logger_config_file, ptr_section, - "backlog_conditions", "string", - N_("conditions to display the backlog " - "(note: content is evaluated, see /help eval); " - "empty value displays the backlog on all buffers; " - "for example to display backlog on private buffers only: " - "\"${type} == private\""), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - /* color */ - ptr_section = weechat_config_new_section (logger_config_file, "color", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + logger_config_section_color = weechat_config_new_section ( + logger_config_file, "color", + 0, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + if (logger_config_section_color) { - weechat_config_free (logger_config_file); - logger_config_file = NULL; - return 0; + logger_config_color_backlog_end = weechat_config_new_option ( + logger_config_file, logger_config_section_color, + "backlog_end", "color", + N_("color for line ending the backlog"), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_color_backlog_line = weechat_config_new_option ( + logger_config_file, logger_config_section_color, + "backlog_line", "color", + N_("color for backlog lines, used only if the option " + "logger.file.color_lines is off"), + NULL, -1, 0, "default", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - logger_config_color_backlog_end = weechat_config_new_option ( - logger_config_file, ptr_section, - "backlog_end", "color", - N_("color for line ending the backlog"), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - logger_config_color_backlog_line = weechat_config_new_option ( - logger_config_file, ptr_section, - "backlog_line", "color", - N_("color for backlog lines, used only if the option " - "logger.file.color_lines is off"), - NULL, -1, 0, "default", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - /* file */ - ptr_section = weechat_config_new_section (logger_config_file, "file", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (logger_config_file); - logger_config_file = NULL; - return 0; - } - - logger_config_file_auto_log = weechat_config_new_option ( - logger_config_file, ptr_section, - "auto_log", "boolean", - N_("automatically save content of buffers to files (unless a buffer " - "disables log); if disabled, logging is disabled on all buffers"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - logger_config_file_color_lines = weechat_config_new_option ( - logger_config_file, ptr_section, - "color_lines", "boolean", - N_("use ANSI color codes in lines written in log files and display " - "backlog lines with these colors"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - &logger_config_color_lines_change, NULL, NULL, - NULL, NULL, NULL); - logger_config_file_flush_delay = weechat_config_new_option ( - logger_config_file, ptr_section, - "flush_delay", "integer", - N_("number of seconds between flush of log files (0 = write in log " - "files immediately for each line printed)"), - NULL, 0, 3600, "120", NULL, 0, - NULL, NULL, NULL, - &logger_config_flush_delay_change, NULL, NULL, - NULL, NULL, NULL); - logger_config_file_fsync = weechat_config_new_option ( - logger_config_file, ptr_section, - "fsync", "boolean", - N_("use fsync to synchronize the log file with the storage device " - "after the flush (see man fsync); this is slower but should " - "prevent any data loss in case of power failure during the save of " - "log file"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - logger_config_file_info_lines = weechat_config_new_option ( - logger_config_file, ptr_section, - "info_lines", "boolean", - N_("write information line in log file when log starts or ends for a " - "buffer"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - logger_config_file_mask = weechat_config_new_option ( - logger_config_file, ptr_section, - "mask", "string", - N_("default file name mask for log files (format is " - "\"directory/to/file\" or \"file\", without first \"/\" because " - "\"path\" option is used to build complete path to file); local " - "buffer variables are permitted (you should use only variables " - "that are defined on all buffers, so for example you should NOT " - "use $server nor $channel); date specifiers are permitted " - "(see man strftime)"), - NULL, 0, 0, "$plugin.$name.weechatlog", NULL, 0, + logger_config_section_file = weechat_config_new_section ( + logger_config_file, "file", + 0, 0, NULL, NULL, NULL, - &logger_config_change_file_option_restart_log, NULL, NULL, - NULL, NULL, NULL); - logger_config_file_name_lower_case = weechat_config_new_option ( - logger_config_file, ptr_section, - "name_lower_case", "boolean", - N_("use only lower case for log filenames"), - NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, - &logger_config_change_file_option_restart_log, NULL, NULL, - NULL, NULL, NULL); - logger_config_file_nick_prefix = weechat_config_new_option ( - logger_config_file, ptr_section, - "nick_prefix", "string", - N_("text to write before nick in prefix of message, example: \"<\""), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - logger_config_file_nick_suffix = weechat_config_new_option ( - logger_config_file, ptr_section, - "nick_suffix", "string", - N_("text to write after nick in prefix of message, example: \">\""), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - logger_config_file_path = weechat_config_new_option ( - logger_config_file, ptr_section, - "path", "string", - N_("path for WeeChat log files; " - "date specifiers are permitted (see man strftime) " - "(path is evaluated, see function string_eval_path_home in " - "plugin API reference)"), - NULL, 0, 0, "${weechat_data_dir}/logs", NULL, 0, NULL, NULL, NULL, - &logger_config_change_file_option_restart_log, NULL, NULL, - NULL, NULL, NULL); - logger_config_file_replacement_char = weechat_config_new_option ( - logger_config_file, ptr_section, - "replacement_char", "string", - N_("replacement char for special chars in filename built with mask " - "(like directory delimiter)"), - NULL, 0, 0, "_", NULL, 0, NULL, NULL, NULL, - &logger_config_change_file_option_restart_log, NULL, NULL, NULL, NULL, NULL); - logger_config_file_rotation_compression_level = weechat_config_new_option ( - logger_config_file, ptr_section, - "rotation_compression_level", "integer", - N_("compression level for rotated log files (with extension \".1\", " - "\".2\", etc.), if option logger.file.rotation_compression_type is " - "enabled: 1 = low compression / fast ... 100 = best compression / " - "slow; the value is a percentage converted to 1-9 for gzip and " - "1-19 for zstd; the default value is recommended, it offers a good " - "compromise between compression and speed"), - NULL, 1, 100, "20", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - logger_config_file_rotation_compression_type = weechat_config_new_option ( - logger_config_file, ptr_section, - "rotation_compression_type", "integer", - N_("compression type for rotated log files; if set to \"none\", " - "rotated log files are not compressed; WARNING: if rotation was " - "enabled with another type of compression (or no compression), " - "you must first unload the logger plugin, compress files with the " - "new type (or decompress files), then change the option in " - "logger.conf, then load the logger plugin"), - "none|gzip|zstd", 0, 0, "none", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - logger_config_file_rotation_size_max = weechat_config_new_option ( - logger_config_file, ptr_section, - "rotation_size_max", "string", - N_("when this size is reached, a rotation of log files is performed: " - "the existing rotated log files are renamed (.1 becomes .2, .2 " - "becomes .3, etc.) and the current file is renamed with extension " - ".1; an integer number with a suffix is allowed: b = bytes " - "(default if no unit given), k = kilobytes, m = megabytes, " - "g = gigabytes, t = terabytes; example: \"2g\" causes a rotation " - "if the file size is > 2,000,000,000 bytes; if set to \"0\", " - "no rotation is performed (unlimited log size); WARNING: before " - "changing this option, you should first set the compression type " - "via option logger.file.rotation_compression_type"), - NULL, 0, 0, "0", NULL, 0, - &logger_config_rotation_size_max_check, NULL, NULL, - &logger_config_rotation_size_max_change, NULL, NULL, - NULL, NULL, NULL); - logger_config_file_time_format = weechat_config_new_option ( - logger_config_file, ptr_section, - "time_format", "string", - N_("timestamp used in log files (see man strftime for date/time " - "specifiers)"), - NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + if (logger_config_section_file) + { + logger_config_file_auto_log = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "auto_log", "boolean", + N_("automatically save content of buffers to files (unless a buffer " + "disables log); if disabled, logging is disabled on all buffers"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_color_lines = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "color_lines", "boolean", + N_("use ANSI color codes in lines written in log files and display " + "backlog lines with these colors"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &logger_config_color_lines_change, NULL, NULL, + NULL, NULL, NULL); + logger_config_file_flush_delay = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "flush_delay", "integer", + N_("number of seconds between flush of log files (0 = write in log " + "files immediately for each line printed)"), + NULL, 0, 3600, "120", NULL, 0, + NULL, NULL, NULL, + &logger_config_flush_delay_change, NULL, NULL, + NULL, NULL, NULL); + logger_config_file_fsync = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "fsync", "boolean", + N_("use fsync to synchronize the log file with the storage device " + "after the flush (see man fsync); this is slower but should " + "prevent any data loss in case of power failure during the save " + "of log file"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_info_lines = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "info_lines", "boolean", + N_("write information line in log file when log starts or ends for " + "a buffer"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_mask = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "mask", "string", + N_("default file name mask for log files (format is " + "\"directory/to/file\" or \"file\", without first \"/\" because " + "\"path\" option is used to build complete path to file); local " + "buffer variables are permitted (you should use only variables " + "that are defined on all buffers, so for example you should NOT " + "use $server nor $channel); date specifiers are permitted " + "(see man strftime)"), + NULL, 0, 0, "$plugin.$name.weechatlog", NULL, 0, + NULL, NULL, NULL, + &logger_config_change_file_option_restart_log, NULL, NULL, + NULL, NULL, NULL); + logger_config_file_name_lower_case = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "name_lower_case", "boolean", + N_("use only lower case for log filenames"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &logger_config_change_file_option_restart_log, NULL, NULL, + NULL, NULL, NULL); + logger_config_file_nick_prefix = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "nick_prefix", "string", + N_("text to write before nick in prefix of message, example: \"<\""), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_nick_suffix = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "nick_suffix", "string", + N_("text to write after nick in prefix of message, example: \">\""), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_path = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "path", "string", + N_("path for WeeChat log files; " + "date specifiers are permitted (see man strftime) " + "(path is evaluated, see function string_eval_path_home in " + "plugin API reference)"), + NULL, 0, 0, "${weechat_data_dir}/logs", NULL, 0, + NULL, NULL, NULL, + &logger_config_change_file_option_restart_log, NULL, NULL, + NULL, NULL, NULL); + logger_config_file_replacement_char = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "replacement_char", "string", + N_("replacement char for special chars in filename built with mask " + "(like directory delimiter)"), + NULL, 0, 0, "_", NULL, 0, + NULL, NULL, NULL, + &logger_config_change_file_option_restart_log, NULL, NULL, + NULL, NULL, NULL); + logger_config_file_rotation_compression_level = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "rotation_compression_level", "integer", + N_("compression level for rotated log files (with extension \".1\", " + "\".2\", etc.), if option logger.file.rotation_compression_type " + "is enabled: 1 = low compression / fast ... 100 = best " + "compression / slow; the value is a percentage converted to " + "1-9 for gzip and 1-19 for zstd; the default value is " + "recommended, it offers a good compromise between compression " + "and speed"), + NULL, 1, 100, "20", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_rotation_compression_type = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "rotation_compression_type", "integer", + N_("compression type for rotated log files; if set to \"none\", " + "rotated log files are not compressed; WARNING: if rotation was " + "enabled with another type of compression (or no compression), " + "you must first unload the logger plugin, compress files with the " + "new type (or decompress files), then change the option in " + "logger.conf, then load the logger plugin"), + "none|gzip|zstd", 0, 0, "none", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + logger_config_file_rotation_size_max = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "rotation_size_max", "string", + N_("when this size is reached, a rotation of log files is performed: " + "the existing rotated log files are renamed (.1 becomes .2, .2 " + "becomes .3, etc.) and the current file is renamed with extension " + ".1; an integer number with a suffix is allowed: b = bytes " + "(default if no unit given), k = kilobytes, m = megabytes, " + "g = gigabytes, t = terabytes; example: \"2g\" causes a rotation " + "if the file size is > 2,000,000,000 bytes; if set to \"0\", " + "no rotation is performed (unlimited log size); WARNING: before " + "changing this option, you should first set the compression type " + "via option logger.file.rotation_compression_type"), + NULL, 0, 0, "0", NULL, 0, + &logger_config_rotation_size_max_check, NULL, NULL, + &logger_config_rotation_size_max_change, NULL, NULL, + NULL, NULL, NULL); + logger_config_file_time_format = weechat_config_new_option ( + logger_config_file, logger_config_section_file, + "time_format", "string", + N_("timestamp used in log files (see man strftime for date/time " + "specifiers)"), + NULL, 0, 0, "%Y-%m-%d %H:%M:%S", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + } /* level */ - ptr_section = weechat_config_new_section ( + logger_config_section_level = weechat_config_new_section ( logger_config_file, "level", 1, 1, NULL, NULL, NULL, @@ -695,17 +691,9 @@ logger_config_init () NULL, NULL, NULL, &logger_config_level_create_option, NULL, NULL, &logger_config_level_delete_option, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (logger_config_file); - logger_config_file = NULL; - return 0; - } - - logger_config_section_level = ptr_section; /* mask */ - ptr_section = weechat_config_new_section ( + logger_config_section_mask = weechat_config_new_section ( logger_config_file, "mask", 1, 1, NULL, NULL, NULL, @@ -713,14 +701,6 @@ logger_config_init () NULL, NULL, NULL, &logger_config_mask_create_option, NULL, NULL, &logger_config_mask_delete_option, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (logger_config_file); - logger_config_file = NULL; - return 0; - } - - logger_config_section_mask = ptr_section; return 1; } diff --git a/src/plugins/plugin-config.c b/src/plugins/plugin-config.c index df2c2cbf5..14f717439 100644 --- a/src/plugins/plugin-config.c +++ b/src/plugins/plugin-config.c @@ -378,11 +378,6 @@ plugin_config_init () &plugin_config_create_desc, NULL, NULL, &plugin_config_delete_desc, NULL, NULL); } - else - { - plugin_config_section_var = NULL; - plugin_config_section_desc = NULL; - } } /* diff --git a/src/plugins/plugin-script-config.c b/src/plugins/plugin-script-config.c index 5893c87ed..fb357ff2b 100644 --- a/src/plugins/plugin-script-config.c +++ b/src/plugins/plugin-script-config.c @@ -60,30 +60,27 @@ plugin_script_config_init (struct t_weechat_plugin *weechat_plugin, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) + if (ptr_section) { - weechat_config_free (*(plugin_data->config_file)); - *(plugin_data->config_file) = NULL; - return 0; + *(plugin_data->config_look_check_license) = weechat_config_new_option ( + *(plugin_data->config_file), ptr_section, + "check_license", "boolean", + N_("check the license of scripts when they are loaded: if the " + "license is different from the plugin license, a warning is " + "displayed"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + *(plugin_data->config_look_eval_keep_context) = weechat_config_new_option ( + *(plugin_data->config_file), ptr_section, + "eval_keep_context", "boolean", + N_("keep context between two calls to the source code evaluation " + "(option \"eval\" of script command or info \"%s_eval\"); " + "a hidden script is used to eval script code; " + "if this option is disabled, this hidden script is unloaded " + "after each eval: this uses less memory, but is slower"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - *(plugin_data->config_look_check_license) = weechat_config_new_option ( - *(plugin_data->config_file), ptr_section, - "check_license", "boolean", - N_("check the license of scripts when they are loaded: if the license " - "is different from the plugin license, a warning is displayed"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - *(plugin_data->config_look_eval_keep_context) = weechat_config_new_option ( - *(plugin_data->config_file), ptr_section, - "eval_keep_context", "boolean", - N_("keep context between two calls to the source code evaluation " - "(option \"eval\" of script command or info \"%s_eval\"); " - "a hidden script is used to eval script code; " - "if this option is disabled, this hidden script is unloaded after " - "each eval: this uses less memory, but is slower"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - return 1; } diff --git a/src/plugins/relay/relay-config.c b/src/plugins/relay/relay-config.c index a7591befa..126905784 100644 --- a/src/plugins/relay/relay-config.c +++ b/src/plugins/relay/relay-config.c @@ -40,54 +40,64 @@ struct t_config_file *relay_config_file = NULL; + +/* sections */ + +struct t_config_section *relay_config_section_look = NULL; +struct t_config_section *relay_config_section_color = NULL; +struct t_config_section *relay_config_section_network = NULL; +struct t_config_section *relay_config_section_irc = NULL; +struct t_config_section *relay_config_section_weechat = NULL; struct t_config_section *relay_config_section_port = NULL; struct t_config_section *relay_config_section_path = NULL; /* relay config, look section */ -struct t_config_option *relay_config_look_auto_open_buffer; -struct t_config_option *relay_config_look_raw_messages; +struct t_config_option *relay_config_look_auto_open_buffer = NULL; +struct t_config_option *relay_config_look_raw_messages = NULL; /* relay config, color section */ -struct t_config_option *relay_config_color_client; -struct t_config_option *relay_config_color_status[RELAY_NUM_STATUS]; -struct t_config_option *relay_config_color_text; -struct t_config_option *relay_config_color_text_bg; -struct t_config_option *relay_config_color_text_selected; +struct t_config_option *relay_config_color_client = NULL; +struct t_config_option *relay_config_color_status[RELAY_NUM_STATUS] = { + NULL, NULL, NULL, NULL, NULL, +}; +struct t_config_option *relay_config_color_text = NULL; +struct t_config_option *relay_config_color_text_bg = NULL; +struct t_config_option *relay_config_color_text_selected = NULL; /* relay config, network section */ -struct t_config_option *relay_config_network_allow_empty_password; -struct t_config_option *relay_config_network_allowed_ips; -struct t_config_option *relay_config_network_auth_timeout; -struct t_config_option *relay_config_network_bind_address; -struct t_config_option *relay_config_network_clients_purge_delay; -struct t_config_option *relay_config_network_compression; -struct t_config_option *relay_config_network_ipv6; -struct t_config_option *relay_config_network_max_clients; -struct t_config_option *relay_config_network_nonce_size; -struct t_config_option *relay_config_network_password; -struct t_config_option *relay_config_network_password_hash_algo; -struct t_config_option *relay_config_network_password_hash_iterations; -struct t_config_option *relay_config_network_ssl_cert_key; -struct t_config_option *relay_config_network_ssl_priorities; -struct t_config_option *relay_config_network_totp_secret; -struct t_config_option *relay_config_network_totp_window; -struct t_config_option *relay_config_network_websocket_allowed_origins; +struct t_config_option *relay_config_network_allow_empty_password = NULL; +struct t_config_option *relay_config_network_allowed_ips = NULL; +struct t_config_option *relay_config_network_auth_timeout = NULL; +struct t_config_option *relay_config_network_bind_address = NULL; +struct t_config_option *relay_config_network_clients_purge_delay = NULL; +struct t_config_option *relay_config_network_compression = NULL; +struct t_config_option *relay_config_network_ipv6 = NULL; +struct t_config_option *relay_config_network_max_clients = NULL; +struct t_config_option *relay_config_network_nonce_size = NULL; +struct t_config_option *relay_config_network_password = NULL; +struct t_config_option *relay_config_network_password_hash_algo = NULL; +struct t_config_option *relay_config_network_password_hash_iterations = NULL; +struct t_config_option *relay_config_network_ssl_cert_key = NULL; +struct t_config_option *relay_config_network_ssl_priorities = NULL; +struct t_config_option *relay_config_network_totp_secret = NULL; +struct t_config_option *relay_config_network_totp_window = NULL; +struct t_config_option *relay_config_network_websocket_allowed_origins = NULL; /* relay config, irc section */ -struct t_config_option *relay_config_irc_backlog_max_minutes; -struct t_config_option *relay_config_irc_backlog_max_number; -struct t_config_option *relay_config_irc_backlog_since_last_disconnect; -struct t_config_option *relay_config_irc_backlog_since_last_message; -struct t_config_option *relay_config_irc_backlog_tags; -struct t_config_option *relay_config_irc_backlog_time_format; +struct t_config_option *relay_config_irc_backlog_max_minutes = NULL; +struct t_config_option *relay_config_irc_backlog_max_number = NULL; +struct t_config_option *relay_config_irc_backlog_since_last_disconnect = NULL; +struct t_config_option *relay_config_irc_backlog_since_last_message = NULL; +struct t_config_option *relay_config_irc_backlog_tags = NULL; +struct t_config_option *relay_config_irc_backlog_time_format = NULL; /* relay config, weechat section */ -struct t_config_option *relay_config_weechat_commands; +struct t_config_option *relay_config_weechat_commands = NULL; /* other */ @@ -889,411 +899,396 @@ relay_config_reload (const void *pointer, void *data, int relay_config_init () { - struct t_config_section *ptr_section; - relay_config_file = weechat_config_new (RELAY_CONFIG_PRIO_NAME, &relay_config_reload, NULL, NULL); if (!relay_config_file) return 0; /* section look */ - ptr_section = weechat_config_new_section (relay_config_file, "look", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (relay_config_file); - relay_config_file = NULL; - return 0; - } - - relay_config_look_auto_open_buffer = weechat_config_new_option ( - relay_config_file, ptr_section, - "auto_open_buffer", "boolean", - N_("auto open relay buffer when a new client is connecting"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_look_raw_messages = weechat_config_new_option ( - relay_config_file, ptr_section, - "raw_messages", "integer", - N_("number of raw messages to save in memory when raw data buffer is " - "closed (messages will be displayed when opening raw data buffer)"), - NULL, 0, 65535, "256", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - /* section color */ - ptr_section = weechat_config_new_section (relay_config_file, "color", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (relay_config_file); - relay_config_file = NULL; - return 0; - } - - relay_config_color_client = weechat_config_new_option ( - relay_config_file, ptr_section, - "client", "color", - N_("text color for client description"), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_color_status[RELAY_STATUS_CONNECTED] = weechat_config_new_option ( - relay_config_file, ptr_section, - "status_active", "color", - N_("text color for \"connected\" status"), - NULL, 0, 0, "green", NULL, 0, + relay_config_section_look = weechat_config_new_section ( + relay_config_file, "look", + 0, 0, NULL, NULL, NULL, - &relay_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - relay_config_color_status[RELAY_STATUS_AUTH_FAILED] = weechat_config_new_option ( - relay_config_file, ptr_section, - "status_auth_failed", "color", - N_("text color for \"authentication failed\" status"), - NULL, 0, 0, "lightmagenta", NULL, 0, NULL, NULL, NULL, - &relay_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - relay_config_color_status[RELAY_STATUS_CONNECTING] = weechat_config_new_option ( - relay_config_file, ptr_section, - "status_connecting", "color", - N_("text color for \"connecting\" status"), - NULL, 0, 0, "white", NULL, 0, NULL, NULL, NULL, - &relay_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - relay_config_color_status[RELAY_STATUS_DISCONNECTED] = weechat_config_new_option ( - relay_config_file, ptr_section, - "status_disconnected", "color", - N_("text color for \"disconnected\" status"), - NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, NULL, - &relay_config_refresh_cb, NULL, NULL, NULL, NULL, NULL); - relay_config_color_status[RELAY_STATUS_WAITING_AUTH] = weechat_config_new_option ( - relay_config_file, ptr_section, - "status_waiting_auth", "color", - N_("text color for \"waiting authentication\" status"), - NULL, 0, 0, "yellow", NULL, 0, + if (relay_config_section_look) + { + relay_config_look_auto_open_buffer = weechat_config_new_option ( + relay_config_file, relay_config_section_look, + "auto_open_buffer", "boolean", + N_("auto open relay buffer when a new client is connecting"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_look_raw_messages = weechat_config_new_option ( + relay_config_file, relay_config_section_look, + "raw_messages", "integer", + N_("number of raw messages to save in memory when raw data buffer " + "is closed (messages will be displayed when opening raw data " + "buffer)"), + NULL, 0, 65535, "256", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + } + + /* section color */ + relay_config_section_color = weechat_config_new_section ( + relay_config_file, "color", + 0, 0, NULL, NULL, NULL, - &relay_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - relay_config_color_text = weechat_config_new_option ( - relay_config_file, ptr_section, - "text", "color", - N_("text color in relay buffer"), - NULL, 0, 0, "default", NULL, 0, NULL, NULL, NULL, - &relay_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - relay_config_color_text_bg = weechat_config_new_option ( - relay_config_file, ptr_section, - "text_bg", "color", - N_("background color in relay buffer"), - NULL, 0, 0, "default", NULL, 0, NULL, NULL, NULL, - &relay_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - relay_config_color_text_selected = weechat_config_new_option ( - relay_config_file, ptr_section, - "text_selected", "color", - N_("text color of selected line in relay buffer"), - NULL, 0, 0, "white", NULL, 0, NULL, NULL, NULL, - &relay_config_refresh_cb, NULL, NULL, NULL, NULL, NULL); - - /* section network */ - ptr_section = weechat_config_new_section (relay_config_file, "network", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (relay_config_section_color) { - weechat_config_free (relay_config_file); - relay_config_file = NULL; - return 0; + relay_config_color_client = weechat_config_new_option ( + relay_config_file, relay_config_section_color, + "client", "color", + N_("text color for client description"), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_CONNECTED] = weechat_config_new_option ( + relay_config_file, relay_config_section_color, + "status_active", "color", + N_("text color for \"connected\" status"), + NULL, 0, 0, "green", NULL, 0, + NULL, NULL, NULL, + &relay_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_AUTH_FAILED] = weechat_config_new_option ( + relay_config_file, relay_config_section_color, + "status_auth_failed", "color", + N_("text color for \"authentication failed\" status"), + NULL, 0, 0, "lightmagenta", NULL, 0, + NULL, NULL, NULL, + &relay_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_CONNECTING] = weechat_config_new_option ( + relay_config_file, relay_config_section_color, + "status_connecting", "color", + N_("text color for \"connecting\" status"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &relay_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_DISCONNECTED] = weechat_config_new_option ( + relay_config_file, relay_config_section_color, + "status_disconnected", "color", + N_("text color for \"disconnected\" status"), + NULL, 0, 0, "lightred", NULL, 0, + NULL, NULL, NULL, + &relay_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + relay_config_color_status[RELAY_STATUS_WAITING_AUTH] = weechat_config_new_option ( + relay_config_file, relay_config_section_color, + "status_waiting_auth", "color", + N_("text color for \"waiting authentication\" status"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &relay_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + relay_config_color_text = weechat_config_new_option ( + relay_config_file, relay_config_section_color, + "text", "color", + N_("text color in relay buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &relay_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + relay_config_color_text_bg = weechat_config_new_option ( + relay_config_file, relay_config_section_color, + "text_bg", "color", + N_("background color in relay buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &relay_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + relay_config_color_text_selected = weechat_config_new_option ( + relay_config_file, relay_config_section_color, + "text_selected", "color", + N_("text color of selected line in relay buffer"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &relay_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); } - relay_config_network_allow_empty_password = weechat_config_new_option ( - relay_config_file, ptr_section, - "allow_empty_password", "boolean", - N_("allow empty password in relay (it should be enabled only for " - "tests or local network)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_network_allowed_ips = weechat_config_new_option ( - relay_config_file, ptr_section, - "allowed_ips", "string", - N_("POSIX extended regular expression with IPs allowed to use relay " - "(case insensitive, use \"(?-i)\" at beginning to make it case " - "sensitive), example: " - "\"^(123\\.45\\.67\\.89|192\\.160\\..*)$\""), - NULL, 0, 0, "", NULL, 0, + /* section network */ + relay_config_section_network = weechat_config_new_section ( + relay_config_file, "network", + 0, 0, NULL, NULL, NULL, - &relay_config_change_network_allowed_ips, NULL, NULL, - NULL, NULL, NULL); - relay_config_network_auth_timeout = weechat_config_new_option ( - relay_config_file, ptr_section, - "auth_timeout", "integer", - N_("timeout (in seconds) for client authentication: connection is " - "closed if the client is still not authenticated after this delay " - "and the client status is set to \"authentication failed\" " - "(0 = wait forever)"), - NULL, 0, INT_MAX, "60", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_network_bind_address = weechat_config_new_option ( - relay_config_file, ptr_section, - "bind_address", "string", - N_("address for bind (if empty, connection is possible on all " - "interfaces, use \"127.0.0.1\" to allow connections from " - "local machine only)"), - NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, - &relay_config_change_network_bind_address_cb, NULL, NULL, - NULL, NULL, NULL); - relay_config_network_clients_purge_delay = weechat_config_new_option ( - relay_config_file, ptr_section, - "clients_purge_delay", "integer", - N_("delay for purging disconnected clients (in minutes, 0 = purge " - "clients immediately, -1 = never purge)"), - NULL, -1, 60 * 24 * 30, "0", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_network_compression = weechat_config_new_option ( - relay_config_file, ptr_section, - "compression", "integer", - N_("compression of messages sent to clients with \"weechat\" " - "protocol: 0 = disable compression, 1 = low compression / fast " - "... 100 = best compression / slow; the value is a percentage " - "converted to 1-9 for zlib and 1-19 for zstd; " - "the default value is recommended, it offers a good " - "compromise between compression and speed"), - NULL, 0, 100, "20", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_network_ipv6 = weechat_config_new_option ( - relay_config_file, ptr_section, - "ipv6", "boolean", - N_("listen on IPv6 socket by default (in addition to IPv4 which is " - "default); protocols IPv4 and IPv6 can be forced (individually or " - "together) in the protocol name (see /help relay)"), - NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, - &relay_config_change_network_ipv6_cb, NULL, NULL, - NULL, NULL, NULL); - relay_config_network_max_clients = weechat_config_new_option ( - relay_config_file, ptr_section, - "max_clients", "integer", - N_("maximum number of clients connecting to a port (0 = no limit)"), - NULL, 0, INT_MAX, "5", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_network_nonce_size = weechat_config_new_option ( - relay_config_file, ptr_section, - "nonce_size", "integer", - N_("size of nonce (in bytes), generated when a client connects; " - "the client must use this nonce, concatenated to the client nonce " - "and the password when hashing the password in the \"init\" " - "command of the weechat protocol"), - NULL, 8, 128, "16", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_network_password = weechat_config_new_option ( - relay_config_file, ptr_section, - "password", "string", - N_("password required by clients to access this relay (empty value " - "means no password required, see option " - "relay.network.allow_empty_password) (note: content is evaluated, " - "see /help eval)"), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_network_password_hash_algo = weechat_config_new_option ( - relay_config_file, ptr_section, - "password_hash_algo", "string", - N_("comma separated list of hash algorithms used for password " - "authentication in weechat protocol, among these values: \"plain\" " - "(password in plain text, not hashed), \"sha256\", \"sha512\", " - "\"pbkdf2+sha256\", \"pbkdf2+sha512\"), \"*\" means all algorithms, " - "a name beginning with \"!\" is a negative value to prevent an " - "algorithm from being used, wildcard \"*\" is allowed in names " - "(examples: \"*\", \"pbkdf2*\", \"*,!plain\")"), - NULL, 0, 0, "*", NULL, 0, NULL, NULL, NULL, - &relay_config_change_network_password_hash_algo, NULL, NULL, NULL, NULL, NULL); - relay_config_network_password_hash_iterations = weechat_config_new_option ( - relay_config_file, ptr_section, - "password_hash_iterations", "integer", - N_("number of iterations asked to the client in weechat protocol " - "when a hashed password with algorithm PBKDF2 is used for " - "authentication; more iterations is better in term of security but " - "is slower to compute; this number should not be too high if your " - "CPU is slow"), - NULL, 1, 1000000, "100000", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_network_ssl_cert_key = weechat_config_new_option ( - relay_config_file, ptr_section, - "ssl_cert_key", "string", - N_("file with SSL certificate and private key (for serving clients " - "with SSL) " - "(path is evaluated, see function string_eval_path_home in " - "plugin API reference)"), - NULL, 0, 0, "${weechat_config_dir}/ssl/relay.pem", NULL, 0, + if (relay_config_section_network) + { + relay_config_network_allow_empty_password = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "allow_empty_password", "boolean", + N_("allow empty password in relay (it should be enabled only for " + "tests or local network)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_allowed_ips = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "allowed_ips", "string", + N_("POSIX extended regular expression with IPs allowed to use relay " + "(case insensitive, use \"(?-i)\" at beginning to make it case " + "sensitive), example: " + "\"^(123\\.45\\.67\\.89|192\\.160\\..*)$\""), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, + &relay_config_change_network_allowed_ips, NULL, NULL, + NULL, NULL, NULL); + relay_config_network_auth_timeout = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "auth_timeout", "integer", + N_("timeout (in seconds) for client authentication: connection is " + "closed if the client is still not authenticated after this " + "delay and the client status is set to \"authentication " + "failed\" (0 = wait forever)"), + NULL, 0, INT_MAX, "60", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_bind_address = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "bind_address", "string", + N_("address for bind (if empty, connection is possible on all " + "interfaces, use \"127.0.0.1\" to allow connections from " + "local machine only)"), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, + &relay_config_change_network_bind_address_cb, NULL, NULL, + NULL, NULL, NULL); + relay_config_network_clients_purge_delay = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "clients_purge_delay", "integer", + N_("delay for purging disconnected clients (in minutes, 0 = purge " + "clients immediately, -1 = never purge)"), + NULL, -1, 60 * 24 * 30, "0", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_compression = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "compression", "integer", + N_("compression of messages sent to clients with \"weechat\" " + "protocol: 0 = disable compression, 1 = low compression / fast " + "... 100 = best compression / slow; the value is a percentage " + "converted to 1-9 for zlib and 1-19 for zstd; " + "the default value is recommended, it offers a good " + "compromise between compression and speed"), + NULL, 0, 100, "20", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_ipv6 = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "ipv6", "boolean", + N_("listen on IPv6 socket by default (in addition to IPv4 which is " + "default); protocols IPv4 and IPv6 can be forced (individually " + "or together) in the protocol name (see /help relay)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &relay_config_change_network_ipv6_cb, NULL, NULL, + NULL, NULL, NULL); + relay_config_network_max_clients = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "max_clients", "integer", + N_("maximum number of clients connecting to a port (0 = no limit)"), + NULL, 0, INT_MAX, "5", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_nonce_size = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "nonce_size", "integer", + N_("size of nonce (in bytes), generated when a client connects; " + "the client must use this nonce, concatenated to the client nonce " + "and the password when hashing the password in the \"init\" " + "command of the weechat protocol"), + NULL, 8, 128, "16", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_password = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "password", "string", + N_("password required by clients to access this relay (empty value " + "means no password required, see option " + "relay.network.allow_empty_password) (note: content is evaluated, " + "see /help eval)"), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_password_hash_algo = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "password_hash_algo", "string", + N_("comma separated list of hash algorithms used for password " + "authentication in weechat protocol, among these values: " + "\"plain\" (password in plain text, not hashed), \"sha256\", " + "\"sha512\", \"pbkdf2+sha256\", \"pbkdf2+sha512\"), \"*\" means " + "all algorithms, a name beginning with \"!\" is a negative " + "value to prevent an algorithm from being used, wildcard \"*\" " + "is allowed in names (examples: \"*\", \"pbkdf2*\", " + "\"*,!plain\")"), + NULL, 0, 0, "*", NULL, 0, + NULL, NULL, NULL, + &relay_config_change_network_password_hash_algo, NULL, NULL, + NULL, NULL, NULL); + relay_config_network_password_hash_iterations = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "password_hash_iterations", "integer", + N_("number of iterations asked to the client in weechat protocol " + "when a hashed password with algorithm PBKDF2 is used for " + "authentication; more iterations is better in term of security " + "but is slower to compute; this number should not be too high " + "if your CPU is slow"), + NULL, 1, 1000000, "100000", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_ssl_cert_key = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "ssl_cert_key", "string", + N_("file with SSL certificate and private key (for serving clients " + "with SSL) " + "(path is evaluated, see function string_eval_path_home in " + "plugin API reference)"), + NULL, 0, 0, "${weechat_config_dir}/ssl/relay.pem", NULL, 0, + NULL, NULL, NULL, + &relay_config_change_network_ssl_cert_key, NULL, NULL, + NULL, NULL, NULL); + relay_config_network_ssl_priorities = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "ssl_priorities", "string", + N_("string with priorities for gnutls (for syntax, see " + "documentation of function gnutls_priority_init in gnutls " + "manual, common strings are: \"PERFORMANCE\", \"NORMAL\", " + "\"SECURE128\", \"SECURE256\", \"EXPORT\", \"NONE\")"), + NULL, 0, 0, "NORMAL:-VERS-SSL3.0", NULL, 0, + &relay_config_check_network_ssl_priorities, NULL, NULL, + &relay_config_change_network_ssl_priorities, NULL, NULL, + NULL, NULL, NULL); + relay_config_network_totp_secret = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "totp_secret", "string", + N_("secret for the generation of the Time-based One-Time Password " + "(TOTP), encoded in base32 (only letters and digits from 2 to 7); " + "it is used as second factor in weechat protocol, in addition to " + "the password, which must not be empty " + "(empty value means no TOTP is required) " + "(note: content is evaluated, see /help eval)"), + NULL, 0, 0, "", NULL, 0, + &relay_config_check_network_totp_secret, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + relay_config_network_totp_window = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "totp_window", "integer", + N_("number of Time-based One-Time Passwords to accept before and " + "after the current one: " + "0 = accept only the current password, " + "1 = accept one password before, the current, and one after, " + "2 = accept two passwords before, the current, and two after, " + "...; a high number reduces the security level " + "(0 or 1 are recommended values)"), + NULL, 0, 256, "0", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_network_websocket_allowed_origins = weechat_config_new_option ( + relay_config_file, relay_config_section_network, + "websocket_allowed_origins", "string", + N_("POSIX extended regular expression with origins allowed in " + "websockets (case insensitive, use \"(?-i)\" at beginning to " + "make it case sensitive), example: " + "\"^https?://(www\\.)?example\\.(com|org)\""), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, + &relay_config_change_network_websocket_allowed_origins, NULL, NULL, + NULL, NULL, NULL); + } + + /* section irc */ + relay_config_section_irc = weechat_config_new_section ( + relay_config_file, "irc", + 0, 0, + NULL, NULL, NULL, NULL, NULL, NULL, - &relay_config_change_network_ssl_cert_key, NULL, NULL, - NULL, NULL, NULL); - relay_config_network_ssl_priorities = weechat_config_new_option ( - relay_config_file, ptr_section, - "ssl_priorities", "string", - N_("string with priorities for gnutls (for syntax, see " - "documentation of function gnutls_priority_init in gnutls " - "manual, common strings are: \"PERFORMANCE\", \"NORMAL\", " - "\"SECURE128\", \"SECURE256\", \"EXPORT\", \"NONE\")"), - NULL, 0, 0, "NORMAL:-VERS-SSL3.0", NULL, 0, - &relay_config_check_network_ssl_priorities, NULL, NULL, - &relay_config_change_network_ssl_priorities, NULL, NULL, - NULL, NULL, NULL); - relay_config_network_totp_secret = weechat_config_new_option ( - relay_config_file, ptr_section, - "totp_secret", "string", - N_("secret for the generation of the Time-based One-Time Password " - "(TOTP), encoded in base32 (only letters and digits from 2 to 7); " - "it is used as second factor in weechat protocol, in addition to " - "the password, which must not be empty " - "(empty value means no TOTP is required) " - "(note: content is evaluated, see /help eval)"), - NULL, 0, 0, "", NULL, 0, - &relay_config_check_network_totp_secret, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL); - relay_config_network_totp_window = weechat_config_new_option ( - relay_config_file, ptr_section, - "totp_window", "integer", - N_("number of Time-based One-Time Passwords to accept before and " - "after the current one: " - "0 = accept only the current password, " - "1 = accept one password before, the current, and one after, " - "2 = accept two passwords before, the current, and two after, " - "...; a high number reduces the security level " - "(0 or 1 are recommended values)"), - NULL, 0, 256, "0", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_network_websocket_allowed_origins = weechat_config_new_option ( - relay_config_file, ptr_section, - "websocket_allowed_origins", "string", - N_("POSIX extended regular expression with origins allowed in " - "websockets (case insensitive, use \"(?-i)\" at beginning to make " - "it case sensitive), example: " - "\"^https?://(www\\.)?example\\.(com|org)\""), - NULL, 0, 0, "", NULL, 0, NULL, NULL, NULL, - &relay_config_change_network_websocket_allowed_origins, NULL, NULL, NULL, NULL, NULL); - - /* section irc */ - ptr_section = weechat_config_new_section (relay_config_file, "irc", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (relay_config_section_irc) { - weechat_config_free (relay_config_file); - relay_config_file = NULL; - return 0; + relay_config_irc_backlog_max_minutes = weechat_config_new_option ( + relay_config_file, relay_config_section_irc, + "backlog_max_minutes", "integer", + N_("maximum number of minutes in backlog per IRC channel " + "(0 = unlimited, examples: 1440 = one day, 10080 = one week, " + "43200 = one month, 525600 = one year)"), + NULL, 0, INT_MAX, "0", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_irc_backlog_max_number = weechat_config_new_option ( + relay_config_file, relay_config_section_irc, + "backlog_max_number", "integer", + N_("maximum number of lines in backlog per IRC channel " + "(0 = unlimited)"), + NULL, 0, INT_MAX, "1024", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_irc_backlog_since_last_disconnect = weechat_config_new_option ( + relay_config_file, relay_config_section_irc, + "backlog_since_last_disconnect", "boolean", + N_("display backlog starting from last client disconnect"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_irc_backlog_since_last_message = weechat_config_new_option ( + relay_config_file, relay_config_section_irc, + "backlog_since_last_message", "boolean", + N_("display backlog starting from your last message"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + relay_config_irc_backlog_tags = weechat_config_new_option ( + relay_config_file, relay_config_section_irc, + "backlog_tags", "string", + N_("comma-separated list of messages tags which are displayed in " + "backlog per IRC channel (supported tags: \"irc_join\", " + "\"irc_part\", \"irc_quit\", \"irc_nick\", \"irc_privmsg\"), " + "\"*\" = all supported tags"), + NULL, 0, 0, "irc_privmsg", NULL, 0, + &relay_config_check_irc_backlog_tags, NULL, NULL, + &relay_config_change_irc_backlog_tags, NULL, NULL, + NULL, NULL, NULL); + relay_config_irc_backlog_time_format = weechat_config_new_option ( + relay_config_file, relay_config_section_irc, + "backlog_time_format", "string", + N_("format for time in backlog messages (see man strftime for " + "format) (not used if server capability \"server-time\" was " + "enabled by client, because time is sent as irc tag); empty " + "string = disable time in backlog messages"), + NULL, 0, 0, "[%H:%M] ", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - relay_config_irc_backlog_max_minutes = weechat_config_new_option ( - relay_config_file, ptr_section, - "backlog_max_minutes", "integer", - N_("maximum number of minutes in backlog per IRC channel " - "(0 = unlimited, examples: 1440 = one day, 10080 = one week, " - "43200 = one month, 525600 = one year)"), - NULL, 0, INT_MAX, "0", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_irc_backlog_max_number = weechat_config_new_option ( - relay_config_file, ptr_section, - "backlog_max_number", "integer", - N_("maximum number of lines in backlog per IRC channel " - "(0 = unlimited)"), - NULL, 0, INT_MAX, "1024", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_irc_backlog_since_last_disconnect = weechat_config_new_option ( - relay_config_file, ptr_section, - "backlog_since_last_disconnect", "boolean", - N_("display backlog starting from last client disconnect"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_irc_backlog_since_last_message = weechat_config_new_option ( - relay_config_file, ptr_section, - "backlog_since_last_message", "boolean", - N_("display backlog starting from your last message"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - relay_config_irc_backlog_tags = weechat_config_new_option ( - relay_config_file, ptr_section, - "backlog_tags", "string", - N_("comma-separated list of messages tags which are displayed in " - "backlog per IRC channel (supported tags: \"irc_join\", " - "\"irc_part\", \"irc_quit\", \"irc_nick\", \"irc_privmsg\"), " - "\"*\" = all supported tags"), - NULL, 0, 0, "irc_privmsg", NULL, 0, - &relay_config_check_irc_backlog_tags, NULL, NULL, - &relay_config_change_irc_backlog_tags, NULL, NULL, - NULL, NULL, NULL); - relay_config_irc_backlog_time_format = weechat_config_new_option ( - relay_config_file, ptr_section, - "backlog_time_format", "string", - N_("format for time in backlog messages (see man strftime for format) " - "(not used if server capability \"server-time\" was enabled by " - "client, because time is sent as irc tag); empty string = disable " - "time in backlog messages"), - NULL, 0, 0, "[%H:%M] ", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - /* section weechat */ - ptr_section = weechat_config_new_section (relay_config_file, "weechat", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (relay_config_file); - relay_config_file = NULL; - return 0; - } - - relay_config_weechat_commands = weechat_config_new_option ( - relay_config_file, ptr_section, - "commands", "string", - N_("comma-separated list of commands allowed/denied when input " - "data (text or command) is received from a client; " - "\"*\" means any command, a name beginning with \"!\" is " - "a negative value to prevent a command from being executed, " - "wildcard \"*\" is allowed in names; this option should be set if " - "the relay client is not safe (someone could use it to run " - "commands); for example \"*,!exec,!quit\" allows any command " - "except /exec and /quit"), - NULL, 0, 0, "", NULL, 0, + relay_config_section_weechat = weechat_config_new_section ( + relay_config_file, "weechat", + 0, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + if (relay_config_section_weechat) + { + relay_config_weechat_commands = weechat_config_new_option ( + relay_config_file, relay_config_section_weechat, + "commands", "string", + N_("comma-separated list of commands allowed/denied when input " + "data (text or command) is received from a client; " + "\"*\" means any command, a name beginning with \"!\" is " + "a negative value to prevent a command from being executed, " + "wildcard \"*\" is allowed in names; this option should be set " + "if the relay client is not safe (someone could use it to run " + "commands); for example \"*,!exec,!quit\" allows any command " + "except /exec and /quit"), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + } /* section port */ - ptr_section = weechat_config_new_section ( + relay_config_section_port = weechat_config_new_section ( relay_config_file, "port", 1, 1, NULL, NULL, NULL, @@ -1301,17 +1296,9 @@ relay_config_init () NULL, NULL, NULL, &relay_config_create_option_port_path, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (relay_config_file); - relay_config_file = NULL; - return 0; - } - - relay_config_section_port = ptr_section; /* section path */ - ptr_section = weechat_config_new_section ( + relay_config_section_path = weechat_config_new_section ( relay_config_file, "path", 1, 1, NULL, NULL, NULL, @@ -1319,14 +1306,6 @@ relay_config_init () NULL, NULL, NULL, &relay_config_create_option_port_path, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (relay_config_file); - relay_config_file = NULL; - return 0; - } - - relay_config_section_path = ptr_section; return 1; } diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c index ea9e9290f..cf7c16961 100644 --- a/src/plugins/script/script-config.c +++ b/src/plugins/script/script-config.c @@ -35,55 +35,61 @@ struct t_config_file *script_config_file = NULL; +/* sections */ + +struct t_config_section *script_config_section_look = NULL; +struct t_config_section *script_config_section_color = NULL; +struct t_config_section *script_config_section_scripts = NULL; + /* script config, look section */ -struct t_config_option *script_config_look_columns; -struct t_config_option *script_config_look_diff_color; -struct t_config_option *script_config_look_diff_command; -struct t_config_option *script_config_look_display_source; -struct t_config_option *script_config_look_quiet_actions; -struct t_config_option *script_config_look_sort; -struct t_config_option *script_config_look_translate_description; -struct t_config_option *script_config_look_use_keys; +struct t_config_option *script_config_look_columns = NULL; +struct t_config_option *script_config_look_diff_color = NULL; +struct t_config_option *script_config_look_diff_command = NULL; +struct t_config_option *script_config_look_display_source = NULL; +struct t_config_option *script_config_look_quiet_actions = NULL; +struct t_config_option *script_config_look_sort = NULL; +struct t_config_option *script_config_look_translate_description = NULL; +struct t_config_option *script_config_look_use_keys = NULL; /* script config, color section */ -struct t_config_option *script_config_color_status_autoloaded; -struct t_config_option *script_config_color_status_held; -struct t_config_option *script_config_color_status_installed; -struct t_config_option *script_config_color_status_obsolete; -struct t_config_option *script_config_color_status_popular; -struct t_config_option *script_config_color_status_running; -struct t_config_option *script_config_color_status_unknown; -struct t_config_option *script_config_color_text; -struct t_config_option *script_config_color_text_bg; -struct t_config_option *script_config_color_text_bg_selected; -struct t_config_option *script_config_color_text_date; -struct t_config_option *script_config_color_text_date_selected; -struct t_config_option *script_config_color_text_delimiters; -struct t_config_option *script_config_color_text_description; -struct t_config_option *script_config_color_text_description_selected; -struct t_config_option *script_config_color_text_extension; -struct t_config_option *script_config_color_text_extension_selected; -struct t_config_option *script_config_color_text_name; -struct t_config_option *script_config_color_text_name_selected; -struct t_config_option *script_config_color_text_selected; -struct t_config_option *script_config_color_text_tags; -struct t_config_option *script_config_color_text_tags_selected; -struct t_config_option *script_config_color_text_version; -struct t_config_option *script_config_color_text_version_loaded; -struct t_config_option *script_config_color_text_version_loaded_selected; -struct t_config_option *script_config_color_text_version_selected; +struct t_config_option *script_config_color_status_autoloaded = NULL; +struct t_config_option *script_config_color_status_held = NULL; +struct t_config_option *script_config_color_status_installed = NULL; +struct t_config_option *script_config_color_status_obsolete = NULL; +struct t_config_option *script_config_color_status_popular = NULL; +struct t_config_option *script_config_color_status_running = NULL; +struct t_config_option *script_config_color_status_unknown = NULL; +struct t_config_option *script_config_color_text = NULL; +struct t_config_option *script_config_color_text_bg = NULL; +struct t_config_option *script_config_color_text_bg_selected = NULL; +struct t_config_option *script_config_color_text_date = NULL; +struct t_config_option *script_config_color_text_date_selected = NULL; +struct t_config_option *script_config_color_text_delimiters = NULL; +struct t_config_option *script_config_color_text_description = NULL; +struct t_config_option *script_config_color_text_description_selected = NULL; +struct t_config_option *script_config_color_text_extension = NULL; +struct t_config_option *script_config_color_text_extension_selected = NULL; +struct t_config_option *script_config_color_text_name = NULL; +struct t_config_option *script_config_color_text_name_selected = NULL; +struct t_config_option *script_config_color_text_selected = NULL; +struct t_config_option *script_config_color_text_tags = NULL; +struct t_config_option *script_config_color_text_tags_selected = NULL; +struct t_config_option *script_config_color_text_version = NULL; +struct t_config_option *script_config_color_text_version_loaded = NULL; +struct t_config_option *script_config_color_text_version_loaded_selected = NULL; +struct t_config_option *script_config_color_text_version_selected = NULL; /* script config, scripts section */ -struct t_config_option *script_config_scripts_autoload; -struct t_config_option *script_config_scripts_cache_expire; -struct t_config_option *script_config_scripts_download_enabled; -struct t_config_option *script_config_scripts_download_timeout; -struct t_config_option *script_config_scripts_hold; -struct t_config_option *script_config_scripts_path; -struct t_config_option *script_config_scripts_url; +struct t_config_option *script_config_scripts_autoload = NULL; +struct t_config_option *script_config_scripts_cache_expire = NULL; +struct t_config_option *script_config_scripts_download_enabled = NULL; +struct t_config_option *script_config_scripts_download_timeout = NULL; +struct t_config_option *script_config_scripts_hold = NULL; +struct t_config_option *script_config_scripts_path = NULL; +struct t_config_option *script_config_scripts_url = NULL; /* @@ -418,8 +424,6 @@ script_config_reload (const void *pointer, void *data, int script_config_init () { - struct t_config_section *ptr_section; - script_config_file = weechat_config_new ( SCRIPT_CONFIG_PRIO_NAME, &script_config_reload, NULL, NULL); @@ -427,392 +431,384 @@ script_config_init () return 0; /* look */ - ptr_section = weechat_config_new_section (script_config_file, "look", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (script_config_file); - script_config_file = NULL; - return 0; - } - - script_config_look_columns = weechat_config_new_option ( - script_config_file, ptr_section, - "columns", "string", - N_("format of columns displayed in script buffer: following column " - "identifiers are replaced by their values: %a=author, %d=description, " - "%D=date added, %e=extension, %l=language, %L=license, %n=name with " - "extension, %N=name, %r=requirements, %s=status, %t=tags, " - "%u=date updated, %v=version, %V=version loaded, %w=min_weechat, " - "%W=max_weechat)"), - NULL, 0, 0, "%s %n %V %v %u | %d | %t", NULL, 0, + script_config_section_look = weechat_config_new_section ( + script_config_file, "look", + 0, 0, NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_look_diff_color = weechat_config_new_option ( - script_config_file, ptr_section, - "diff_color", "boolean", - N_("colorize output of diff"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - script_config_look_diff_command = weechat_config_new_option ( - script_config_file, ptr_section, - "diff_command", "string", - N_("command used to show differences between script installed and the " - "new version in repository (\"auto\" = auto detect diff command (git " - "or diff), empty value = disable diff, other string = name of " - "command, for example \"diff\")"), - NULL, 0, 0, "auto", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - script_config_look_display_source = weechat_config_new_option ( - script_config_file, ptr_section, - "display_source", "boolean", - N_("display source code of script on buffer with detail on a script " - "(script is downloaded in a temporary file when detail on script " - "is displayed)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - script_config_look_quiet_actions = weechat_config_new_option ( - script_config_file, ptr_section, - "quiet_actions", "boolean", - N_("quiet actions on script buffer: do not display messages on core " - "buffer when scripts are installed/removed/loaded/unloaded (only " - "errors are displayed)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - script_config_look_sort = weechat_config_new_option ( - script_config_file, ptr_section, - "sort", "string", - N_("default sort keys for scripts: comma-separated list of identifiers: " - "a=author, A=autoloaded, d=date added, e=extension, i=installed, " - "l=language, n=name, o=obsolete, p=popularity, r=running, " - "u=date updated; char \"-\" can be used before identifier to reverse " - "order; example: \"i,u\": installed scripts first, sorted by update " - "date"), - NULL, 0, 0, "i,p,n", NULL, 0, NULL, NULL, NULL, - &script_config_reload_scripts_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_look_translate_description = weechat_config_new_option ( - script_config_file, ptr_section, - "translate_description", "boolean", - N_("translate description of scripts (if translation is available in " - "your language, otherwise English version is used)"), - NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, - &script_config_reload_scripts_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_look_use_keys = weechat_config_new_option ( - script_config_file, ptr_section, - "use_keys", "boolean", - N_("use keys alt+X in script buffer to do actions on scripts (alt+i = " - "install, alt+r = remove, ...); if disabled, only the input is " - "allowed: i, r, ..."), - NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, - &script_config_change_use_keys_cb, NULL, NULL, NULL, NULL, NULL); - - /* color */ - ptr_section = weechat_config_new_section (script_config_file, "color", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (script_config_section_look) { - weechat_config_free (script_config_file); - script_config_file = NULL; - return 0; + script_config_look_columns = weechat_config_new_option ( + script_config_file, script_config_section_look, + "columns", "string", + N_("format of columns displayed in script buffer: following column " + "identifiers are replaced by their values: %a=author, " + "%d=description, %D=date added, %e=extension, %l=language, " + "%L=license, %n=name with extension, %N=name, %r=requirements, " + "%s=status, %t=tags, %u=date updated, %v=version, " + "%V=version loaded, %w=min_weechat, %W=max_weechat)"), + NULL, 0, 0, "%s %n %V %v %u | %d | %t", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_look_diff_color = weechat_config_new_option ( + script_config_file, script_config_section_look, + "diff_color", "boolean", + N_("colorize output of diff"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + script_config_look_diff_command = weechat_config_new_option ( + script_config_file, script_config_section_look, + "diff_command", "string", + N_("command used to show differences between script installed and " + "the new version in repository (\"auto\" = auto detect diff " + "command (git or diff), empty value = disable diff, other " + "string = name of command, for example \"diff\")"), + NULL, 0, 0, "auto", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + script_config_look_display_source = weechat_config_new_option ( + script_config_file, script_config_section_look, + "display_source", "boolean", + N_("display source code of script on buffer with detail on a script " + "(script is downloaded in a temporary file when detail on script " + "is displayed)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + script_config_look_quiet_actions = weechat_config_new_option ( + script_config_file, script_config_section_look, + "quiet_actions", "boolean", + N_("quiet actions on script buffer: do not display messages on core " + "buffer when scripts are installed/removed/loaded/unloaded (only " + "errors are displayed)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + script_config_look_sort = weechat_config_new_option ( + script_config_file, script_config_section_look, + "sort", "string", + N_("default sort keys for scripts: comma-separated list of " + "identifiers: a=author, A=autoloaded, d=date added, e=extension, " + "i=installed, l=language, n=name, o=obsolete, p=popularity, " + "r=running, u=date updated; char \"-\" can be used before " + "identifier to reverse order; example: \"i,u\": installed " + "scripts first, sorted by update date"), + NULL, 0, 0, "i,p,n", NULL, 0, + NULL, NULL, NULL, + &script_config_reload_scripts_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_look_translate_description = weechat_config_new_option ( + script_config_file, script_config_section_look, + "translate_description", "boolean", + N_("translate description of scripts (if translation is available " + "in your language, otherwise English version is used)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &script_config_reload_scripts_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_look_use_keys = weechat_config_new_option ( + script_config_file, script_config_section_look, + "use_keys", "boolean", + N_("use keys alt+X in script buffer to do actions on scripts " + "(alt+i = install, alt+r = remove, ...); if disabled, only the " + "input is allowed: i, r, ..."), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &script_config_change_use_keys_cb, NULL, NULL, + NULL, NULL, NULL); } - script_config_color_status_autoloaded = weechat_config_new_option ( - script_config_file, ptr_section, - "status_autoloaded", "color", - N_("color for status \"autoloaded\" (\"a\")"), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_status_held = weechat_config_new_option ( - script_config_file, ptr_section, - "status_held", "color", - N_("color for status \"held\" (\"H\")"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_status_installed = weechat_config_new_option ( - script_config_file, ptr_section, - "status_installed", "color", - N_("color for status \"installed\" (\"i\")"), - NULL, 0, 0, "lightcyan", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_status_obsolete = weechat_config_new_option ( - script_config_file, ptr_section, - "status_obsolete", "color", - N_("color for status \"obsolete\" (\"N\")"), - NULL, 0, 0, "lightmagenta", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_status_popular = weechat_config_new_option ( - script_config_file, ptr_section, - "status_popular", "color", - N_("color for status \"popular\" (\"*\")"), - NULL, 0, 0, "yellow", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_status_running = weechat_config_new_option ( - script_config_file, ptr_section, - "status_running", "color", - N_("color for status \"running\" (\"r\")"), - NULL, 0, 0, "lightgreen", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_status_unknown = weechat_config_new_option ( - script_config_file, ptr_section, - "status_unknown", "color", - N_("color for status \"unknown\" (\"?\")"), - NULL, 0, 0, "lightred", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text = weechat_config_new_option ( - script_config_file, ptr_section, - "text", "color", - N_("text color in script buffer"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_bg = weechat_config_new_option ( - script_config_file, ptr_section, - "text_bg", "color", - N_("background color in script buffer"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_bg_selected = weechat_config_new_option ( - script_config_file, ptr_section, - "text_bg_selected", "color", - N_("background color for selected line in script buffer"), - NULL, 0, 0, "red", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_date = weechat_config_new_option ( - script_config_file, ptr_section, - "text_date", "color", - N_("text color of dates in script buffer"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_date_selected = weechat_config_new_option ( - script_config_file, ptr_section, - "text_date_selected", "color", - N_("text color of dates for selected line in script buffer"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_delimiters = weechat_config_new_option ( - script_config_file, ptr_section, - "text_delimiters", "color", - N_("text color of delimiters in script buffer"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_description = weechat_config_new_option ( - script_config_file, ptr_section, - "text_description", "color", - N_("text color of description in script buffer"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_description_selected = weechat_config_new_option ( - script_config_file, ptr_section, - "text_description_selected", "color", - N_("text color of description for selected line in script buffer"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_extension = weechat_config_new_option ( - script_config_file, ptr_section, - "text_extension", "color", - N_("text color of extension in script buffer"), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_extension_selected = weechat_config_new_option ( - script_config_file, ptr_section, - "text_extension_selected", "color", - N_("text color of extension for selected line in script buffer"), - NULL, 0, 0, "white", NULL, 0, + /* color */ + script_config_section_color = weechat_config_new_section ( + script_config_file, "color", + 0, 0, NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_name = weechat_config_new_option ( - script_config_file, ptr_section, - "text_name", "color", - N_("text color of script name in script buffer"), - NULL, 0, 0, "cyan", NULL, 0, NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_name_selected = weechat_config_new_option ( - script_config_file, ptr_section, - "text_name_selected", "color", - N_("text color of script name for selected line in script buffer"), - NULL, 0, 0, "lightcyan", NULL, 0, NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_selected = weechat_config_new_option ( - script_config_file, ptr_section, - "text_selected", "color", - N_("text color for selected line in script buffer"), - NULL, 0, 0, "white", NULL, 0, NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, NULL, NULL, NULL); - script_config_color_text_tags = weechat_config_new_option ( - script_config_file, ptr_section, - "text_tags", "color", - N_("text color of tags in script buffer"), - NULL, 0, 0, "brown", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_tags_selected = weechat_config_new_option ( - script_config_file, ptr_section, - "text_tags_selected", "color", - N_("text color of tags for selected line in script buffer"), - NULL, 0, 0, "yellow", NULL, 0, - NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_version = weechat_config_new_option ( - script_config_file, ptr_section, - "text_version", "color", - N_("text color of version in script buffer"), - NULL, 0, 0, "magenta", NULL, 0, + if (script_config_section_color) + { + script_config_color_status_autoloaded = weechat_config_new_option ( + script_config_file, script_config_section_color, + "status_autoloaded", "color", + N_("color for status \"autoloaded\" (\"a\")"), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_status_held = weechat_config_new_option ( + script_config_file, script_config_section_color, + "status_held", "color", + N_("color for status \"held\" (\"H\")"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_status_installed = weechat_config_new_option ( + script_config_file, script_config_section_color, + "status_installed", "color", + N_("color for status \"installed\" (\"i\")"), + NULL, 0, 0, "lightcyan", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_status_obsolete = weechat_config_new_option ( + script_config_file, script_config_section_color, + "status_obsolete", "color", + N_("color for status \"obsolete\" (\"N\")"), + NULL, 0, 0, "lightmagenta", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_status_popular = weechat_config_new_option ( + script_config_file, script_config_section_color, + "status_popular", "color", + N_("color for status \"popular\" (\"*\")"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_status_running = weechat_config_new_option ( + script_config_file, script_config_section_color, + "status_running", "color", + N_("color for status \"running\" (\"r\")"), + NULL, 0, 0, "lightgreen", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_status_unknown = weechat_config_new_option ( + script_config_file, script_config_section_color, + "status_unknown", "color", + N_("color for status \"unknown\" (\"?\")"), + NULL, 0, 0, "lightred", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text", "color", + N_("text color in script buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_bg = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_bg", "color", + N_("background color in script buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_bg_selected = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_bg_selected", "color", + N_("background color for selected line in script buffer"), + NULL, 0, 0, "red", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_date = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_date", "color", + N_("text color of dates in script buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_date_selected = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_date_selected", "color", + N_("text color of dates for selected line in script buffer"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_delimiters = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_delimiters", "color", + N_("text color of delimiters in script buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_description = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_description", "color", + N_("text color of description in script buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_description_selected = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_description_selected", "color", + N_("text color of description for selected line in script buffer"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_extension = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_extension", "color", + N_("text color of extension in script buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_extension_selected = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_extension_selected", "color", + N_("text color of extension for selected line in script buffer"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_name = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_name", "color", + N_("text color of script name in script buffer"), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_name_selected = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_name_selected", "color", + N_("text color of script name for selected line in script buffer"), + NULL, 0, 0, "lightcyan", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_selected = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_selected", "color", + N_("text color for selected line in script buffer"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_tags = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_tags", "color", + N_("text color of tags in script buffer"), + NULL, 0, 0, "brown", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_tags_selected = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_tags_selected", "color", + N_("text color of tags for selected line in script buffer"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_version = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_version", "color", + N_("text color of version in script buffer"), + NULL, 0, 0, "magenta", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_version_loaded = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_version_loaded", "color", + N_("text color of version loaded in script buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_version_loaded_selected = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_version_loaded_selected", "color", + N_("text color of version loaded for selected line in script buffer"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_color_text_version_selected = weechat_config_new_option ( + script_config_file, script_config_section_color, + "text_version_selected", "color", + N_("text color of version for selected line in script buffer"), + NULL, 0, 0, "lightmagenta", NULL, 0, + NULL, NULL, NULL, + &script_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + } + + /* scripts */ + script_config_section_scripts = weechat_config_new_section ( + script_config_file, "scripts", + 0, 0, NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_version_loaded = weechat_config_new_option ( - script_config_file, ptr_section, - "text_version_loaded", "color", - N_("text color of version loaded in script buffer"), - NULL, 0, 0, "default", NULL, 0, NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_version_loaded_selected = weechat_config_new_option ( - script_config_file, ptr_section, - "text_version_loaded_selected", "color", - N_("text color of version loaded for selected line in script buffer"), - NULL, 0, 0, "white", NULL, 0, NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_color_text_version_selected = weechat_config_new_option ( - script_config_file, ptr_section, - "text_version_selected", "color", - N_("text color of version for selected line in script buffer"), - NULL, 0, 0, "lightmagenta", NULL, 0, NULL, NULL, NULL, - &script_config_refresh_cb, NULL, NULL, NULL, NULL, NULL); - - /* scripts */ - ptr_section = weechat_config_new_section (script_config_file, "scripts", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (script_config_section_scripts) { - weechat_config_free (script_config_file); - script_config_file = NULL; - return 0; + script_config_scripts_autoload = weechat_config_new_option ( + script_config_file, script_config_section_scripts, + "autoload", "boolean", + N_("autoload scripts installed (make a link in \"autoload\" directory " + "to script in parent directory)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + script_config_scripts_cache_expire = weechat_config_new_option ( + script_config_file, script_config_section_scripts, + "cache_expire", "integer", + N_("local cache expiration time, in minutes (-1 = never expires, " + "0 = always expire)"), + NULL, -1, 525600, "1440", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + script_config_scripts_download_enabled = weechat_config_new_option ( + script_config_file, script_config_section_scripts, + "download_enabled", "boolean", + N_("enable download of files from the scripts repository when the " + "/script command is used (list of scripts and scripts " + "themselves); the list of scripts is downloaded from the URL " + "specified in the option script.scripts.url; WeeChat will " + "sometimes download again the list of scripts when you use the " + "/script command, even if you don't install a script"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + script_config_scripts_download_timeout = weechat_config_new_option ( + script_config_file, script_config_section_scripts, + "download_timeout", "integer", + N_("timeout (in seconds) for download of scripts and list of " + "scripts"), + NULL, 1, 3600, "30", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + script_config_scripts_hold = weechat_config_new_option ( + script_config_file, script_config_section_scripts, + "hold", "string", + N_("scripts to \"hold\": comma-separated list of scripts which " + "will never been upgraded and can not be removed, for example: " + "\"go.py,urlserver.py\""), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, + &script_config_change_hold_cb, NULL, NULL, + NULL, NULL, NULL); + script_config_scripts_path = weechat_config_new_option ( + script_config_file, script_config_section_scripts, + "path", "string", + N_("local cache directory for scripts " + "(path is evaluated, see function string_eval_path_home in " + "plugin API reference)"), + NULL, 0, 0, "${weechat_cache_dir}/script", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + script_config_scripts_url = weechat_config_new_option ( + script_config_file, script_config_section_scripts, + "url", "string", + N_("URL for file with list of scripts"), + NULL, 0, 0, "https://weechat.org/files/plugins.xml.gz", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - script_config_scripts_autoload = weechat_config_new_option ( - script_config_file, ptr_section, - "autoload", "boolean", - N_("autoload scripts installed (make a link in \"autoload\" directory " - "to script in parent directory)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - script_config_scripts_cache_expire = weechat_config_new_option ( - script_config_file, ptr_section, - "cache_expire", "integer", - N_("local cache expiration time, in minutes (-1 = never expires, " - "0 = always expire)"), - NULL, -1, 525600, "1440", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - script_config_scripts_download_enabled = weechat_config_new_option ( - script_config_file, ptr_section, - "download_enabled", "boolean", - N_("enable download of files from the scripts repository when the " - "/script command is used (list of scripts and scripts themselves); " - "the list of scripts is downloaded from the URL specified in the " - "option script.scripts.url; WeeChat will sometimes download again " - "the list of scripts when you use the /script command, even if " - "you don't install a script"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - script_config_scripts_download_timeout = weechat_config_new_option ( - script_config_file, ptr_section, - "download_timeout", "integer", - N_("timeout (in seconds) for download of scripts and list of scripts"), - NULL, 1, 3600, "30", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - script_config_scripts_hold = weechat_config_new_option ( - script_config_file, ptr_section, - "hold", "string", - N_("scripts to \"hold\": comma-separated list of scripts which will " - "never been upgraded and can not be removed, for example: " - "\"go.py,urlserver.py\""), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, - &script_config_change_hold_cb, NULL, NULL, - NULL, NULL, NULL); - script_config_scripts_path = weechat_config_new_option ( - script_config_file, ptr_section, - "path", "string", - N_("local cache directory for scripts " - "(path is evaluated, see function string_eval_path_home in " - "plugin API reference)"), - NULL, 0, 0, "${weechat_cache_dir}/script", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - script_config_scripts_url = weechat_config_new_option ( - script_config_file, ptr_section, - "url", "string", - N_("URL for file with list of scripts"), - NULL, 0, 0, "https://weechat.org/files/plugins.xml.gz", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - return 1; } diff --git a/src/plugins/spell/spell-config.c b/src/plugins/spell/spell-config.c index c31ef3bf7..9bab0dfcb 100644 --- a/src/plugins/spell/spell-config.c +++ b/src/plugins/spell/spell-config.c @@ -31,33 +31,39 @@ struct t_config_file *spell_config_file = NULL; -struct t_config_section *spell_config_section_dict = NULL; -int spell_config_loading = 0; +/* sections */ + +struct t_config_section *spell_config_section_color = NULL; +struct t_config_section *spell_config_section_check = NULL; +struct t_config_section *spell_config_section_dict = NULL; +struct t_config_section *spell_config_section_look = NULL; +struct t_config_section *spell_config_section_option = NULL; /* spell config, color section */ -struct t_config_option *spell_config_color_misspelled; -struct t_config_option *spell_config_color_suggestion; -struct t_config_option *spell_config_color_suggestion_delimiter_dict; -struct t_config_option *spell_config_color_suggestion_delimiter_word; +struct t_config_option *spell_config_color_misspelled = NULL; +struct t_config_option *spell_config_color_suggestion = NULL; +struct t_config_option *spell_config_color_suggestion_delimiter_dict = NULL; +struct t_config_option *spell_config_color_suggestion_delimiter_word = NULL; /* spell config, check section */ -struct t_config_option *spell_config_check_commands; -struct t_config_option *spell_config_check_default_dict; -struct t_config_option *spell_config_check_during_search; -struct t_config_option *spell_config_check_enabled; -struct t_config_option *spell_config_check_real_time; -struct t_config_option *spell_config_check_suggestions; -struct t_config_option *spell_config_check_word_min_length; +struct t_config_option *spell_config_check_commands = NULL; +struct t_config_option *spell_config_check_default_dict = NULL; +struct t_config_option *spell_config_check_during_search = NULL; +struct t_config_option *spell_config_check_enabled = NULL; +struct t_config_option *spell_config_check_real_time = NULL; +struct t_config_option *spell_config_check_suggestions = NULL; +struct t_config_option *spell_config_check_word_min_length = NULL; /* spell config, look section */ -struct t_config_option *spell_config_look_suggestion_delimiter_dict; -struct t_config_option *spell_config_look_suggestion_delimiter_word; +struct t_config_option *spell_config_look_suggestion_delimiter_dict = NULL; +struct t_config_option *spell_config_look_suggestion_delimiter_word = NULL; +int spell_config_loading = 0; char **spell_commands_to_check = NULL; int spell_count_commands_to_check = 0; int *spell_length_commands_to_check = NULL; @@ -439,15 +445,13 @@ spell_config_set_dict (const char *name, const char *value) int spell_config_init () { - struct t_config_section *ptr_section; - spell_config_file = weechat_config_new (SPELL_CONFIG_PRIO_NAME, NULL, NULL, NULL); if (!spell_config_file) return 0; /* color */ - ptr_section = weechat_config_new_section ( + spell_config_section_color = weechat_config_new_section ( spell_config_file, "color", 0, 0, NULL, NULL, NULL, @@ -455,43 +459,39 @@ spell_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) + if (spell_config_section_color) { - weechat_config_free (spell_config_file); - spell_config_file = NULL; - return 0; + spell_config_color_misspelled = weechat_config_new_option ( + spell_config_file, spell_config_section_color, + "misspelled", "color", + N_("text color for misspelled words (input bar)"), + NULL, 0, 0, "lightred", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + spell_config_color_suggestion = weechat_config_new_option ( + spell_config_file, spell_config_section_color, + "suggestion", "color", + N_("text color for suggestion on a misspelled word in bar item " + "\"spell_suggest\""), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + spell_config_color_suggestion_delimiter_dict = weechat_config_new_option ( + spell_config_file, spell_config_section_color, + "suggestion_delimiter_dict", "color", + N_("text color for delimiters displayed between two dictionaries " + "in bar item \"spell_suggest\""), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + spell_config_color_suggestion_delimiter_word = weechat_config_new_option ( + spell_config_file, spell_config_section_color, + "suggestion_delimiter_word", "color", + N_("text color for delimiters displayed between two words in bar " + "item \"spell_suggest\""), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - spell_config_color_misspelled = weechat_config_new_option ( - spell_config_file, ptr_section, - "misspelled", "color", - N_("text color for misspelled words (input bar)"), - NULL, 0, 0, "lightred", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - spell_config_color_suggestion = weechat_config_new_option ( - spell_config_file, ptr_section, - "suggestion", "color", - N_("text color for suggestion on a misspelled word in bar item " - "\"spell_suggest\""), - NULL, 0, 0, "default", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - spell_config_color_suggestion_delimiter_dict = weechat_config_new_option ( - spell_config_file, ptr_section, - "suggestion_delimiter_dict", "color", - N_("text color for delimiters displayed between two dictionaries " - "in bar item \"spell_suggest\""), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - spell_config_color_suggestion_delimiter_word = weechat_config_new_option ( - spell_config_file, ptr_section, - "suggestion_delimiter_word", "color", - N_("text color for delimiters displayed between two words in bar item " - "\"spell_suggest\""), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - /* check */ - ptr_section = weechat_config_new_section ( + spell_config_section_check = weechat_config_new_section ( spell_config_file, "check", 0, 0, NULL, NULL, NULL, @@ -499,76 +499,72 @@ spell_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) + if (spell_config_section_check) { - weechat_config_free (spell_config_file); - spell_config_file = NULL; - return 0; + spell_config_check_commands = weechat_config_new_option ( + spell_config_file, spell_config_section_check, + "commands", "string", + N_("comma separated list of commands for which spell checking is " + "enabled (spell checking is disabled for all other commands)"), + NULL, 0, 0, + "away,command,cycle,kick,kickban,me,msg,notice,part,query," + "quit,topic", NULL, 0, + NULL, NULL, NULL, + &spell_config_change_commands, NULL, NULL, + NULL, NULL, NULL); + spell_config_check_default_dict = weechat_config_new_option ( + spell_config_file, spell_config_section_check, + "default_dict", "string", + N_("default dictionary (or comma separated list of dictionaries) to " + "use when buffer has no dictionary defined (leave blank to " + "disable spell checker on buffers for which you didn't " + "explicitly enabled it)"), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, + &spell_config_change_default_dict, NULL, NULL, + NULL, NULL, NULL); + spell_config_check_during_search = weechat_config_new_option ( + spell_config_file, spell_config_section_check, + "during_search", "boolean", + N_("check words during text search in buffer"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + spell_config_check_enabled = weechat_config_new_option ( + spell_config_file, spell_config_section_check, + "enabled", "boolean", + N_("enable spell checker for command line"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &spell_config_change_enabled, NULL, NULL, + NULL, NULL, NULL); + spell_config_check_real_time = weechat_config_new_option ( + spell_config_file, spell_config_section_check, + "real_time", "boolean", + N_("real-time spell checking of words (slower, disabled by default: " + "words are checked only if there's delimiter after)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + spell_config_check_suggestions = weechat_config_new_option ( + spell_config_file, spell_config_section_check, + "suggestions", "integer", + N_("number of suggestions to display in bar item \"spell_suggest\" " + "for each dictionary set in buffer (-1 = disable suggestions, " + "0 = display all possible suggestions in all languages)"), + NULL, -1, INT_MAX, "-1", NULL, 0, + NULL, NULL, NULL, + &spell_config_change_suggestions, NULL, NULL, + NULL, NULL, NULL); + spell_config_check_word_min_length = weechat_config_new_option ( + spell_config_file, spell_config_section_check, + "word_min_length", "integer", + N_("minimum length for a word to be spell checked (use 0 to check " + "all words)"), + NULL, 0, INT_MAX, "2", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - spell_config_check_commands = weechat_config_new_option ( - spell_config_file, ptr_section, - "commands", "string", - N_("comma separated list of commands for which spell checking is " - "enabled (spell checking is disabled for all other commands)"), - NULL, 0, 0, - "away,command,cycle,kick,kickban,me,msg,notice,part,query," - "quit,topic", NULL, 0, - NULL, NULL, NULL, - &spell_config_change_commands, NULL, NULL, - NULL, NULL, NULL); - spell_config_check_default_dict = weechat_config_new_option ( - spell_config_file, ptr_section, - "default_dict", "string", - N_("default dictionary (or comma separated list of dictionaries) to " - "use when buffer has no dictionary defined (leave blank to disable " - "spell checker on buffers for which you didn't explicitly " - "enabled it)"), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, - &spell_config_change_default_dict, NULL, NULL, - NULL, NULL, NULL); - spell_config_check_during_search = weechat_config_new_option ( - spell_config_file, ptr_section, - "during_search", "boolean", - N_("check words during text search in buffer"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - spell_config_check_enabled = weechat_config_new_option ( - spell_config_file, ptr_section, - "enabled", "boolean", - N_("enable spell checker for command line"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, - &spell_config_change_enabled, NULL, NULL, - NULL, NULL, NULL); - spell_config_check_real_time = weechat_config_new_option ( - spell_config_file, ptr_section, - "real_time", "boolean", - N_("real-time spell checking of words (slower, disabled by default: " - "words are checked only if there's delimiter after)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - spell_config_check_suggestions = weechat_config_new_option ( - spell_config_file, ptr_section, - "suggestions", "integer", - N_("number of suggestions to display in bar item \"spell_suggest\" " - "for each dictionary set in buffer (-1 = disable suggestions, " - "0 = display all possible suggestions in all languages)"), - NULL, -1, INT_MAX, "-1", NULL, 0, - NULL, NULL, NULL, - &spell_config_change_suggestions, NULL, NULL, - NULL, NULL, NULL); - spell_config_check_word_min_length = weechat_config_new_option ( - spell_config_file, ptr_section, - "word_min_length", "integer", - N_("minimum length for a word to be spell checked (use 0 to check all " - "words)"), - NULL, 0, INT_MAX, "2", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - /* dict */ - ptr_section = weechat_config_new_section ( + spell_config_section_dict = weechat_config_new_section ( spell_config_file, "dict", 1, 1, NULL, NULL, NULL, @@ -576,17 +572,9 @@ spell_config_init () NULL, NULL, NULL, &spell_config_dict_create_option, NULL, NULL, &spell_config_dict_delete_option, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (spell_config_file); - spell_config_file = NULL; - return 0; - } - - spell_config_section_dict = ptr_section; /* look */ - ptr_section = weechat_config_new_section ( + spell_config_section_look = weechat_config_new_section ( spell_config_file, "look", 0, 0, NULL, NULL, NULL, @@ -594,34 +582,30 @@ spell_config_init () NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) + if (spell_config_section_look) { - weechat_config_free (spell_config_file); - spell_config_file = NULL; - return 0; + spell_config_look_suggestion_delimiter_dict = weechat_config_new_option ( + spell_config_file, spell_config_section_look, + "suggestion_delimiter_dict", "string", + N_("delimiter displayed between two dictionaries in bar item " + "\"spell_suggest\""), + NULL, 0, 0, " / ", NULL, 0, + NULL, NULL, NULL, + &spell_config_change_suggestions, NULL, NULL, + NULL, NULL, NULL); + spell_config_look_suggestion_delimiter_word = weechat_config_new_option ( + spell_config_file, spell_config_section_look, + "suggestion_delimiter_word", "string", + N_("delimiter displayed between two words in bar item " + "\"spell_suggest\""), + NULL, 0, 0, ",", NULL, 0, + NULL, NULL, NULL, + &spell_config_change_suggestions, NULL, NULL, + NULL, NULL, NULL); } - spell_config_look_suggestion_delimiter_dict = weechat_config_new_option ( - spell_config_file, ptr_section, - "suggestion_delimiter_dict", "string", - N_("delimiter displayed between two dictionaries in bar item " - "\"spell_suggest\""), - NULL, 0, 0, " / ", NULL, 0, - NULL, NULL, NULL, - &spell_config_change_suggestions, NULL, NULL, - NULL, NULL, NULL); - spell_config_look_suggestion_delimiter_word = weechat_config_new_option ( - spell_config_file, ptr_section, - "suggestion_delimiter_word", "string", - N_("delimiter displayed between two words in bar item " - "\"spell_suggest\""), - NULL, 0, 0, ",", NULL, 0, - NULL, NULL, NULL, - &spell_config_change_suggestions, NULL, NULL, - NULL, NULL, NULL); - /* option */ - ptr_section = weechat_config_new_section ( + spell_config_section_option = weechat_config_new_section ( spell_config_file, "option", 1, 1, NULL, NULL, NULL, @@ -629,12 +613,6 @@ spell_config_init () NULL, NULL, NULL, &spell_config_option_create_option, NULL, NULL, &spell_config_option_delete_option, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (spell_config_file); - spell_config_file = NULL; - return 0; - } return 1; } diff --git a/src/plugins/trigger/trigger-config.c b/src/plugins/trigger/trigger-config.c index 001d7b958..ec25b0b3f 100644 --- a/src/plugins/trigger/trigger-config.c +++ b/src/plugins/trigger/trigger-config.c @@ -29,25 +29,30 @@ struct t_config_file *trigger_config_file = NULL; + +/* sections */ + +struct t_config_section *trigger_config_section_look = NULL; +struct t_config_section *trigger_config_section_color = NULL; struct t_config_section *trigger_config_section_trigger = NULL; /* trigger config, look section */ -struct t_config_option *trigger_config_look_enabled; -struct t_config_option *trigger_config_look_monitor_strip_colors; +struct t_config_option *trigger_config_look_enabled = NULL; +struct t_config_option *trigger_config_look_monitor_strip_colors = NULL; /* trigger config, color section */ -struct t_config_option *trigger_config_color_flag_command; -struct t_config_option *trigger_config_color_flag_conditions; -struct t_config_option *trigger_config_color_flag_regex; -struct t_config_option *trigger_config_color_flag_return_code; -struct t_config_option *trigger_config_color_flag_post_action; -struct t_config_option *trigger_config_color_identifier; -struct t_config_option *trigger_config_color_regex; -struct t_config_option *trigger_config_color_replace; -struct t_config_option *trigger_config_color_trigger; -struct t_config_option *trigger_config_color_trigger_disabled; +struct t_config_option *trigger_config_color_flag_command = NULL; +struct t_config_option *trigger_config_color_flag_conditions = NULL; +struct t_config_option *trigger_config_color_flag_regex = NULL; +struct t_config_option *trigger_config_color_flag_return_code = NULL; +struct t_config_option *trigger_config_color_flag_post_action = NULL; +struct t_config_option *trigger_config_color_identifier = NULL; +struct t_config_option *trigger_config_color_regex = NULL; +struct t_config_option *trigger_config_color_replace = NULL; +struct t_config_option *trigger_config_color_trigger = NULL; +struct t_config_option *trigger_config_color_trigger_disabled = NULL; char *trigger_config_default_list[][1 + TRIGGER_NUM_OPTIONS] = { @@ -683,8 +688,6 @@ trigger_config_reload_cb (const void *pointer, void *data, int trigger_config_init () { - struct t_config_section *ptr_section; - trigger_config_file = weechat_config_new ( TRIGGER_CONFIG_PRIO_NAME, &trigger_config_reload_cb, NULL, NULL); @@ -692,113 +695,107 @@ trigger_config_init () return 0; /* look */ - ptr_section = weechat_config_new_section (trigger_config_file, "look", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + trigger_config_section_look = weechat_config_new_section ( + trigger_config_file, "look", + 0, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + if (trigger_config_section_look) { - weechat_config_free (trigger_config_file); - trigger_config_file = NULL; - return 0; + trigger_config_look_enabled = weechat_config_new_option ( + trigger_config_file, trigger_config_section_look, + "enabled", "boolean", + N_("enable trigger support"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, + &trigger_config_change_enabled, NULL, NULL, + NULL, NULL, NULL); + trigger_config_look_monitor_strip_colors = weechat_config_new_option ( + trigger_config_file, trigger_config_section_look, + "monitor_strip_colors", "boolean", + N_("strip colors in hashtable values displayed on monitor buffer"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - trigger_config_look_enabled = weechat_config_new_option ( - trigger_config_file, ptr_section, - "enabled", "boolean", - N_("enable trigger support"), - NULL, 0, 0, "on", NULL, 0, + /* color */ + trigger_config_section_color = weechat_config_new_section ( + trigger_config_file, "color", + 0, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, - &trigger_config_change_enabled, NULL, NULL, NULL, NULL, NULL); - trigger_config_look_monitor_strip_colors = weechat_config_new_option ( - trigger_config_file, ptr_section, - "monitor_strip_colors", "boolean", - N_("strip colors in hashtable values displayed on monitor buffer"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - /* color */ - ptr_section = weechat_config_new_section (trigger_config_file, "color", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (trigger_config_section_color) { - weechat_config_free (trigger_config_file); - trigger_config_file = NULL; - return 0; + trigger_config_color_flag_command = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "flag_command", "color", + N_("text color for command flag (in /trigger list)"), + NULL, 0, 0, "lightgreen", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_flag_conditions = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "flag_conditions", "color", + N_("text color for conditions flag (in /trigger list)"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_flag_regex = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "flag_regex", "color", + N_("text color for regex flag (in /trigger list)"), + NULL, 0, 0, "lightcyan", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_flag_return_code = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "flag_return_code", "color", + N_("text color for return code flag (in /trigger list)"), + NULL, 0, 0, "lightmagenta", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_flag_post_action = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "flag_post_action", "color", + N_("text color for post action flag (in /trigger list)"), + NULL, 0, 0, "lightblue", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_identifier = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "identifier", "color", + N_("text color for trigger context identifier in monitor buffer"), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_regex = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "regex", "color", + N_("text color for regular expressions"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_replace = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "replace", "color", + N_("text color for replacement text (for regular expressions)"), + NULL, 0, 0, "cyan", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_trigger = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "trigger", "color", + N_("text color for trigger name"), + NULL, 0, 0, "green", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + trigger_config_color_trigger_disabled = weechat_config_new_option ( + trigger_config_file, trigger_config_section_color, + "trigger_disabled", "color", + N_("text color for disabled trigger name"), + NULL, 0, 0, "red", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - trigger_config_color_flag_command = weechat_config_new_option ( - trigger_config_file, ptr_section, - "flag_command", "color", - N_("text color for command flag (in /trigger list)"), - NULL, 0, 0, "lightgreen", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - trigger_config_color_flag_conditions = weechat_config_new_option ( - trigger_config_file, ptr_section, - "flag_conditions", "color", - N_("text color for conditions flag (in /trigger list)"), - NULL, 0, 0, "yellow", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - trigger_config_color_flag_regex = weechat_config_new_option ( - trigger_config_file, ptr_section, - "flag_regex", "color", - N_("text color for regex flag (in /trigger list)"), - NULL, 0, 0, "lightcyan", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - trigger_config_color_flag_return_code = weechat_config_new_option ( - trigger_config_file, ptr_section, - "flag_return_code", "color", - N_("text color for return code flag (in /trigger list)"), - NULL, 0, 0, "lightmagenta", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - trigger_config_color_flag_post_action = weechat_config_new_option ( - trigger_config_file, ptr_section, - "flag_post_action", "color", - N_("text color for post action flag (in /trigger list)"), - NULL, 0, 0, "lightblue", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - trigger_config_color_identifier = weechat_config_new_option ( - trigger_config_file, ptr_section, - "identifier", "color", - N_("text color for trigger context identifier in monitor buffer"), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - trigger_config_color_regex = weechat_config_new_option ( - trigger_config_file, ptr_section, - "regex", "color", - N_("text color for regular expressions"), - NULL, 0, 0, "white", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - trigger_config_color_replace = weechat_config_new_option ( - trigger_config_file, ptr_section, - "replace", "color", - N_("text color for replacement text (for regular expressions)"), - NULL, 0, 0, "cyan", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - trigger_config_color_trigger = weechat_config_new_option ( - trigger_config_file, ptr_section, - "trigger", "color", - N_("text color for trigger name"), - NULL, 0, 0, "green", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - trigger_config_color_trigger_disabled = weechat_config_new_option ( - trigger_config_file, ptr_section, - "trigger_disabled", "color", - N_("text color for disabled trigger name"), - NULL, 0, 0, "red", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - /* trigger */ - ptr_section = weechat_config_new_section ( + trigger_config_section_trigger = weechat_config_new_section ( trigger_config_file, TRIGGER_CONFIG_SECTION_TRIGGER, 0, 0, @@ -807,14 +804,6 @@ trigger_config_init () &trigger_config_trigger_write_default_cb, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (trigger_config_file); - trigger_config_file = NULL; - return 0; - } - - trigger_config_section_trigger = ptr_section; return 1; } diff --git a/src/plugins/trigger/trigger-config.h b/src/plugins/trigger/trigger-config.h index f4653af1d..096ce9afb 100644 --- a/src/plugins/trigger/trigger-config.h +++ b/src/plugins/trigger/trigger-config.h @@ -25,6 +25,9 @@ #define TRIGGER_CONFIG_SECTION_TRIGGER "trigger" extern struct t_config_file *trigger_config_file; + +extern struct t_config_section *trigger_config_section_look; +extern struct t_config_section *trigger_config_section_color; extern struct t_config_section *trigger_config_section_trigger; extern struct t_config_option *trigger_config_look_enabled; diff --git a/src/plugins/typing/typing-config.c b/src/plugins/typing/typing-config.c index 04785e99a..6b2b79b98 100644 --- a/src/plugins/typing/typing-config.c +++ b/src/plugins/typing/typing-config.c @@ -31,18 +31,20 @@ struct t_config_file *typing_config_file = NULL; -struct t_config_section *typing_config_section_cmd = NULL; -struct t_config_section *typing_config_section_completion = NULL; + +/* sections */ + +struct t_config_section *typing_config_section_look = NULL; /* typing config, look section */ -struct t_config_option *typing_config_look_delay_purge_paused; -struct t_config_option *typing_config_look_delay_purge_typing; -struct t_config_option *typing_config_look_delay_set_paused; -struct t_config_option *typing_config_look_enabled_nicks; -struct t_config_option *typing_config_look_enabled_self; -struct t_config_option *typing_config_look_input_min_chars; -struct t_config_option *typing_config_look_item_max_length; +struct t_config_option *typing_config_look_delay_purge_paused = NULL; +struct t_config_option *typing_config_look_delay_purge_typing = NULL; +struct t_config_option *typing_config_look_delay_set_paused = NULL; +struct t_config_option *typing_config_look_enabled_nicks = NULL; +struct t_config_option *typing_config_look_enabled_self = NULL; +struct t_config_option *typing_config_look_input_min_chars = NULL; +struct t_config_option *typing_config_look_item_max_length = NULL; /* @@ -110,8 +112,6 @@ typing_config_change_item_max_length (const void *pointer, void *data, int typing_config_init () { - struct t_config_section *ptr_section; - typing_config_file = weechat_config_new ( TYPING_CONFIG_PRIO_NAME, &typing_config_reload, NULL, NULL); @@ -119,73 +119,73 @@ typing_config_init () return 0; /* look */ - ptr_section = weechat_config_new_section (typing_config_file, "look", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (typing_config_file); - typing_config_file = NULL; - return 0; - } - - typing_config_look_delay_purge_paused = weechat_config_new_option ( - typing_config_file, ptr_section, - "delay_purge_paused", "integer", - N_("number of seconds after paused status has been set: if reached, " - "the typing status is removed"), - NULL, 1, INT_MAX, "30", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - typing_config_look_delay_purge_typing = weechat_config_new_option ( - typing_config_file, ptr_section, - "delay_purge_typing", "integer", - N_("number of seconds after typing status has been set: if reached, " - "the typing status is removed"), - NULL, 1, INT_MAX, "6", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - typing_config_look_delay_set_paused = weechat_config_new_option ( - typing_config_file, ptr_section, - "delay_set_paused", "integer", - N_("number of seconds after typing last char: if reached, the typing " - "status becomes \"paused\" and no more typing signals are sent"), - NULL, 1, INT_MAX, "10", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - typing_config_look_enabled_nicks = weechat_config_new_option ( - typing_config_file, ptr_section, - "enabled_nicks", "boolean", - N_("typing enabled for other nicks (display typing info for nicks " - "typing in the current buffer)"), - NULL, 0, 0, "off", NULL, 0, + typing_config_section_look = weechat_config_new_section ( + typing_config_file, "look", + 0, 0, + NULL, NULL, NULL, NULL, NULL, NULL, - &typing_config_change_enabled, NULL, NULL, - NULL, NULL, NULL); - typing_config_look_enabled_self = weechat_config_new_option ( - typing_config_file, ptr_section, - "enabled_self", "boolean", - N_("typing enabled for self messages (send typing info to other users)"), - NULL, 0, 0, "off", NULL, 0, NULL, NULL, NULL, - &typing_config_change_enabled, NULL, NULL, - NULL, NULL, NULL); - typing_config_look_input_min_chars = weechat_config_new_option ( - typing_config_file, ptr_section, - "input_min_chars", "integer", - N_("min number of chars in message to trigger send of typing signals"), - NULL, 1, INT_MAX, "4", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - typing_config_look_item_max_length = weechat_config_new_option ( - typing_config_file, ptr_section, - "item_max_length", "integer", - N_("max number of chars displayed in the bar item \"typing\" " - "(0 = do not truncate content)"), - NULL, 0, INT_MAX, "0", NULL, 0, NULL, NULL, NULL, - &typing_config_change_item_max_length, NULL, NULL, NULL, NULL, NULL); + if (typing_config_section_look) + { + typing_config_look_delay_purge_paused = weechat_config_new_option ( + typing_config_file, typing_config_section_look, + "delay_purge_paused", "integer", + N_("number of seconds after paused status has been set: if reached, " + "the typing status is removed"), + NULL, 1, INT_MAX, "30", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + typing_config_look_delay_purge_typing = weechat_config_new_option ( + typing_config_file, typing_config_section_look, + "delay_purge_typing", "integer", + N_("number of seconds after typing status has been set: if reached, " + "the typing status is removed"), + NULL, 1, INT_MAX, "6", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + typing_config_look_delay_set_paused = weechat_config_new_option ( + typing_config_file, typing_config_section_look, + "delay_set_paused", "integer", + N_("number of seconds after typing last char: if reached, the " + "typing status becomes \"paused\" and no more typing signals " + "are sent"), + NULL, 1, INT_MAX, "10", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + typing_config_look_enabled_nicks = weechat_config_new_option ( + typing_config_file, typing_config_section_look, + "enabled_nicks", "boolean", + N_("typing enabled for other nicks (display typing info for nicks " + "typing in the current buffer)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &typing_config_change_enabled, NULL, NULL, + NULL, NULL, NULL); + typing_config_look_enabled_self = weechat_config_new_option ( + typing_config_file, typing_config_section_look, + "enabled_self", "boolean", + N_("typing enabled for self messages (send typing info to other " + "users)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, + &typing_config_change_enabled, NULL, NULL, + NULL, NULL, NULL); + typing_config_look_input_min_chars = weechat_config_new_option ( + typing_config_file, typing_config_section_look, + "input_min_chars", "integer", + N_("min number of chars in message to trigger send of typing " + "signals"), + NULL, 1, INT_MAX, "4", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + typing_config_look_item_max_length = weechat_config_new_option ( + typing_config_file, typing_config_section_look, + "item_max_length", "integer", + N_("max number of chars displayed in the bar item \"typing\" " + "(0 = do not truncate content)"), + NULL, 0, INT_MAX, "0", NULL, 0, + NULL, NULL, NULL, + &typing_config_change_item_max_length, NULL, NULL, + NULL, NULL, NULL); + } return 1; } diff --git a/src/plugins/xfer/xfer-config.c b/src/plugins/xfer/xfer-config.c index ae92ffa38..5d8d27eda 100644 --- a/src/plugins/xfer/xfer-config.c +++ b/src/plugins/xfer/xfer-config.c @@ -30,43 +30,52 @@ struct t_config_file *xfer_config_file = NULL; +/* sections */ + +struct t_config_section *xfer_config_section_look = NULL; +struct t_config_section *xfer_config_section_color = NULL; +struct t_config_section *xfer_config_section_network = NULL; +struct t_config_section *xfer_config_section_file = NULL; + /* xfer config, look section */ -struct t_config_option *xfer_config_look_auto_open_buffer; -struct t_config_option *xfer_config_look_progress_bar_size; -struct t_config_option *xfer_config_look_pv_tags; +struct t_config_option *xfer_config_look_auto_open_buffer = NULL; +struct t_config_option *xfer_config_look_progress_bar_size = NULL; +struct t_config_option *xfer_config_look_pv_tags = NULL; /* xfer config, color section */ -struct t_config_option *xfer_config_color_status[XFER_NUM_STATUS]; -struct t_config_option *xfer_config_color_text; -struct t_config_option *xfer_config_color_text_bg; -struct t_config_option *xfer_config_color_text_selected; +struct t_config_option *xfer_config_color_status[XFER_NUM_STATUS] = { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +}; +struct t_config_option *xfer_config_color_text = NULL; +struct t_config_option *xfer_config_color_text_bg = NULL; +struct t_config_option *xfer_config_color_text_selected = NULL; /* xfer config, network section */ -struct t_config_option *xfer_config_network_blocksize; -struct t_config_option *xfer_config_network_fast_send; -struct t_config_option *xfer_config_network_own_ip; -struct t_config_option *xfer_config_network_port_range; -struct t_config_option *xfer_config_network_send_ack; -struct t_config_option *xfer_config_network_speed_limit_recv; -struct t_config_option *xfer_config_network_speed_limit_send; -struct t_config_option *xfer_config_network_timeout; +struct t_config_option *xfer_config_network_blocksize = NULL; +struct t_config_option *xfer_config_network_fast_send = NULL; +struct t_config_option *xfer_config_network_own_ip = NULL; +struct t_config_option *xfer_config_network_port_range = NULL; +struct t_config_option *xfer_config_network_send_ack = NULL; +struct t_config_option *xfer_config_network_speed_limit_recv = NULL; +struct t_config_option *xfer_config_network_speed_limit_send = NULL; +struct t_config_option *xfer_config_network_timeout = NULL; /* xfer config, file section */ -struct t_config_option *xfer_config_file_auto_accept_chats; -struct t_config_option *xfer_config_file_auto_accept_files; -struct t_config_option *xfer_config_file_auto_accept_nicks; -struct t_config_option *xfer_config_file_auto_check_crc32; -struct t_config_option *xfer_config_file_auto_rename; -struct t_config_option *xfer_config_file_auto_resume; -struct t_config_option *xfer_config_file_convert_spaces; -struct t_config_option *xfer_config_file_download_path; -struct t_config_option *xfer_config_file_download_temporary_suffix; -struct t_config_option *xfer_config_file_upload_path; -struct t_config_option *xfer_config_file_use_nick_in_filename; +struct t_config_option *xfer_config_file_auto_accept_chats = NULL; +struct t_config_option *xfer_config_file_auto_accept_files = NULL; +struct t_config_option *xfer_config_file_auto_accept_nicks = NULL; +struct t_config_option *xfer_config_file_auto_check_crc32 = NULL; +struct t_config_option *xfer_config_file_auto_rename = NULL; +struct t_config_option *xfer_config_file_auto_resume = NULL; +struct t_config_option *xfer_config_file_convert_spaces = NULL; +struct t_config_option *xfer_config_file_download_path = NULL; +struct t_config_option *xfer_config_file_download_temporary_suffix = NULL; +struct t_config_option *xfer_config_file_upload_path = NULL; +struct t_config_option *xfer_config_file_use_nick_in_filename = NULL; /* @@ -112,303 +121,295 @@ xfer_config_reload (const void *pointer, void *data, int xfer_config_init () { - struct t_config_section *ptr_section; - xfer_config_file = weechat_config_new (XFER_CONFIG_PRIO_NAME, &xfer_config_reload, NULL, NULL); if (!xfer_config_file) return 0; - ptr_section = weechat_config_new_section (xfer_config_file, "look", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) - { - weechat_config_free (xfer_config_file); - xfer_config_file = NULL; - return 0; - } - - xfer_config_look_auto_open_buffer = weechat_config_new_option ( - xfer_config_file, ptr_section, - "auto_open_buffer", "boolean", - N_("auto open xfer buffer when a new xfer is added " - "to list"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_look_progress_bar_size = weechat_config_new_option ( - xfer_config_file, ptr_section, - "progress_bar_size", "integer", - N_("size of progress bar, in chars (if 0, progress bar is disabled)"), - NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL, 0, + xfer_config_section_look = weechat_config_new_section ( + xfer_config_file, "look", + 0, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, NULL, NULL, NULL); - xfer_config_look_pv_tags = weechat_config_new_option ( - xfer_config_file, ptr_section, - "pv_tags", "string", - N_("comma separated list of tags used in private messages, for example: " - "\"notify_message\", \"notify_private\" or \"notify_highlight\""), - NULL, 0, 0, "notify_private", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - ptr_section = weechat_config_new_section (xfer_config_file, "color", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (xfer_config_section_look) { - weechat_config_free (xfer_config_file); - xfer_config_file = NULL; - return 0; + xfer_config_look_auto_open_buffer = weechat_config_new_option ( + xfer_config_file, xfer_config_section_look, + "auto_open_buffer", "boolean", + N_("auto open xfer buffer when a new xfer is added " + "to list"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_look_progress_bar_size = weechat_config_new_option ( + xfer_config_file, xfer_config_section_look, + "progress_bar_size", "integer", + N_("size of progress bar, in chars (if 0, progress bar is " + "disabled)"), + NULL, 0, XFER_CONFIG_PROGRESS_BAR_MAX_SIZE, "20", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + xfer_config_look_pv_tags = weechat_config_new_option ( + xfer_config_file, xfer_config_section_look, + "pv_tags", "string", + N_("comma separated list of tags used in private messages, for " + "example: \"notify_message\", \"notify_private\" or " + "\"notify_highlight\""), + NULL, 0, 0, "notify_private", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - xfer_config_color_status[XFER_STATUS_ABORTED] = weechat_config_new_option ( - xfer_config_file, ptr_section, - "status_aborted", "color", - N_("text color for \"aborted\" status"), - NULL, 0, 0, "lightred", NULL, 0, - NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - xfer_config_color_status[XFER_STATUS_ACTIVE] = weechat_config_new_option ( - xfer_config_file, ptr_section, - "status_active", "color", - N_("text color for \"active\" status"), - NULL, 0, 0, "lightblue", NULL, 0, + xfer_config_section_color = weechat_config_new_section ( + xfer_config_file, "color", + 0, 0, NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - xfer_config_color_status[XFER_STATUS_CONNECTING] = weechat_config_new_option ( - xfer_config_file, ptr_section, - "status_connecting", "color", - N_("text color for \"connecting\" status"), - NULL, 0, 0, "yellow", NULL, 0, NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - xfer_config_color_status[XFER_STATUS_DONE] = weechat_config_new_option ( - xfer_config_file, ptr_section, - "status_done", "color", - N_("text color for \"done\" status"), - NULL, 0, 0, "lightgreen", NULL, 0, NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - xfer_config_color_status[XFER_STATUS_FAILED] = weechat_config_new_option ( - xfer_config_file, ptr_section, - "status_failed", "color", - N_("text color for \"failed\" status"), - NULL, 0, 0, "lightred", NULL, 0, NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, NULL, NULL, NULL); - xfer_config_color_status[XFER_STATUS_WAITING] = weechat_config_new_option ( - xfer_config_file, ptr_section, - "status_waiting", "color", - N_("text color for \"waiting\" status"), - NULL, 0, 0, "lightcyan", NULL, 0, + if (xfer_config_section_color) + { + xfer_config_color_status[XFER_STATUS_ABORTED] = weechat_config_new_option ( + xfer_config_file, xfer_config_section_color, + "status_aborted", "color", + N_("text color for \"aborted\" status"), + NULL, 0, 0, "lightred", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + xfer_config_color_status[XFER_STATUS_ACTIVE] = weechat_config_new_option ( + xfer_config_file, xfer_config_section_color, + "status_active", "color", + N_("text color for \"active\" status"), + NULL, 0, 0, "lightblue", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + xfer_config_color_status[XFER_STATUS_CONNECTING] = weechat_config_new_option ( + xfer_config_file, xfer_config_section_color, + "status_connecting", "color", + N_("text color for \"connecting\" status"), + NULL, 0, 0, "yellow", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + xfer_config_color_status[XFER_STATUS_DONE] = weechat_config_new_option ( + xfer_config_file, xfer_config_section_color, + "status_done", "color", + N_("text color for \"done\" status"), + NULL, 0, 0, "lightgreen", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + xfer_config_color_status[XFER_STATUS_FAILED] = weechat_config_new_option ( + xfer_config_file, xfer_config_section_color, + "status_failed", "color", + N_("text color for \"failed\" status"), + NULL, 0, 0, "lightred", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + xfer_config_color_status[XFER_STATUS_WAITING] = weechat_config_new_option ( + xfer_config_file, xfer_config_section_color, + "status_waiting", "color", + N_("text color for \"waiting\" status"), + NULL, 0, 0, "lightcyan", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + xfer_config_color_text = weechat_config_new_option ( + xfer_config_file, xfer_config_section_color, + "text", "color", + N_("text color in xfer buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + xfer_config_color_text_bg = weechat_config_new_option ( + xfer_config_file, xfer_config_section_color, + "text_bg", "color", + N_("background color in xfer buffer"), + NULL, 0, 0, "default", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + xfer_config_color_text_selected = weechat_config_new_option ( + xfer_config_file, xfer_config_section_color, + "text_selected", "color", + N_("text color of selected line in xfer buffer"), + NULL, 0, 0, "white", NULL, 0, + NULL, NULL, NULL, + &xfer_config_refresh_cb, NULL, NULL, + NULL, NULL, NULL); + } + + xfer_config_section_network = weechat_config_new_section ( + xfer_config_file, "network", + 0, 0, NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - xfer_config_color_text = weechat_config_new_option ( - xfer_config_file, ptr_section, - "text", "color", - N_("text color in xfer buffer"), - NULL, 0, 0, "default", NULL, 0, NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - xfer_config_color_text_bg = weechat_config_new_option ( - xfer_config_file, ptr_section, - "text_bg", "color", - N_("background color in xfer buffer"), - NULL, 0, 0, "default", NULL, 0, NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, - NULL, NULL, NULL); - xfer_config_color_text_selected = weechat_config_new_option ( - xfer_config_file, ptr_section, - "text_selected", "color", - N_("text color of selected line in xfer buffer"), - NULL, 0, 0, "white", NULL, 0, NULL, NULL, NULL, - &xfer_config_refresh_cb, NULL, NULL, NULL, NULL, NULL); - - ptr_section = weechat_config_new_section (xfer_config_file, "network", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + if (xfer_config_section_network) { - weechat_config_free (xfer_config_file); - xfer_config_file = NULL; - return 0; + xfer_config_network_blocksize = weechat_config_new_option ( + xfer_config_file, xfer_config_section_network, + "blocksize", "integer", + N_("block size for sending packets, in bytes"), + NULL, XFER_BLOCKSIZE_MIN, XFER_BLOCKSIZE_MAX, "65536", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_network_fast_send = weechat_config_new_option ( + xfer_config_file, xfer_config_section_network, + "fast_send", "boolean", + N_("does not wait for ACK when sending file"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_network_own_ip = weechat_config_new_option ( + xfer_config_file, xfer_config_section_network, + "own_ip", "string", + N_("IP or DNS address used for sending files/chats " + "(if empty, local interface IP is used)"), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_network_port_range = weechat_config_new_option ( + xfer_config_file, xfer_config_section_network, + "port_range", "string", + N_("restricts outgoing files/chats to use only ports in the given " + "range (useful for NAT) (syntax: a single port, ie. 5000 or a " + "port range, ie. 5000-5015, empty value means any port, it's " + "recommended to use ports greater than 1024, because only root " + "can use ports below 1024)"), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_network_send_ack = weechat_config_new_option ( + xfer_config_file, xfer_config_section_network, + "send_ack", "boolean", + N_("send acks when receiving files; if disabled, the transfer may " + "freeze if the sender is waiting for acks (for example a " + "WeeChat sending a file with option xfer.network.fast_send set " + "to off); on the other hand, disabling send of acks may prevent " + "a freeze if the acks are not sent immediately to the sender"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_network_speed_limit_recv = weechat_config_new_option ( + xfer_config_file, xfer_config_section_network, + "speed_limit_recv", "integer", + N_("speed limit for receiving files, in kilo-bytes by second (0 " + "means no limit)"), + NULL, 0, INT_MAX, "0", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_network_speed_limit_send = weechat_config_new_option ( + xfer_config_file, xfer_config_section_network, + "speed_limit_send", "integer", + N_("speed limit for sending files, in kilo-bytes by second (0 means " + "no limit)"), + NULL, 0, INT_MAX, "0", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_network_timeout = weechat_config_new_option ( + xfer_config_file, xfer_config_section_network, + "timeout", "integer", + N_("timeout for xfer request (in seconds)"), + NULL, 5, INT_MAX, "300", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - xfer_config_network_blocksize = weechat_config_new_option ( - xfer_config_file, ptr_section, - "blocksize", "integer", - N_("block size for sending packets, in bytes"), - NULL, XFER_BLOCKSIZE_MIN, XFER_BLOCKSIZE_MAX, "65536", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_network_fast_send = weechat_config_new_option ( - xfer_config_file, ptr_section, - "fast_send", "boolean", - N_("does not wait for ACK when sending file"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_network_own_ip = weechat_config_new_option ( - xfer_config_file, ptr_section, - "own_ip", "string", - N_("IP or DNS address used for sending files/chats " - "(if empty, local interface IP is used)"), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_network_port_range = weechat_config_new_option ( - xfer_config_file, ptr_section, - "port_range", "string", - N_("restricts outgoing files/chats to use only ports in the given " - "range (useful for NAT) (syntax: a single port, ie. 5000 or a port " - "range, ie. 5000-5015, empty value means any port, it's recommended " - "to use ports greater than 1024, because only root can use ports " - "below 1024)"), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_network_send_ack = weechat_config_new_option ( - xfer_config_file, ptr_section, - "send_ack", "boolean", - N_("send acks when receiving files; if disabled, the transfer may " - "freeze if the sender is waiting for acks (for example a WeeChat " - "sending a file with option xfer.network.fast_send set to off); " - "on the other hand, disabling send of acks may prevent a freeze if " - "the acks are not sent immediately to the sender"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_network_speed_limit_recv = weechat_config_new_option ( - xfer_config_file, ptr_section, - "speed_limit_recv", "integer", - N_("speed limit for receiving files, in kilo-bytes by second (0 means " - "no limit)"), - NULL, 0, INT_MAX, "0", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_network_speed_limit_send = weechat_config_new_option ( - xfer_config_file, ptr_section, - "speed_limit_send", "integer", - N_("speed limit for sending files, in kilo-bytes by second (0 means " - "no limit)"), - NULL, 0, INT_MAX, "0", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_network_timeout = weechat_config_new_option ( - xfer_config_file, ptr_section, - "timeout", "integer", - N_("timeout for xfer request (in seconds)"), - NULL, 5, INT_MAX, "300", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - ptr_section = weechat_config_new_section (xfer_config_file, "file", - 0, 0, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL); - if (!ptr_section) + xfer_config_section_file = weechat_config_new_section ( + xfer_config_file, "file", + 0, 0, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL, + NULL, NULL, NULL); + if (xfer_config_section_file) { - weechat_config_free (xfer_config_file); - xfer_config_file = NULL; - return 0; + xfer_config_file_auto_accept_chats = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "auto_accept_chats", "boolean", + N_("automatically accept chat requests (use carefully!)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_auto_accept_files = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "auto_accept_files", "boolean", + N_("automatically accept incoming files (use carefully!)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_auto_accept_nicks = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "auto_accept_nicks", "string", + N_("comma-separated list of nicks for which the incoming files and " + "chats are automatically accepted; format is \"server.nick\" " + "(for a specific server) or \"nick\" (for all servers); " + "example: \"libera.FlashCode,andrew\""), + NULL, 0, 0, "", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_auto_check_crc32 = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "auto_check_crc32", "boolean", + N_("automatically check CRC32 file checksum if it is found in the " + "filename (8 hexadecimal chars)"), + NULL, 0, 0, "off", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_auto_rename = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "auto_rename", "boolean", + N_("rename incoming files if already exists (add \".1\", \".2\", " + "...)"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_auto_resume = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "auto_resume", "boolean", + N_("automatically resume file transfer if connection with remote " + "host is lost"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_convert_spaces = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "convert_spaces", "boolean", + N_("convert spaces to underscores when sending and receiving " + "files"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_download_path = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "download_path", "string", + N_("path for writing incoming files " + "(path is evaluated, see function string_eval_path_home in " + "plugin API reference)"), + NULL, 0, 0, "${weechat_data_dir}/xfer", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_download_temporary_suffix = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "download_temporary_suffix", "string", + N_("temporary filename suffix used during the transfer for a file " + "received, it is removed after successful transfer; " + "if empty string, no filename suffix is used during the " + "transfer"), + NULL, 0, 0, ".part", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_upload_path = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "upload_path", "string", + N_("path for reading files when sending " + "(path is evaluated, see function string_eval_path_home in " + "plugin API reference)"), + NULL, 0, 0, "~", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + xfer_config_file_use_nick_in_filename = weechat_config_new_option ( + xfer_config_file, xfer_config_section_file, + "use_nick_in_filename", "boolean", + N_("use remote nick as prefix in local filename when receiving a " + "file"), + NULL, 0, 0, "on", NULL, 0, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); } - xfer_config_file_auto_accept_chats = weechat_config_new_option ( - xfer_config_file, ptr_section, - "auto_accept_chats", "boolean", - N_("automatically accept chat requests (use carefully!)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_auto_accept_files = weechat_config_new_option ( - xfer_config_file, ptr_section, - "auto_accept_files", "boolean", - N_("automatically accept incoming files (use carefully!)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_auto_accept_nicks = weechat_config_new_option ( - xfer_config_file, ptr_section, - "auto_accept_nicks", "string", - N_("comma-separated list of nicks for which the incoming files and " - "chats are automatically accepted; format is \"server.nick\" (for a " - "specific server) or \"nick\" (for all servers); example: " - "\"libera.FlashCode,andrew\""), - NULL, 0, 0, "", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_auto_check_crc32 = weechat_config_new_option ( - xfer_config_file, ptr_section, - "auto_check_crc32", "boolean", - N_("automatically check CRC32 file checksum if it is found in the " - "filename (8 hexadecimal chars)"), - NULL, 0, 0, "off", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_auto_rename = weechat_config_new_option ( - xfer_config_file, ptr_section, - "auto_rename", "boolean", - N_("rename incoming files if already exists (add \".1\", \".2\", ...)"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_auto_resume = weechat_config_new_option ( - xfer_config_file, ptr_section, - "auto_resume", "boolean", - N_("automatically resume file transfer if connection with remote host " - "is lost"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_convert_spaces = weechat_config_new_option ( - xfer_config_file, ptr_section, - "convert_spaces", "boolean", - N_("convert spaces to underscores when sending and receiving files"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_download_path = weechat_config_new_option ( - xfer_config_file, ptr_section, - "download_path", "string", - N_("path for writing incoming files " - "(path is evaluated, see function string_eval_path_home in " - "plugin API reference)"), - NULL, 0, 0, "${weechat_data_dir}/xfer", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_download_temporary_suffix = weechat_config_new_option ( - xfer_config_file, ptr_section, - "download_temporary_suffix", "string", - N_("temporary filename suffix used during the transfer for a file " - "received, it is removed after successful transfer; " - "if empty string, no filename suffix is used during the transfer"), - NULL, 0, 0, ".part", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_upload_path = weechat_config_new_option ( - xfer_config_file, ptr_section, - "upload_path", "string", - N_("path for reading files when sending " - "(path is evaluated, see function string_eval_path_home in " - "plugin API reference)"), - NULL, 0, 0, "~", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - xfer_config_file_use_nick_in_filename = weechat_config_new_option ( - xfer_config_file, ptr_section, - "use_nick_in_filename", "boolean", - N_("use remote nick as prefix in local filename when receiving a file"), - NULL, 0, 0, "on", NULL, 0, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - return 1; } |