1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-25 04:16:38 +02:00

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).
This commit is contained in:
Sébastien Helleu
2023-05-30 20:53:42 +02:00
parent eda62e1218
commit 71b85f1238
29 changed files with 208 additions and 52 deletions
+2
View File
@@ -26,6 +26,7 @@ New features::
* core: don't split on newline characters in printf_date_tags when input_multiline is set (issue #1909)
* core: add key @kbd:[l] in cursor mode to quote line, add variable "_chat_focused_line" in function hashtable sent to hook_focus callback (issue #1913, issue #1914)
* core: add option `split_return` in command `/input` (issue #1916)
* core: send all command line parameters not beginning with a dash to all plugins
* core: add command `/reset` to reset options to their default values
* core: add option `rename` in command `/bar`
* core: add relative move of read marker with `/buffer set unread [+/-]N` (issue #1895)
@@ -38,6 +39,7 @@ New features::
* api: add function config_set_version (issue #1238)
* api: don't split on newline by default in functions `command` and `command_options` when `input_multiline` is set to 0
* api: add optional argument with version in info "version_number"
* api: add info "auto_load_scripts"
* alias: use lower case for default aliases, rename all aliases to lower case on upgrade (issue #1872)
* alias: add `$&` to replace all arguments with double quotes escaped (issue #1140, issue #1190)
* alias: add option `missing` in command `/alias`
+6 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -11116,6 +11116,11 @@ msgid ""
"by the user (option \"-a\" or \"--no-connect\")"
msgstr ""
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
msgid "terminal charset"
msgstr "znaková sada terminálu"
+12 -1
View File
@@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-25 22:34+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -13522,6 +13522,17 @@ msgstr ""
"1, falls die automatische Verbindung zu Servern aktiviert ist, 0, wenn sie "
"vom Benutzer deaktiviert wurde (Option \"-a\" oder \"--no-connect\")"
#, fuzzy
#| msgid ""
#| "1 if automatic connection to servers is enabled, 0 if it has been "
#| "disabled by the user (option \"-a\" or \"--no-connect\")"
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
"1, falls die automatische Verbindung zu Servern aktiviert ist, 0, wenn sie "
"vom Benutzer deaktiviert wurde (Option \"-a\" oder \"--no-connect\")"
msgid "terminal charset"
msgstr "Terminal Zeichensatz"
+6 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -11849,6 +11849,11 @@ msgid ""
"by the user (option \"-a\" or \"--no-connect\")"
msgstr ""
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
msgid "terminal charset"
msgstr "set de caracteres de la terminal"
+9 -2
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"PO-Revision-Date: 2023-05-29 09:40+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-30 20:49+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -13209,6 +13209,13 @@ msgstr ""
"1 si la connexion automatique aux serveurs est activée, 0 si elle a été "
"désactivée par l'utilisateur (option \"-a\" ou \"--no-connect\")"
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
"1 si la les scripts sont automatiquement charés, 0 si l'auto-chargement a "
"été désactivé par l'utilisateur (option \"-s\" ou \"--no-script\")"
msgid "terminal charset"
msgstr "charset du terminal"
+6 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10505,6 +10505,11 @@ msgid ""
"by the user (option \"-a\" or \"--no-connect\")"
msgstr ""
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
#, fuzzy
msgid "terminal charset"
msgstr "pufferek kezelése"
+6 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -11572,6 +11572,11 @@ msgid ""
"by the user (option \"-a\" or \"--no-connect\")"
msgstr ""
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
msgid "terminal charset"
msgstr "set caratteri terminale"
+6 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -12777,6 +12777,11 @@ msgid ""
"by the user (option \"-a\" or \"--no-connect\")"
msgstr ""
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
msgid "terminal charset"
msgstr "端末の文字セット"
+12 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@@ -13789,6 +13789,17 @@ msgstr ""
"1 jeśli automatycznie łączenie z serwerami jest włączone, 0 jeśli zostało "
"wyłączone przez użytkownika (opcja \"-a\" lub \"--no-connect\")"
#, fuzzy
#| msgid ""
#| "1 if automatic connection to servers is enabled, 0 if it has been "
#| "disabled by the user (option \"-a\" or \"--no-connect\")"
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
"1 jeśli automatycznie łączenie z serwerami jest włączone, 0 jeśli zostało "
"wyłączone przez użytkownika (opcja \"-a\" lub \"--no-connect\")"
msgid "terminal charset"
msgstr "kodowanie terminala"
+6 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -12545,6 +12545,11 @@ msgid ""
"by the user (option \"-a\" or \"--no-connect\")"
msgstr ""
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
msgid "terminal charset"
msgstr "charset do termianl"
+6 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -11069,6 +11069,11 @@ msgid ""
"by the user (option \"-a\" or \"--no-connect\")"
msgstr ""
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
msgid "terminal charset"
msgstr "charset do terminar"
+6 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -10543,6 +10543,11 @@ msgid ""
"by the user (option \"-a\" or \"--no-connect\")"
msgstr ""
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
#, fuzzy
msgid "terminal charset"
msgstr "управление буферами"
+12 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-14 15:29+0200\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -12970,6 +12970,17 @@ msgstr ""
"1 ако је укључено аутоматско повезивање са серверима, 0 ако је корисник то "
"искључио (опцијом „-a” или „--no-connect”)"
#, fuzzy
#| msgid ""
#| "1 if automatic connection to servers is enabled, 0 if it has been "
#| "disabled by the user (option \"-a\" or \"--no-connect\")"
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
"1 ако је укључено аутоматско повезивање са серверима, 0 ако је корисник то "
"искључио (опцијом „-a” или „--no-connect”)"
msgid "terminal charset"
msgstr "скуп карактера терминала"
+12 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2023-05-01 20:23+0200\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -13333,6 +13333,17 @@ msgstr ""
"Sunuculara kendiliğinden bağlantı etkinleştirilmişse 1, kullanıcı ayarı ile "
"devre dışı bırakılmışsa 0 (\"-a\" veya \"--no-connect\" seçeneği)"
#, fuzzy
#| msgid ""
#| "1 if automatic connection to servers is enabled, 0 if it has been "
#| "disabled by the user (option \"-a\" or \"--no-connect\")"
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
"Sunuculara kendiliğinden bağlantı etkinleştirilmişse 1, kullanıcı ayarı ile "
"devre dışı bırakılmışsa 0 (\"-a\" veya \"--no-connect\" seçeneği)"
msgid "terminal charset"
msgstr "uçbirim karakter seti"
+6 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2023-05-29 09:34+0200\n"
"POT-Creation-Date: 2023-05-30 16:39+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9494,6 +9494,11 @@ msgid ""
"by the user (option \"-a\" or \"--no-connect\")"
msgstr ""
msgid ""
"1 if scripts are automatically loaded, 0 if the auto-load has been disabled "
"by the user (option \"-s\" or \"--no-script\")"
msgstr ""
msgid "terminal charset"
msgstr ""
+1
View File
@@ -132,6 +132,7 @@ int weechat_no_gcrypt = 0; /* remove init/deinit of gcrypt */
struct t_weelist *weechat_startup_commands = NULL; /* startup commands */
/* (option -r) */
int weechat_auto_connect = 1; /* auto-connect to servers */
int weechat_auto_load_scripts = 1; /* auto-load scripts */
/*
+1
View File
@@ -126,6 +126,7 @@ extern int weechat_no_gnutls;
extern int weechat_no_gcrypt;
extern struct t_weelist *weechat_startup_commands;
extern int weechat_auto_connect;
extern int weechat_auto_load_scripts;
extern void weechat_term_check ();
extern void weechat_shutdown (int return_code, int crash);
+5 -1
View File
@@ -1239,6 +1239,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
char str_version[128];
/* make C compiler happy */
(void) argc;
(void) argv;
weechat_guile_plugin = plugin;
/* set interpreter name and version */
@@ -1296,7 +1300,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
guile_data.unload_all = &weechat_guile_unload_all;
guile_quiet = 1;
plugin_script_init (weechat_guile_plugin, argc, argv, &guile_data);
plugin_script_init (weechat_guile_plugin, &guile_data);
guile_quiet = 0;
plugin_script_display_short_list (weechat_guile_plugin,
+5 -1
View File
@@ -924,6 +924,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
char str_interpreter[64];
/* make C compiler happy */
(void) argc;
(void) argv;
weechat_js_plugin = plugin;
/* set interpreter name and version */
@@ -950,7 +954,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
js_data.unload_all = &weechat_js_unload_all;
js_quiet = 1;
plugin_script_init (plugin, argc, argv, &js_data);
plugin_script_init (plugin, &js_data);
js_quiet = 0;
plugin_script_display_short_list (weechat_js_plugin, js_scripts);
+5 -1
View File
@@ -1237,6 +1237,10 @@ weechat_lua_signal_script_action_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
/* make C compiler happy */
(void) argc;
(void) argv;
weechat_lua_plugin = plugin;
/* set interpreter name and version */
@@ -1271,7 +1275,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
lua_data.unload_all = &weechat_lua_unload_all;
lua_quiet = 1;
plugin_script_init (weechat_lua_plugin, argc, argv, &lua_data);
plugin_script_init (weechat_lua_plugin, &lua_data);
lua_quiet = 0;
plugin_script_display_short_list (weechat_lua_plugin,
+5 -1
View File
@@ -1253,6 +1253,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
PERL_SYS_INIT3 (&a, (char ***)&perl_args_local, (char ***)&perl_env);
#endif /* PERL_SYS_INIT3 */
/* make C compiler happy */
(void) argc;
(void) argv;
weechat_perl_plugin = plugin;
/* set interpreter name and version */
@@ -1304,7 +1308,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
perl_data.unload_all = &weechat_perl_unload_all;
perl_quiet = 1;
plugin_script_init (weechat_perl_plugin, argc, argv, &perl_data);
plugin_script_init (weechat_perl_plugin, &perl_data);
perl_quiet = 0;
plugin_script_display_short_list (weechat_perl_plugin,
+5 -1
View File
@@ -1302,6 +1302,10 @@ php_weechat_log_message (char *message)
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
/* make C compiler happy */
(void) argc;
(void) argv;
weechat_php_plugin = plugin;
/* set interpreter name and version */
@@ -1341,7 +1345,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
PG(report_zend_debug) = 0; /* Turn off --enable-debug output */
php_quiet = 1;
plugin_script_init (weechat_php_plugin, argc, argv, &php_data);
plugin_script_init (weechat_php_plugin, &php_data);
php_quiet = 0;
plugin_script_display_short_list (weechat_php_plugin,
+28 -2
View File
@@ -448,6 +448,27 @@ plugin_api_info_auto_connect_cb (const void *pointer, void *data,
return strdup (value);
}
/*
* Returns WeeChat info "auto_load_scripts".
*/
char *
plugin_api_info_auto_load_scripts_cb (const void *pointer, void *data,
const char *info_name,
const char *arguments)
{
char value[32];
/* make C compiler happy */
(void) pointer;
(void) data;
(void) info_name;
(void) arguments;
snprintf (value, sizeof (value), "%d", weechat_auto_load_scripts);
return strdup (value);
}
/*
* Returns WeeChat info "charset_terminal".
*/
@@ -1964,9 +1985,14 @@ plugin_api_info_init ()
NULL, &plugin_api_info_weechat_daemon_cb, NULL, NULL);
hook_info (NULL, "auto_connect",
N_("1 if automatic connection to servers is enabled, "
"0 if it has been disabled by the user (option \"-a\" or "
"\"--no-connect\")"),
"0 if it has been disabled by the user "
"(option \"-a\" or \"--no-connect\")"),
NULL, &plugin_api_info_auto_connect_cb, NULL, NULL);
hook_info (NULL, "auto_load_scripts",
N_("1 if scripts are automatically loaded, "
"0 if the auto-load has been disabled by the user "
"(option \"-s\" or \"--no-script\")"),
NULL, &plugin_api_info_auto_load_scripts_cb, NULL, NULL);
hook_info (NULL, "charset_terminal",
N_("terminal charset"),
NULL, &plugin_api_info_charset_terminal_cb, NULL, NULL);
+8 -13
View File
@@ -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)
-1
View File
@@ -116,7 +116,6 @@ struct t_plugin_script_data
extern void plugin_script_display_interpreter (struct t_weechat_plugin *plugin,
int indent);
extern void plugin_script_init (struct t_weechat_plugin *weechat_plugin,
int argc, char *argv[],
struct t_plugin_script_data *plugin_data);
extern int plugin_script_valid (struct t_plugin_script *scripts,
struct t_plugin_script *script);
+17 -13
View File
@@ -274,20 +274,18 @@ plugin_check_autoload (const char *filename)
*/
void
plugin_get_args (struct t_weechat_plugin *plugin,
int argc, char **argv,
plugin_get_args (int argc, char **argv,
int *plugin_argc, char ***plugin_argv,
int *no_connect)
int *no_connect, int *no_script)
{
int i, temp_argc, length_plugin_name;
int i, temp_argc;
char **temp_argv;
temp_argc = 0;
temp_argv = NULL;
*no_connect = 0;
length_plugin_name = strlen (plugin->name);
*no_script = 0;
if (argc > 0)
{
@@ -302,10 +300,11 @@ plugin_get_args (struct t_weechat_plugin *plugin,
*no_connect = 1;
}
else if ((strcmp (argv[i], "-s") == 0)
|| (strcmp (argv[i], "--no-script") == 0)
|| ((strncmp (argv[i], plugin->name,
length_plugin_name) == 0)
&& (argv[i][length_plugin_name] == ':')))
|| (strcmp (argv[i], "--no-script") == 0))
{
*no_script = 1;
}
else if (argv[i][0] != '-')
{
temp_argv[temp_argc++] = argv[i];
}
@@ -336,7 +335,8 @@ int
plugin_call_init (struct t_weechat_plugin *plugin, int argc, char **argv)
{
t_weechat_init_func *init_func;
int plugin_argc, no_connect, rc, old_auto_connect;
int no_connect, rc, old_auto_connect, no_script, old_auto_load_scripts;
int plugin_argc;
char **plugin_argv;
if (plugin->initialized)
@@ -348,12 +348,15 @@ plugin_call_init (struct t_weechat_plugin *plugin, int argc, char **argv)
return 0;
/* get arguments for the plugin */
plugin_get_args (plugin, argc, argv,
&plugin_argc, &plugin_argv, &no_connect);
plugin_get_args (argc, argv,
&plugin_argc, &plugin_argv, &no_connect, &no_script);
old_auto_connect = weechat_auto_connect;
weechat_auto_connect = (no_connect) ? 0 : 1;
old_auto_load_scripts = weechat_auto_load_scripts;
weechat_auto_load_scripts = (no_script) ? 0 : 1;
/* init plugin */
if (weechat_debug_core >= 1)
{
@@ -377,6 +380,7 @@ plugin_call_init (struct t_weechat_plugin *plugin, int argc, char **argv)
}
weechat_auto_connect = old_auto_connect;
weechat_auto_load_scripts = old_auto_load_scripts;
if (plugin_argv)
free (plugin_argv);
+5 -1
View File
@@ -1465,6 +1465,10 @@ weechat_python_signal_script_action_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
/* make C compiler happy */
(void) argc;
(void) argv;
weechat_python_plugin = plugin;
/* set interpreter name and version */
@@ -1532,7 +1536,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
python_data.unload_all = &weechat_python_unload_all;
python_quiet = 1;
plugin_script_init (weechat_python_plugin, argc, argv, &python_data);
plugin_script_init (weechat_python_plugin, &python_data);
python_quiet = 0;
plugin_script_display_short_list (weechat_python_plugin,
+5 -1
View File
@@ -1340,6 +1340,10 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
"end\n"
};
/* make C compiler happy */
(void) argc;
(void) argv;
weechat_ruby_plugin = plugin;
/* set interpreter name and version */
@@ -1413,7 +1417,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
ruby_data.unload_all = &weechat_ruby_unload_all;
ruby_quiet = 1;
plugin_script_init (weechat_ruby_plugin, argc, argv, &ruby_data);
plugin_script_init (weechat_ruby_plugin, &ruby_data);
ruby_quiet = 0;
plugin_script_display_short_list (weechat_ruby_plugin,
+5 -1
View File
@@ -922,6 +922,10 @@ weechat_tcl_signal_script_action_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
/* make C compiler happy */
(void) argc;
(void) argv;
weechat_tcl_plugin = plugin;
/* set interpreter name and version */
@@ -951,7 +955,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
tcl_data.unload_all = &weechat_tcl_unload_all;
tcl_quiet = 1;
plugin_script_init (weechat_tcl_plugin, argc, argv, &tcl_data);
plugin_script_init (weechat_tcl_plugin, &tcl_data);
tcl_quiet = 0;
plugin_script_display_short_list (weechat_tcl_plugin,