summaryrefslogtreecommitdiff
path: root/src/plugins/plugin-script.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-05-30 20:53:42 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-05-30 20:56:25 +0200
commit71b85f12384e101f772dce249cda8d9199b6ea3e (patch)
tree84286be1392b096b31df40221920eab1eef06167 /src/plugins/plugin-script.c
parenteda62e1218c70f7c67690b0cf9fe2c42a8663d6f (diff)
downloadweechat-71b85f12384e101f772dce249cda8d9199b6ea3e.zip
core: send all command line parameters not beginning with a dash to all plugins, add info "auto_load_scripts"
This fixes an issue with IRC URL given on command line when it starts with `ircs://` or `irc6://`: the server is not created at all (only `irc://` works fine).
Diffstat (limited to 'src/plugins/plugin-script.c')
-rw-r--r--src/plugins/plugin-script.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c
index 533483d03..14404d1c9 100644
--- a/src/plugins/plugin-script.c
+++ b/src/plugins/plugin-script.c
@@ -158,16 +158,14 @@ plugin_script_create_dirs (struct t_weechat_plugin *weechat_plugin)
* - hooks config
* - creates directories in WeeChat home
* - hooks command, completion, hdata, infolist, signals
- * - parses arguments
* - auto-loads scripts.
*/
void
plugin_script_init (struct t_weechat_plugin *weechat_plugin,
- int argc, char *argv[],
struct t_plugin_script_data *plugin_data)
{
- char string[512], *completion;
+ char string[512], *completion, *info_auto_load_scripts;
char *action_signals[] = { "install", "remove", "autoload", NULL };
int i, auto_load_scripts;
@@ -273,16 +271,13 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
&plugin_script_info_version_cb,
weechat_plugin, NULL);
- /* parse arguments */
- auto_load_scripts = 1;
- for (i = 0; i < argc; i++)
- {
- if ((strcmp (argv[i], "-s") == 0)
- || (strcmp (argv[i], "--no-script") == 0))
- {
- auto_load_scripts = 0;
- }
- }
+ /* check if auto-load of scripts is enabled */
+ info_auto_load_scripts = weechat_info_get ("auto_load_scripts", NULL);
+ auto_load_scripts = (info_auto_load_scripts
+ && (strcmp (info_auto_load_scripts, "1") == 0)) ?
+ 1 : 0;
+ if (info_auto_load_scripts)
+ free (info_auto_load_scripts);
/* autoload scripts */
if (auto_load_scripts)