summaryrefslogtreecommitdiff
path: root/src/plugins/script
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-04-01 20:56:11 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-04-01 20:56:11 +0200
commit4aabe8681fd88dbb412b8ac69805d92713ca2ecc (patch)
treeeb79f8b87fa008601ca7d2fa1138b958ba7f55d5 /src/plugins/script
parent3e9524ee656568ec4164b083bc9e847e91a35392 (diff)
downloadweechat-4aabe8681fd88dbb412b8ac69805d92713ca2ecc.zip
core, plugins: set options to NULL by default, refactor config init functions
Diffstat (limited to 'src/plugins/script')
-rw-r--r--src/plugins/script/script-config.c812
1 files changed, 404 insertions, 408 deletions
diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c
index ea9e9290f..cf7c16961 100644
--- a/src/plugins/script/script-config.c
+++ b/src/plugins/script/script-config.c
@@ -35,55 +35,61 @@
struct t_config_file *script_config_file = NULL;
+/* sections */
+
+struct t_config_section *script_config_section_look = NULL;
+struct t_config_section *script_config_section_color = NULL;
+struct t_config_section *script_config_section_scripts = NULL;
+
/* script config, look section */
-struct t_config_option *script_config_look_columns;
-struct t_config_option *script_config_look_diff_color;
-struct t_config_option *script_config_look_diff_command;
-struct t_config_option *script_config_look_display_source;
-struct t_config_option *script_config_look_quiet_actions;
-struct t_config_option *script_config_look_sort;
-struct t_config_option *script_config_look_translate_description;
-struct t_config_option *script_config_look_use_keys;
+struct t_config_option *script_config_look_columns = NULL;
+struct t_config_option *script_config_look_diff_color = NULL;
+struct t_config_option *script_config_look_diff_command = NULL;
+struct t_config_option *script_config_look_display_source = NULL;
+struct t_config_option *script_config_look_quiet_actions = NULL;
+struct t_config_option *script_config_look_sort = NULL;
+struct t_config_option *script_config_look_translate_description = NULL;
+struct t_config_option *script_config_look_use_keys = NULL;
/* script config, color section */
-struct t_config_option *script_config_color_status_autoloaded;
-struct t_config_option *script_config_color_status_held;
-struct t_config_option *script_config_color_status_installed;
-struct t_config_option *script_config_color_status_obsolete;
-struct t_config_option *script_config_color_status_popular;
-struct t_config_option *script_config_color_status_running;
-struct t_config_option *script_config_color_status_unknown;
-struct t_config_option *script_config_color_text;
-struct t_config_option *script_config_color_text_bg;
-struct t_config_option *script_config_color_text_bg_selected;
-struct t_config_option *script_config_color_text_date;
-struct t_config_option *script_config_color_text_date_selected;
-struct t_config_option *script_config_color_text_delimiters;
-struct t_config_option *script_config_color_text_description;
-struct t_config_option *script_config_color_text_description_selected;
-struct t_config_option *script_config_color_text_extension;
-struct t_config_option *script_config_color_text_extension_selected;
-struct t_config_option *script_config_color_text_name;
-struct t_config_option *script_config_color_text_name_selected;
-struct t_config_option *script_config_color_text_selected;
-struct t_config_option *script_config_color_text_tags;
-struct t_config_option *script_config_color_text_tags_selected;
-struct t_config_option *script_config_color_text_version;
-struct t_config_option *script_config_color_text_version_loaded;
-struct t_config_option *script_config_color_text_version_loaded_selected;
-struct t_config_option *script_config_color_text_version_selected;
+struct t_config_option *script_config_color_status_autoloaded = NULL;
+struct t_config_option *script_config_color_status_held = NULL;
+struct t_config_option *script_config_color_status_installed = NULL;
+struct t_config_option *script_config_color_status_obsolete = NULL;
+struct t_config_option *script_config_color_status_popular = NULL;
+struct t_config_option *script_config_color_status_running = NULL;
+struct t_config_option *script_config_color_status_unknown = NULL;
+struct t_config_option *script_config_color_text = NULL;
+struct t_config_option *script_config_color_text_bg = NULL;
+struct t_config_option *script_config_color_text_bg_selected = NULL;
+struct t_config_option *script_config_color_text_date = NULL;
+struct t_config_option *script_config_color_text_date_selected = NULL;
+struct t_config_option *script_config_color_text_delimiters = NULL;
+struct t_config_option *script_config_color_text_description = NULL;
+struct t_config_option *script_config_color_text_description_selected = NULL;
+struct t_config_option *script_config_color_text_extension = NULL;
+struct t_config_option *script_config_color_text_extension_selected = NULL;
+struct t_config_option *script_config_color_text_name = NULL;
+struct t_config_option *script_config_color_text_name_selected = NULL;
+struct t_config_option *script_config_color_text_selected = NULL;
+struct t_config_option *script_config_color_text_tags = NULL;
+struct t_config_option *script_config_color_text_tags_selected = NULL;
+struct t_config_option *script_config_color_text_version = NULL;
+struct t_config_option *script_config_color_text_version_loaded = NULL;
+struct t_config_option *script_config_color_text_version_loaded_selected = NULL;
+struct t_config_option *script_config_color_text_version_selected = NULL;
/* script config, scripts section */
-struct t_config_option *script_config_scripts_autoload;
-struct t_config_option *script_config_scripts_cache_expire;
-struct t_config_option *script_config_scripts_download_enabled;
-struct t_config_option *script_config_scripts_download_timeout;
-struct t_config_option *script_config_scripts_hold;
-struct t_config_option *script_config_scripts_path;
-struct t_config_option *script_config_scripts_url;
+struct t_config_option *script_config_scripts_autoload = NULL;
+struct t_config_option *script_config_scripts_cache_expire = NULL;
+struct t_config_option *script_config_scripts_download_enabled = NULL;
+struct t_config_option *script_config_scripts_download_timeout = NULL;
+struct t_config_option *script_config_scripts_hold = NULL;
+struct t_config_option *script_config_scripts_path = NULL;
+struct t_config_option *script_config_scripts_url = NULL;
/*
@@ -418,8 +424,6 @@ script_config_reload (const void *pointer, void *data,
int
script_config_init ()
{
- struct t_config_section *ptr_section;
-
script_config_file = weechat_config_new (
SCRIPT_CONFIG_PRIO_NAME,
&script_config_reload, NULL, NULL);
@@ -427,392 +431,384 @@ script_config_init ()
return 0;
/* look */
- ptr_section = weechat_config_new_section (script_config_file, "look",
- 0, 0,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL);
- if (!ptr_section)
- {
- weechat_config_free (script_config_file);
- script_config_file = NULL;
- return 0;
- }
-
- script_config_look_columns = weechat_config_new_option (
- script_config_file, ptr_section,
- "columns", "string",
- N_("format of columns displayed in script buffer: following column "
- "identifiers are replaced by their values: %a=author, %d=description, "
- "%D=date added, %e=extension, %l=language, %L=license, %n=name with "
- "extension, %N=name, %r=requirements, %s=status, %t=tags, "
- "%u=date updated, %v=version, %V=version loaded, %w=min_weechat, "
- "%W=max_weechat)"),
- NULL, 0, 0, "%s %n %V %v %u | %d | %t", NULL, 0,
+ script_config_section_look = weechat_config_new_section (
+ script_config_file, "look",
+ 0, 0,
NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_look_diff_color = weechat_config_new_option (
- script_config_file, ptr_section,
- "diff_color", "boolean",
- N_("colorize output of diff"),
- NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- script_config_look_diff_command = weechat_config_new_option (
- script_config_file, ptr_section,
- "diff_command", "string",
- N_("command used to show differences between script installed and the "
- "new version in repository (\"auto\" = auto detect diff command (git "
- "or diff), empty value = disable diff, other string = name of "
- "command, for example \"diff\")"),
- NULL, 0, 0, "auto", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- script_config_look_display_source = weechat_config_new_option (
- script_config_file, ptr_section,
- "display_source", "boolean",
- N_("display source code of script on buffer with detail on a script "
- "(script is downloaded in a temporary file when detail on script "
- "is displayed)"),
- NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- script_config_look_quiet_actions = weechat_config_new_option (
- script_config_file, ptr_section,
- "quiet_actions", "boolean",
- N_("quiet actions on script buffer: do not display messages on core "
- "buffer when scripts are installed/removed/loaded/unloaded (only "
- "errors are displayed)"),
- NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- script_config_look_sort = weechat_config_new_option (
- script_config_file, ptr_section,
- "sort", "string",
- N_("default sort keys for scripts: comma-separated list of identifiers: "
- "a=author, A=autoloaded, d=date added, e=extension, i=installed, "
- "l=language, n=name, o=obsolete, p=popularity, r=running, "
- "u=date updated; char \"-\" can be used before identifier to reverse "
- "order; example: \"i,u\": installed scripts first, sorted by update "
- "date"),
- NULL, 0, 0, "i,p,n", NULL, 0,
NULL, NULL, NULL,
- &script_config_reload_scripts_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_look_translate_description = weechat_config_new_option (
- script_config_file, ptr_section,
- "translate_description", "boolean",
- N_("translate description of scripts (if translation is available in "
- "your language, otherwise English version is used)"),
- NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL,
- &script_config_reload_scripts_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_look_use_keys = weechat_config_new_option (
- script_config_file, ptr_section,
- "use_keys", "boolean",
- N_("use keys alt+X in script buffer to do actions on scripts (alt+i = "
- "install, alt+r = remove, ...); if disabled, only the input is "
- "allowed: i, r, ..."),
- NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL,
- &script_config_change_use_keys_cb, NULL, NULL,
NULL, NULL, NULL);
-
- /* color */
- ptr_section = weechat_config_new_section (script_config_file, "color",
- 0, 0,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL);
- if (!ptr_section)
+ if (script_config_section_look)
{
- weechat_config_free (script_config_file);
- script_config_file = NULL;
- return 0;
+ script_config_look_columns = weechat_config_new_option (
+ script_config_file, script_config_section_look,
+ "columns", "string",
+ N_("format of columns displayed in script buffer: following column "
+ "identifiers are replaced by their values: %a=author, "
+ "%d=description, %D=date added, %e=extension, %l=language, "
+ "%L=license, %n=name with extension, %N=name, %r=requirements, "
+ "%s=status, %t=tags, %u=date updated, %v=version, "
+ "%V=version loaded, %w=min_weechat, %W=max_weechat)"),
+ NULL, 0, 0, "%s %n %V %v %u | %d | %t", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_look_diff_color = weechat_config_new_option (
+ script_config_file, script_config_section_look,
+ "diff_color", "boolean",
+ N_("colorize output of diff"),
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_look_diff_command = weechat_config_new_option (
+ script_config_file, script_config_section_look,
+ "diff_command", "string",
+ N_("command used to show differences between script installed and "
+ "the new version in repository (\"auto\" = auto detect diff "
+ "command (git or diff), empty value = disable diff, other "
+ "string = name of command, for example \"diff\")"),
+ NULL, 0, 0, "auto", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_look_display_source = weechat_config_new_option (
+ script_config_file, script_config_section_look,
+ "display_source", "boolean",
+ N_("display source code of script on buffer with detail on a script "
+ "(script is downloaded in a temporary file when detail on script "
+ "is displayed)"),
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_look_quiet_actions = weechat_config_new_option (
+ script_config_file, script_config_section_look,
+ "quiet_actions", "boolean",
+ N_("quiet actions on script buffer: do not display messages on core "
+ "buffer when scripts are installed/removed/loaded/unloaded (only "
+ "errors are displayed)"),
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_look_sort = weechat_config_new_option (
+ script_config_file, script_config_section_look,
+ "sort", "string",
+ N_("default sort keys for scripts: comma-separated list of "
+ "identifiers: a=author, A=autoloaded, d=date added, e=extension, "
+ "i=installed, l=language, n=name, o=obsolete, p=popularity, "
+ "r=running, u=date updated; char \"-\" can be used before "
+ "identifier to reverse order; example: \"i,u\": installed "
+ "scripts first, sorted by update date"),
+ NULL, 0, 0, "i,p,n", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_reload_scripts_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_look_translate_description = weechat_config_new_option (
+ script_config_file, script_config_section_look,
+ "translate_description", "boolean",
+ N_("translate description of scripts (if translation is available "
+ "in your language, otherwise English version is used)"),
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_reload_scripts_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_look_use_keys = weechat_config_new_option (
+ script_config_file, script_config_section_look,
+ "use_keys", "boolean",
+ N_("use keys alt+X in script buffer to do actions on scripts "
+ "(alt+i = install, alt+r = remove, ...); if disabled, only the "
+ "input is allowed: i, r, ..."),
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_change_use_keys_cb, NULL, NULL,
+ NULL, NULL, NULL);
}
- script_config_color_status_autoloaded = weechat_config_new_option (
- script_config_file, ptr_section,
- "status_autoloaded", "color",
- N_("color for status \"autoloaded\" (\"a\")"),
- NULL, 0, 0, "cyan", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_status_held = weechat_config_new_option (
- script_config_file, ptr_section,
- "status_held", "color",
- N_("color for status \"held\" (\"H\")"),
- NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_status_installed = weechat_config_new_option (
- script_config_file, ptr_section,
- "status_installed", "color",
- N_("color for status \"installed\" (\"i\")"),
- NULL, 0, 0, "lightcyan", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_status_obsolete = weechat_config_new_option (
- script_config_file, ptr_section,
- "status_obsolete", "color",
- N_("color for status \"obsolete\" (\"N\")"),
- NULL, 0, 0, "lightmagenta", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_status_popular = weechat_config_new_option (
- script_config_file, ptr_section,
- "status_popular", "color",
- N_("color for status \"popular\" (\"*\")"),
- NULL, 0, 0, "yellow", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_status_running = weechat_config_new_option (
- script_config_file, ptr_section,
- "status_running", "color",
- N_("color for status \"running\" (\"r\")"),
- NULL, 0, 0, "lightgreen", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_status_unknown = weechat_config_new_option (
- script_config_file, ptr_section,
- "status_unknown", "color",
- N_("color for status \"unknown\" (\"?\")"),
- NULL, 0, 0, "lightred", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text = weechat_config_new_option (
- script_config_file, ptr_section,
- "text", "color",
- N_("text color in script buffer"),
- NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_bg = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_bg", "color",
- N_("background color in script buffer"),
- NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_bg_selected = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_bg_selected", "color",
- N_("background color for selected line in script buffer"),
- NULL, 0, 0, "red", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_date = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_date", "color",
- N_("text color of dates in script buffer"),
- NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_date_selected = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_date_selected", "color",
- N_("text color of dates for selected line in script buffer"),
- NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_delimiters = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_delimiters", "color",
- N_("text color of delimiters in script buffer"),
- NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_description = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_description", "color",
- N_("text color of description in script buffer"),
- NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_description_selected = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_description_selected", "color",
- N_("text color of description for selected line in script buffer"),
- NULL, 0, 0, "white", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_extension = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_extension", "color",
- N_("text color of extension in script buffer"),
- NULL, 0, 0, "default", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_extension_selected = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_extension_selected", "color",
- N_("text color of extension for selected line in script buffer"),
- NULL, 0, 0, "white", NULL, 0,
+ /* color */
+ script_config_section_color = weechat_config_new_section (
+ script_config_file, "color",
+ 0, 0,
NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_name = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_name", "color",
- N_("text color of script name in script buffer"),
- NULL, 0, 0, "cyan", NULL, 0,
NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_name_selected = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_name_selected", "color",
- N_("text color of script name for selected line in script buffer"),
- NULL, 0, 0, "lightcyan", NULL, 0,
NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_selected = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_selected", "color",
- N_("text color for selected line in script buffer"),
- NULL, 0, 0, "white", NULL, 0,
NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
- script_config_color_text_tags = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_tags", "color",
- N_("text color of tags in script buffer"),
- NULL, 0, 0, "brown", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_tags_selected = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_tags_selected", "color",
- N_("text color of tags for selected line in script buffer"),
- NULL, 0, 0, "yellow", NULL, 0,
- NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_version = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_version", "color",
- N_("text color of version in script buffer"),
- NULL, 0, 0, "magenta", NULL, 0,
+ if (script_config_section_color)
+ {
+ script_config_color_status_autoloaded = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "status_autoloaded", "color",
+ N_("color for status \"autoloaded\" (\"a\")"),
+ NULL, 0, 0, "cyan", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_status_held = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "status_held", "color",
+ N_("color for status \"held\" (\"H\")"),
+ NULL, 0, 0, "white", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_status_installed = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "status_installed", "color",
+ N_("color for status \"installed\" (\"i\")"),
+ NULL, 0, 0, "lightcyan", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_status_obsolete = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "status_obsolete", "color",
+ N_("color for status \"obsolete\" (\"N\")"),
+ NULL, 0, 0, "lightmagenta", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_status_popular = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "status_popular", "color",
+ N_("color for status \"popular\" (\"*\")"),
+ NULL, 0, 0, "yellow", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_status_running = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "status_running", "color",
+ N_("color for status \"running\" (\"r\")"),
+ NULL, 0, 0, "lightgreen", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_status_unknown = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "status_unknown", "color",
+ N_("color for status \"unknown\" (\"?\")"),
+ NULL, 0, 0, "lightred", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text", "color",
+ N_("text color in script buffer"),
+ NULL, 0, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_bg = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_bg", "color",
+ N_("background color in script buffer"),
+ NULL, 0, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_bg_selected = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_bg_selected", "color",
+ N_("background color for selected line in script buffer"),
+ NULL, 0, 0, "red", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_date = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_date", "color",
+ N_("text color of dates in script buffer"),
+ NULL, 0, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_date_selected = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_date_selected", "color",
+ N_("text color of dates for selected line in script buffer"),
+ NULL, 0, 0, "white", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_delimiters = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_delimiters", "color",
+ N_("text color of delimiters in script buffer"),
+ NULL, 0, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_description = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_description", "color",
+ N_("text color of description in script buffer"),
+ NULL, 0, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_description_selected = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_description_selected", "color",
+ N_("text color of description for selected line in script buffer"),
+ NULL, 0, 0, "white", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_extension = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_extension", "color",
+ N_("text color of extension in script buffer"),
+ NULL, 0, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_extension_selected = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_extension_selected", "color",
+ N_("text color of extension for selected line in script buffer"),
+ NULL, 0, 0, "white", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_name = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_name", "color",
+ N_("text color of script name in script buffer"),
+ NULL, 0, 0, "cyan", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_name_selected = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_name_selected", "color",
+ N_("text color of script name for selected line in script buffer"),
+ NULL, 0, 0, "lightcyan", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_selected = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_selected", "color",
+ N_("text color for selected line in script buffer"),
+ NULL, 0, 0, "white", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_tags = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_tags", "color",
+ N_("text color of tags in script buffer"),
+ NULL, 0, 0, "brown", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_tags_selected = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_tags_selected", "color",
+ N_("text color of tags for selected line in script buffer"),
+ NULL, 0, 0, "yellow", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_version = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_version", "color",
+ N_("text color of version in script buffer"),
+ NULL, 0, 0, "magenta", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_version_loaded = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_version_loaded", "color",
+ N_("text color of version loaded in script buffer"),
+ NULL, 0, 0, "default", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_version_loaded_selected = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_version_loaded_selected", "color",
+ N_("text color of version loaded for selected line in script buffer"),
+ NULL, 0, 0, "white", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_color_text_version_selected = weechat_config_new_option (
+ script_config_file, script_config_section_color,
+ "text_version_selected", "color",
+ N_("text color of version for selected line in script buffer"),
+ NULL, 0, 0, "lightmagenta", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_refresh_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ }
+
+ /* scripts */
+ script_config_section_scripts = weechat_config_new_section (
+ script_config_file, "scripts",
+ 0, 0,
NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_version_loaded = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_version_loaded", "color",
- N_("text color of version loaded in script buffer"),
- NULL, 0, 0, "default", NULL, 0,
NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_version_loaded_selected = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_version_loaded_selected", "color",
- N_("text color of version loaded for selected line in script buffer"),
- NULL, 0, 0, "white", NULL, 0,
NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_color_text_version_selected = weechat_config_new_option (
- script_config_file, ptr_section,
- "text_version_selected", "color",
- N_("text color of version for selected line in script buffer"),
- NULL, 0, 0, "lightmagenta", NULL, 0,
NULL, NULL, NULL,
- &script_config_refresh_cb, NULL, NULL,
NULL, NULL, NULL);
-
- /* scripts */
- ptr_section = weechat_config_new_section (script_config_file, "scripts",
- 0, 0,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL,
- NULL, NULL, NULL);
- if (!ptr_section)
+ if (script_config_section_scripts)
{
- weechat_config_free (script_config_file);
- script_config_file = NULL;
- return 0;
+ script_config_scripts_autoload = weechat_config_new_option (
+ script_config_file, script_config_section_scripts,
+ "autoload", "boolean",
+ N_("autoload scripts installed (make a link in \"autoload\" directory "
+ "to script in parent directory)"),
+ NULL, 0, 0, "on", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_scripts_cache_expire = weechat_config_new_option (
+ script_config_file, script_config_section_scripts,
+ "cache_expire", "integer",
+ N_("local cache expiration time, in minutes (-1 = never expires, "
+ "0 = always expire)"),
+ NULL, -1, 525600, "1440", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_scripts_download_enabled = weechat_config_new_option (
+ script_config_file, script_config_section_scripts,
+ "download_enabled", "boolean",
+ N_("enable download of files from the scripts repository when the "
+ "/script command is used (list of scripts and scripts "
+ "themselves); the list of scripts is downloaded from the URL "
+ "specified in the option script.scripts.url; WeeChat will "
+ "sometimes download again the list of scripts when you use the "
+ "/script command, even if you don't install a script"),
+ NULL, 0, 0, "off", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_scripts_download_timeout = weechat_config_new_option (
+ script_config_file, script_config_section_scripts,
+ "download_timeout", "integer",
+ N_("timeout (in seconds) for download of scripts and list of "
+ "scripts"),
+ NULL, 1, 3600, "30", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_scripts_hold = weechat_config_new_option (
+ script_config_file, script_config_section_scripts,
+ "hold", "string",
+ N_("scripts to \"hold\": comma-separated list of scripts which "
+ "will never been upgraded and can not be removed, for example: "
+ "\"go.py,urlserver.py\""),
+ NULL, 0, 0, "", NULL, 0,
+ NULL, NULL, NULL,
+ &script_config_change_hold_cb, NULL, NULL,
+ NULL, NULL, NULL);
+ script_config_scripts_path = weechat_config_new_option (
+ script_config_file, script_config_section_scripts,
+ "path", "string",
+ N_("local cache directory for scripts "
+ "(path is evaluated, see function string_eval_path_home in "
+ "plugin API reference)"),
+ NULL, 0, 0, "${weechat_cache_dir}/script", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ script_config_scripts_url = weechat_config_new_option (
+ script_config_file, script_config_section_scripts,
+ "url", "string",
+ N_("URL for file with list of scripts"),
+ NULL, 0, 0, "https://weechat.org/files/plugins.xml.gz", NULL, 0,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
- script_config_scripts_autoload = weechat_config_new_option (
- script_config_file, ptr_section,
- "autoload", "boolean",
- N_("autoload scripts installed (make a link in \"autoload\" directory "
- "to script in parent directory)"),
- NULL, 0, 0, "on", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- script_config_scripts_cache_expire = weechat_config_new_option (
- script_config_file, ptr_section,
- "cache_expire", "integer",
- N_("local cache expiration time, in minutes (-1 = never expires, "
- "0 = always expire)"),
- NULL, -1, 525600, "1440", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- script_config_scripts_download_enabled = weechat_config_new_option (
- script_config_file, ptr_section,
- "download_enabled", "boolean",
- N_("enable download of files from the scripts repository when the "
- "/script command is used (list of scripts and scripts themselves); "
- "the list of scripts is downloaded from the URL specified in the "
- "option script.scripts.url; WeeChat will sometimes download again "
- "the list of scripts when you use the /script command, even if "
- "you don't install a script"),
- NULL, 0, 0, "off", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- script_config_scripts_download_timeout = weechat_config_new_option (
- script_config_file, ptr_section,
- "download_timeout", "integer",
- N_("timeout (in seconds) for download of scripts and list of scripts"),
- NULL, 1, 3600, "30", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- script_config_scripts_hold = weechat_config_new_option (
- script_config_file, ptr_section,
- "hold", "string",
- N_("scripts to \"hold\": comma-separated list of scripts which will "
- "never been upgraded and can not be removed, for example: "
- "\"go.py,urlserver.py\""),
- NULL, 0, 0, "", NULL, 0,
- NULL, NULL, NULL,
- &script_config_change_hold_cb, NULL, NULL,
- NULL, NULL, NULL);
- script_config_scripts_path = weechat_config_new_option (
- script_config_file, ptr_section,
- "path", "string",
- N_("local cache directory for scripts "
- "(path is evaluated, see function string_eval_path_home in "
- "plugin API reference)"),
- NULL, 0, 0, "${weechat_cache_dir}/script", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- script_config_scripts_url = weechat_config_new_option (
- script_config_file, ptr_section,
- "url", "string",
- N_("URL for file with list of scripts"),
- NULL, 0, 0, "https://weechat.org/files/plugins.xml.gz", NULL, 0,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-
return 1;
}