1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 21:36:37 +02:00

core, plugins: set options to NULL by default, refactor config init functions

This commit is contained in:
Sébastien Helleu
2023-04-01 20:56:11 +02:00
parent 3e9524ee65
commit 4aabe8681f
18 changed files with 6152 additions and 6345 deletions
+2223 -2282
View File
File diff suppressed because it is too large Load Diff
+50 -57
View File
@@ -40,6 +40,9 @@
struct t_config_file *secure_config_file = NULL;
struct t_config_section *secure_config_section_crypt = NULL;
struct t_config_section *secure_config_section_data = NULL;
struct t_config_option *secure_config_crypt_cipher = NULL;
struct t_config_option *secure_config_crypt_hash_algo = NULL;
struct t_config_option *secure_config_crypt_passphrase_command = NULL;
@@ -444,68 +447,64 @@ secure_config_data_write_cb (const void *pointer, void *data,
int
secure_config_init_options ()
{
struct t_config_section *ptr_section;
secure_config_file = config_file_new (NULL, SECURE_CONFIG_PRIO_NAME,
&secure_config_reload_cb, NULL, NULL);
if (!secure_config_file)
return 0;
/* crypt */
ptr_section = config_file_new_section (secure_config_file, "crypt",
0, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (secure_config_file);
secure_config_file = NULL;
return 0;
}
secure_config_crypt_cipher = config_file_new_option (
secure_config_file, ptr_section,
"cipher", "integer",
N_("cipher used to crypt data (the number after algorithm is the size "
"of the key in bits)"),
"aes128|aes192|aes256", 0, 0, "aes256", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
secure_config_crypt_hash_algo = config_file_new_option (
secure_config_file, ptr_section,
"hash_algo", "integer",
N_("hash algorithm used to check the decrypted data"),
"sha224|sha256|sha384|sha512", 0, 0, "sha256", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
secure_config_crypt_passphrase_command = config_file_new_option (
secure_config_file, ptr_section,
"passphrase_command", "string",
N_("read the passphrase from the output of this system command "
"(only the first line is used and it must not contain any extra "
"character); this option is used only when reading file sec.conf "
"and if the environment variable \"WEECHAT_PASSPHRASE\" is not set "
"(the environment variable has higher priority); "
"example with password-store: "
"\"/usr/bin/pass show weechat/passphrase\""),
NULL, 0, 0, "", NULL, 0,
secure_config_section_crypt = config_file_new_section (
secure_config_file, "crypt",
0, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
secure_config_crypt_salt = config_file_new_option (
secure_config_file, ptr_section,
"salt", "boolean",
N_("use salt when generating key used in encryption (recommended for "
"maximum security); when enabled, the content of crypted data in "
"file sec.conf will be different on each write of the file; if you "
"put the file sec.conf in a version control system, then you "
"can turn off this option to have always same content in file"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
if (secure_config_section_crypt)
{
secure_config_crypt_cipher = config_file_new_option (
secure_config_file, secure_config_section_crypt,
"cipher", "integer",
N_("cipher used to crypt data (the number after algorithm is the "
"size of the key in bits)"),
"aes128|aes192|aes256", 0, 0, "aes256", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
secure_config_crypt_hash_algo = config_file_new_option (
secure_config_file, secure_config_section_crypt,
"hash_algo", "integer",
N_("hash algorithm used to check the decrypted data"),
"sha224|sha256|sha384|sha512", 0, 0, "sha256", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
secure_config_crypt_passphrase_command = config_file_new_option (
secure_config_file, secure_config_section_crypt,
"passphrase_command", "string",
N_("read the passphrase from the output of this system command "
"(only the first line is used and it must not contain any extra "
"character); this option is used only when reading file "
"sec.conf and if the environment variable \"WEECHAT_PASSPHRASE\" "
"is not set (the environment variable has higher priority); "
"example with password-store: "
"\"/usr/bin/pass show weechat/passphrase\""),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
secure_config_crypt_salt = config_file_new_option (
secure_config_file, secure_config_section_crypt,
"salt", "boolean",
N_("use salt when generating key used in encryption (recommended "
"for maximum security); when enabled, the content of crypted "
"data in file sec.conf will be different on each write of the "
"file; if you put the file sec.conf in a version control system, "
"then you can turn off this option to have always same content "
"in file"),
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
/* data */
ptr_section = config_file_new_section (
secure_config_section_data = config_file_new_section (
secure_config_file, "data",
0, 0,
&secure_config_data_read_cb, NULL, NULL,
@@ -513,12 +512,6 @@ secure_config_init_options ()
&secure_config_data_write_cb, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (secure_config_file);
secure_config_file = NULL;
return 0;
}
return 1;
}
+10 -21
View File
@@ -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;
}
+339 -338
View File
@@ -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,325 +480,321 @@ 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)
buflist_config_section_look = 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 (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_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,
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)
buflist_config_section_format = 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 (buflist_config_section_format)
{
weechat_config_free (buflist_config_file);
buflist_config_file = NULL;
return 0;
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);
}
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,
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);
return 1;
}
+69 -71
View File
@@ -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,
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)
exec_config_section_color = 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 (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;
}
+34 -35
View File
@@ -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,48 +89,43 @@ 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)
fifo_config_section_file = 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 (fifo_config_section_file)
{
weechat_config_free (fifo_config_file);
fifo_config_file = NULL;
return 0;
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);
}
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,
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);
return 1;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+226 -246
View File
@@ -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)
logger_config_section_file = 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 (logger_config_section_file)
{
weechat_config_free (logger_config_file);
logger_config_file = NULL;
return 0;
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);
}
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,
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);
/* 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;
}
-5
View File
@@ -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;
}
}
/*
+19 -22
View File
@@ -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;
}
+406 -427
View File
@@ -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)
relay_config_section_look = 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 (relay_config_section_look)
{
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, 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);
}
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)
relay_config_section_color = 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 (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_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,
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,
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)
relay_config_section_network = 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 (relay_config_section_network)
{
weechat_config_free (relay_config_file);
relay_config_file = NULL;
return 0;
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);
}
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,
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,
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)
{
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, 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,
relay_config_section_irc = 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);
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);
if (relay_config_section_irc)
{
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);
}
/* 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;
}
+414 -418
View File
@@ -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,391 +431,383 @@ 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)
script_config_section_look = 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 (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_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,
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)
script_config_section_color = 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 (script_config_section_color)
{
weechat_config_free (script_config_file);
script_config_file = NULL;
return 0;
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);
}
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,
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,
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)
{
weechat_config_free (script_config_file);
script_config_file = NULL;
return 0;
}
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,
script_config_section_scripts = weechat_config_new_section (
script_config_file, "scripts",
0, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
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);
if (script_config_section_scripts)
{
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);
}
return 1;
}
+134 -156
View File
@@ -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;
}
+110 -121
View File
@@ -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)
{
weechat_config_free (trigger_config_file);
trigger_config_file = NULL;
return 0;
}
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,
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,
&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);
if (trigger_config_section_look)
{
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);
}
/* 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)
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,
NULL, NULL, NULL);
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;
}
+3
View File
@@ -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;
+76 -76
View File
@@ -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,74 +119,74 @@ 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)
typing_config_section_look = 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 (typing_config_section_look)
{
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, 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);
}
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,
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);
return 1;
}
+300 -299
View File
@@ -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)
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,
NULL, NULL, NULL);
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_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_color = weechat_config_new_section (
xfer_config_file, "color",
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_color)
{
weechat_config_free (xfer_config_file);
xfer_config_file = NULL;
return 0;
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_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,
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_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,
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,
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;
}