summaryrefslogtreecommitdiff
path: root/src/plugins/buflist
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-04-01 20:56:11 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-04-01 20:56:11 +0200
commit4aabe8681fd88dbb412b8ac69805d92713ca2ecc (patch)
treeeb79f8b87fa008601ca7d2fa1138b958ba7f55d5 /src/plugins/buflist
parent3e9524ee656568ec4164b083bc9e847e91a35392 (diff)
downloadweechat-4aabe8681fd88dbb412b8ac69805d92713ca2ecc.zip
core, plugins: set options to NULL by default, refactor config init functions
Diffstat (limited to 'src/plugins/buflist')
-rw-r--r--src/plugins/buflist/buflist-config.c663
1 files changed, 332 insertions, 331 deletions
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;
}