summaryrefslogtreecommitdiff
path: root/src/plugins/script
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-08-24 13:26:59 +0200
committerSébastien Helleu <flashcode@flashtux.org>2015-08-24 13:26:59 +0200
commitc35c941298c16520293c4f6c85b140fd11d9bdd3 (patch)
tree497f430f339f671143f64ae720d7b92c4d001433 /src/plugins/script
parent00b60be4b79931f93cbc77afd120f95602e10fea (diff)
downloadweechat-c35c941298c16520293c4f6c85b140fd11d9bdd3.zip
script: add option script.scripts.download_timeout
Diffstat (limited to 'src/plugins/script')
-rw-r--r--src/plugins/script/script-action.c18
-rw-r--r--src/plugins/script/script-config.c7
-rw-r--r--src/plugins/script/script-config.h1
-rw-r--r--src/plugins/script/script-repo.c9
4 files changed, 26 insertions, 9 deletions
diff --git a/src/plugins/script/script-action.c b/src/plugins/script/script-action.c
index 032ec223f..753be0531 100644
--- a/src/plugins/script/script-action.c
+++ b/src/plugins/script/script-action.c
@@ -648,9 +648,12 @@ script_action_install (int quiet)
ptr_script_to_install->name_with_extension);
}
weechat_hashtable_set (options, "file_out", filename);
- weechat_hook_process_hashtable (url, options, 30000,
- &script_action_install_process_cb,
- (quiet) ? (void *)1 : (void *)0);
+ weechat_hook_process_hashtable (
+ url,
+ options,
+ weechat_config_integer (script_config_scripts_download_timeout) * 1000,
+ &script_action_install_process_cb,
+ (quiet) ? (void *)1 : (void *)0);
free (url);
}
weechat_hashtable_free (options);
@@ -1067,9 +1070,12 @@ script_action_show (const char *name, int quiet)
if (url)
{
weechat_hashtable_set (options, "file_out", filename);
- weechat_hook_process_hashtable (url, options, 30000,
- &script_action_show_source_process_cb,
- NULL);
+ weechat_hook_process_hashtable (
+ url,
+ options,
+ weechat_config_integer (script_config_scripts_download_timeout) * 1000,
+ &script_action_show_source_process_cb,
+ NULL);
free (url);
}
weechat_hashtable_free (options);
diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c
index b5333fe54..69aec5d8f 100644
--- a/src/plugins/script/script-config.c
+++ b/src/plugins/script/script-config.c
@@ -82,6 +82,7 @@ struct t_config_option *script_config_color_text_version_selected;
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_timeout;
struct t_config_option *script_config_scripts_path;
struct t_config_option *script_config_scripts_hold;
struct t_config_option *script_config_scripts_url;
@@ -656,6 +657,12 @@ script_config_init ()
"0 = always expire)"),
NULL, -1, 525600, "1440", NULL, 0, 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);
script_config_scripts_path = weechat_config_new_option (
script_config_file, ptr_section,
"path", "string",
diff --git a/src/plugins/script/script-config.h b/src/plugins/script/script-config.h
index 6f488bda5..2917e7da4 100644
--- a/src/plugins/script/script-config.h
+++ b/src/plugins/script/script-config.h
@@ -62,6 +62,7 @@ extern struct t_config_option *script_config_color_text_version_selected;
extern struct t_config_option *script_config_scripts_autoload;
extern struct t_config_option *script_config_scripts_cache_expire;
+extern struct t_config_option *script_config_scripts_download_timeout;
extern struct t_config_option *script_config_scripts_path;
extern struct t_config_option *script_config_scripts_hold;
extern struct t_config_option *script_config_scripts_url;
diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c
index 23db271b2..bef5fad17 100644
--- a/src/plugins/script/script-repo.c
+++ b/src/plugins/script/script-repo.c
@@ -1472,9 +1472,12 @@ script_repo_file_update (int quiet)
SCRIPT_PLUGIN_NAME);
}
weechat_hashtable_set (options, "file_out", filename);
- weechat_hook_process_hashtable (url, options, 30000,
- &script_repo_file_update_process_cb,
- (quiet) ? (void *)1 : (void *)0);
+ weechat_hook_process_hashtable (
+ url,
+ options,
+ weechat_config_integer (script_config_scripts_download_timeout) * 1000,
+ &script_repo_file_update_process_cb,
+ (quiet) ? (void *)1 : (void *)0);
free (url);
}
weechat_hashtable_free (options);