summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2018-01-15 21:32:24 +0100
committerSébastien Helleu <flashcode@flashtux.org>2018-01-15 21:57:06 +0100
commit21e63e7958c499b79a63612d7344ad4d53bd4284 (patch)
tree68d746e0481bcac99aaf5c2a6910c8d3d7f0805e /src
parentee79e11b15792780e9a69f80dae412f26b402a16 (diff)
downloadweechat-21e63e7958c499b79a63612d7344ad4d53bd4284.zip
scripts: add configuration file for each script plugin
Diffstat (limited to 'src')
-rw-r--r--src/plugins/CMakeLists.txt3
-rw-r--r--src/plugins/Makefile.am4
-rw-r--r--src/plugins/guile/weechat-guile-api.c2
-rw-r--r--src/plugins/guile/weechat-guile.c31
-rw-r--r--src/plugins/guile/weechat-guile.h2
-rw-r--r--src/plugins/javascript/weechat-js-api.cpp2
-rw-r--r--src/plugins/javascript/weechat-js.cpp31
-rw-r--r--src/plugins/javascript/weechat-js.h2
-rw-r--r--src/plugins/lua/weechat-lua-api.c2
-rw-r--r--src/plugins/lua/weechat-lua.c32
-rw-r--r--src/plugins/lua/weechat-lua.h2
-rw-r--r--src/plugins/perl/weechat-perl-api.c2
-rw-r--r--src/plugins/perl/weechat-perl.c31
-rw-r--r--src/plugins/perl/weechat-perl.h2
-rw-r--r--src/plugins/php/weechat-php-api.c2
-rw-r--r--src/plugins/php/weechat-php.c32
-rw-r--r--src/plugins/php/weechat-php.h4
-rw-r--r--src/plugins/plugin-script-config.c72
-rw-r--r--src/plugins/plugin-script-config.h26
-rw-r--r--src/plugins/plugin-script.c107
-rw-r--r--src/plugins/plugin-script.h76
-rw-r--r--src/plugins/python/weechat-python-api.c2
-rw-r--r--src/plugins/python/weechat-python.c32
-rw-r--r--src/plugins/python/weechat-python.h2
-rw-r--r--src/plugins/ruby/weechat-ruby-api.c2
-rw-r--r--src/plugins/ruby/weechat-ruby.c31
-rw-r--r--src/plugins/ruby/weechat-ruby.h2
-rw-r--r--src/plugins/tcl/weechat-tcl-api.c2
-rw-r--r--src/plugins/tcl/weechat-tcl.c32
-rw-r--r--src/plugins/tcl/weechat-tcl.h2
30 files changed, 360 insertions, 214 deletions
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 97f32954c..0abd7e6eb 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -26,7 +26,8 @@ plugin-config.h plugin-config.c)
set(LIB_PLUGINS_SCRIPTS_SRC
plugin-script.c plugin-script.h
-plugin-script-api.c plugin-script-api.h)
+plugin-script-api.c plugin-script-api.h
+plugin-script-config.c plugin-script-config.h)
include_directories(${CMAKE_BINARY_DIR})
add_library(weechat_plugins STATIC ${LIB_PLUGINS_SRC})
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index cf5e446b7..3d813ba66 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -35,7 +35,9 @@ noinst_LTLIBRARIES = lib_weechat_plugins_scripts.la
lib_weechat_plugins_scripts_la_SOURCES = plugin-script.c \
plugin-script.h \
plugin-script-api.c \
- plugin-script-api.h
+ plugin-script-api.h \
+ plugin-script-config.c \
+ plugin-script-config.h
if PLUGIN_ALIAS
alias_dir = alias
diff --git a/src/plugins/guile/weechat-guile-api.c b/src/plugins/guile/weechat-guile-api.c
index 6ad8e3a32..5ab2ff2f4 100644
--- a/src/plugins/guile/weechat-guile-api.c
+++ b/src/plugins/guile/weechat-guile-api.c
@@ -185,7 +185,7 @@ weechat_guile_api_register (SCM name, SCM author, SCM version, SCM license,
/* register script */
guile_current_script = plugin_script_add (weechat_guile_plugin,
- &guile_scripts, &last_guile_script,
+ &guile_data,
(guile_current_script_filename) ?
guile_current_script_filename : "",
API_SCM_TO_STRING(name),
diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c
index 6f307c196..1c663a02e 100644
--- a/src/plugins/guile/weechat-guile.c
+++ b/src/plugins/guile/weechat-guile.c
@@ -46,6 +46,11 @@ WEECHAT_PLUGIN_PRIORITY(4000);
struct t_weechat_plugin *weechat_guile_plugin = NULL;
+struct t_plugin_script_data guile_data;
+
+struct t_config_file *guile_config_file = NULL;
+struct t_config_option *guile_config_look_check_license = NULL;
+
int guile_quiet = 0;
struct t_plugin_script *guile_script_eval = NULL;
@@ -1137,7 +1142,6 @@ weechat_guile_port_write (SCM port, const void *data, size_t size)
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
- struct t_plugin_script_init init;
char str_version[128];
weechat_guile_plugin = plugin;
@@ -1181,17 +1185,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
scm_c_use_module ("weechat");
weechat_guile_catch (scm_gc_protect_object, (void *)guile_module_weechat);
- init.callback_command = &weechat_guile_command_cb;
- init.callback_completion = &weechat_guile_completion_cb;
- init.callback_hdata = &weechat_guile_hdata_cb;
- init.callback_info_eval = &weechat_guile_info_eval_cb;
- init.callback_infolist = &weechat_guile_infolist_cb;
- init.callback_signal_debug_dump = &weechat_guile_signal_debug_dump_cb;
- init.callback_signal_script_action = &weechat_guile_signal_script_action_cb;
- init.callback_load_file = &weechat_guile_load_cb;
+ guile_data.config_file = &guile_config_file;
+ guile_data.config_look_check_license = &guile_config_look_check_license;
+ guile_data.scripts = &guile_scripts;
+ guile_data.last_script = &last_guile_script;
+ guile_data.callback_command = &weechat_guile_command_cb;
+ guile_data.callback_completion = &weechat_guile_completion_cb;
+ guile_data.callback_hdata = &weechat_guile_hdata_cb;
+ guile_data.callback_info_eval = &weechat_guile_info_eval_cb;
+ guile_data.callback_infolist = &weechat_guile_infolist_cb;
+ guile_data.callback_signal_debug_dump = &weechat_guile_signal_debug_dump_cb;
+ guile_data.callback_signal_script_action = &weechat_guile_signal_script_action_cb;
+ guile_data.callback_load_file = &weechat_guile_load_cb;
+ guile_data.unload_all = &weechat_guile_unload_all;
guile_quiet = 1;
- plugin_script_init (weechat_guile_plugin, argc, argv, &init);
+ plugin_script_init (weechat_guile_plugin, argc, argv, &guile_data);
guile_quiet = 0;
plugin_script_display_short_list (weechat_guile_plugin,
@@ -1210,7 +1219,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* unload all scripts */
guile_quiet = 1;
- plugin_script_end (plugin, &guile_scripts, &weechat_guile_unload_all);
+ plugin_script_end (plugin, &guile_data);
if (guile_script_eval)
{
weechat_guile_unload (guile_script_eval);
diff --git a/src/plugins/guile/weechat-guile.h b/src/plugins/guile/weechat-guile.h
index dc62c1c44..d2b7d4028 100644
--- a/src/plugins/guile/weechat-guile.h
+++ b/src/plugins/guile/weechat-guile.h
@@ -27,6 +27,8 @@
extern struct t_weechat_plugin *weechat_guile_plugin;
+extern struct t_plugin_script_data guile_data;
+
extern int guile_quiet;
extern struct t_plugin_script *guile_scripts;
extern struct t_plugin_script *last_guile_script;
diff --git a/src/plugins/javascript/weechat-js-api.cpp b/src/plugins/javascript/weechat-js-api.cpp
index cf4609b24..0fd5c5f3d 100644
--- a/src/plugins/javascript/weechat-js-api.cpp
+++ b/src/plugins/javascript/weechat-js-api.cpp
@@ -160,7 +160,7 @@ API_FUNC(register)
/* register script */
js_current_script = plugin_script_add (weechat_js_plugin,
- &js_scripts, &last_js_script,
+ &js_data,
(js_current_script_filename) ?
js_current_script_filename : "",
*name, *author, *version,
diff --git a/src/plugins/javascript/weechat-js.cpp b/src/plugins/javascript/weechat-js.cpp
index 0df3248cd..00d5e9890 100644
--- a/src/plugins/javascript/weechat-js.cpp
+++ b/src/plugins/javascript/weechat-js.cpp
@@ -43,6 +43,11 @@ WEECHAT_PLUGIN_PRIORITY(4000);
struct t_weechat_plugin *weechat_js_plugin = NULL;
+struct t_plugin_script_data js_data;
+
+struct t_config_file *js_config_file = NULL;
+struct t_config_option *js_config_look_check_license = NULL;
+
int js_quiet = 0;
struct t_plugin_script *js_script_eval = NULL;
@@ -899,7 +904,6 @@ weechat_js_signal_script_action_cb (const void *pointer, void *data,
EXPORT int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
- struct t_plugin_script_init init;
char str_interpreter[64];
weechat_js_plugin = plugin;
@@ -912,17 +916,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
weechat_hashtable_set (plugin->variables, "interpreter_version",
v8::V8::GetVersion());
- init.callback_command = &weechat_js_command_cb;
- init.callback_completion = &weechat_js_completion_cb;
- init.callback_hdata = &weechat_js_hdata_cb;
- init.callback_info_eval = &weechat_js_info_eval_cb;
- init.callback_infolist = &weechat_js_infolist_cb;
- init.callback_signal_debug_dump = &weechat_js_signal_debug_dump_cb;
- init.callback_signal_script_action = &weechat_js_signal_script_action_cb;
- init.callback_load_file = &weechat_js_load_cb;
+ js_data.config_file = &js_config_file;
+ js_data.config_look_check_license = &js_config_look_check_license;
+ js_data.scripts = &js_scripts;
+ js_data.last_script = &last_js_script;
+ js_data.callback_command = &weechat_js_command_cb;
+ js_data.callback_completion = &weechat_js_completion_cb;
+ js_data.callback_hdata = &weechat_js_hdata_cb;
+ js_data.callback_info_eval = &weechat_js_info_eval_cb;
+ js_data.callback_infolist = &weechat_js_infolist_cb;
+ js_data.callback_signal_debug_dump = &weechat_js_signal_debug_dump_cb;
+ js_data.callback_signal_script_action = &weechat_js_signal_script_action_cb;
+ js_data.callback_load_file = &weechat_js_load_cb;
+ js_data.unload_all = &weechat_js_unload_all;
js_quiet = 1;
- plugin_script_init (plugin, argc, argv, &init);
+ plugin_script_init (plugin, argc, argv, &js_data);
js_quiet = 0;
plugin_script_display_short_list (weechat_js_plugin, js_scripts);
@@ -938,7 +947,7 @@ EXPORT int
weechat_plugin_end (struct t_weechat_plugin *plugin)
{
js_quiet = 1;
- plugin_script_end (plugin, &js_scripts, &weechat_js_unload_all);
+ plugin_script_end (plugin, &js_data);
if (js_script_eval)
{
weechat_js_unload (js_script_eval);
diff --git a/src/plugins/javascript/weechat-js.h b/src/plugins/javascript/weechat-js.h
index 36125da44..abeb54b73 100644
--- a/src/plugins/javascript/weechat-js.h
+++ b/src/plugins/javascript/weechat-js.h
@@ -42,6 +42,8 @@ class WeechatJsV8;
extern struct t_weechat_plugin *weechat_js_plugin;
+extern struct t_plugin_script_data js_data;
+
extern int js_quiet;
extern struct t_plugin_script *js_scripts;
extern struct t_plugin_script *last_js_script;
diff --git a/src/plugins/lua/weechat-lua-api.c b/src/plugins/lua/weechat-lua-api.c
index 81d7a1589..b1841bfa9 100644
--- a/src/plugins/lua/weechat-lua-api.c
+++ b/src/plugins/lua/weechat-lua-api.c
@@ -149,7 +149,7 @@ API_FUNC(register)
/* register script */
lua_current_script = plugin_script_add (weechat_lua_plugin,
- &lua_scripts, &last_lua_script,
+ &lua_data,
(lua_current_script_filename) ?
lua_current_script_filename : "",
name,
diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c
index 006ad247c..eca71c60a 100644
--- a/src/plugins/lua/weechat-lua.c
+++ b/src/plugins/lua/weechat-lua.c
@@ -44,6 +44,11 @@ WEECHAT_PLUGIN_PRIORITY(4000);
struct t_weechat_plugin *weechat_lua_plugin = NULL;
+struct t_plugin_script_data lua_data;
+
+struct t_config_file *lua_config_file = NULL;
+struct t_config_option *lua_config_look_check_license = NULL;
+
int lua_quiet = 0;
struct t_plugin_script *lua_script_eval = NULL;
@@ -1193,8 +1198,6 @@ weechat_lua_signal_script_action_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
- struct t_plugin_script_init init;
-
weechat_lua_plugin = plugin;
/* set interpreter name and version */
@@ -1213,17 +1216,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
if (!lua_buffer_output)
return WEECHAT_RC_ERROR;
- init.callback_command = &weechat_lua_command_cb;
- init.callback_completion = &weechat_lua_completion_cb;
- init.callback_hdata = &weechat_lua_hdata_cb;
- init.callback_info_eval = &weechat_lua_info_eval_cb;
- init.callback_infolist = &weechat_lua_infolist_cb;
- init.callback_signal_debug_dump = &weechat_lua_signal_debug_dump_cb;
- init.callback_signal_script_action = &weechat_lua_signal_script_action_cb;
- init.callback_load_file = &weechat_lua_load_cb;
+ lua_data.config_file = &lua_config_file;
+ lua_data.config_look_check_license = &lua_config_look_check_license;
+ lua_data.scripts = &lua_scripts;
+ lua_data.last_script = &last_lua_script;
+ lua_data.callback_command = &weechat_lua_command_cb;
+ lua_data.callback_completion = &weechat_lua_completion_cb;
+ lua_data.callback_hdata = &weechat_lua_hdata_cb;
+ lua_data.callback_info_eval = &weechat_lua_info_eval_cb;
+ lua_data.callback_infolist = &weechat_lua_infolist_cb;
+ lua_data.callback_signal_debug_dump = &weechat_lua_signal_debug_dump_cb;
+ lua_data.callback_signal_script_action = &weechat_lua_signal_script_action_cb;
+ lua_data.callback_load_file = &weechat_lua_load_cb;
+ lua_data.unload_all = &weechat_lua_unload_all;
lua_quiet = 1;
- plugin_script_init (weechat_lua_plugin, argc, argv, &init);
+ plugin_script_init (weechat_lua_plugin, argc, argv, &lua_data);
lua_quiet = 0;
plugin_script_display_short_list (weechat_lua_plugin,
@@ -1242,7 +1250,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* unload all scripts */
lua_quiet = 1;
- plugin_script_end (plugin, &lua_scripts, &weechat_lua_unload_all);
+ plugin_script_end (plugin, &lua_data);
if (lua_script_eval)
{
weechat_lua_unload (lua_script_eval);
diff --git a/src/plugins/lua/weechat-lua.h b/src/plugins/lua/weechat-lua.h
index 7d830787b..ffc004b10 100644
--- a/src/plugins/lua/weechat-lua.h
+++ b/src/plugins/lua/weechat-lua.h
@@ -35,6 +35,8 @@ struct t_lua_const
extern struct t_weechat_plugin *weechat_lua_plugin;
+extern struct t_plugin_script_data lua_data;
+
extern int lua_quiet;
extern struct t_plugin_script *lua_scripts;
extern struct t_plugin_script *last_lua_script;
diff --git a/src/plugins/perl/weechat-perl-api.c b/src/plugins/perl/weechat-perl-api.c
index 92e915301..c16d58578 100644
--- a/src/plugins/perl/weechat-perl-api.c
+++ b/src/plugins/perl/weechat-perl-api.c
@@ -146,7 +146,7 @@ API_FUNC(register)
/* register script */
perl_current_script = plugin_script_add (weechat_perl_plugin,
- &perl_scripts, &last_perl_script,
+ &perl_data,
(perl_current_script_filename) ?
perl_current_script_filename : "",
name, author, version, license,
diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c
index 8099874e2..4381d7cc8 100644
--- a/src/plugins/perl/weechat-perl.c
+++ b/src/plugins/perl/weechat-perl.c
@@ -41,6 +41,11 @@ WEECHAT_PLUGIN_PRIORITY(4000);
struct t_weechat_plugin *weechat_perl_plugin = NULL;
+struct t_plugin_script_data perl_data;
+
+struct t_config_file *perl_config_file = NULL;
+struct t_config_option *perl_config_look_check_license = NULL;
+
int perl_quiet = 0;
struct t_plugin_script *perl_script_eval = NULL;
@@ -1207,7 +1212,6 @@ weechat_perl_signal_quit_upgrade_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
- struct t_plugin_script_init init;
#ifdef PERL_SYS_INIT3
int a;
char **perl_args_local;
@@ -1253,17 +1257,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
perl_args, NULL);
#endif /* MULTIPLICITY */
- init.callback_command = &weechat_perl_command_cb;
- init.callback_completion = &weechat_perl_completion_cb;
- init.callback_hdata = &weechat_perl_hdata_cb;
- init.callback_info_eval = &weechat_perl_info_eval_cb;
- init.callback_infolist = &weechat_perl_infolist_cb;
- init.callback_signal_debug_dump = &weechat_perl_signal_debug_dump_cb;
- init.callback_signal_script_action = &weechat_perl_signal_script_action_cb;
- init.callback_load_file = &weechat_perl_load_cb;
+ perl_data.config_file = &perl_config_file;
+ perl_data.config_look_check_license = &perl_config_look_check_license;
+ perl_data.scripts = &perl_scripts;
+ perl_data.last_script = &last_perl_script;
+ perl_data.callback_command = &weechat_perl_command_cb;
+ perl_data.callback_completion = &weechat_perl_completion_cb;
+ perl_data.callback_hdata = &weechat_perl_hdata_cb;
+ perl_data.callback_info_eval = &weechat_perl_info_eval_cb;
+ perl_data.callback_infolist = &weechat_perl_infolist_cb;
+ perl_data.callback_signal_debug_dump = &weechat_perl_signal_debug_dump_cb;
+ perl_data.callback_signal_script_action = &weechat_perl_signal_script_action_cb;
+ perl_data.callback_load_file = &weechat_perl_load_cb;
+ perl_data.unload_all = &weechat_perl_unload_all;
perl_quiet = 1;
- plugin_script_init (weechat_perl_plugin, argc, argv, &init);
+ plugin_script_init (weechat_perl_plugin, argc, argv, &perl_data);
perl_quiet = 0;
plugin_script_display_short_list (weechat_perl_plugin,
@@ -1287,7 +1296,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* unload all scripts */
perl_quiet = 1;
- plugin_script_end (plugin, &perl_scripts, &weechat_perl_unload_all);
+ plugin_script_end (plugin, &perl_data);
if (perl_script_eval)
{
weechat_perl_unload (perl_script_eval);
diff --git a/src/plugins/perl/weechat-perl.h b/src/plugins/perl/weechat-perl.h
index 318f28ca5..84914ae72 100644
--- a/src/plugins/perl/weechat-perl.h
+++ b/src/plugins/perl/weechat-perl.h
@@ -27,6 +27,8 @@
extern struct t_weechat_plugin *weechat_perl_plugin;
+extern struct t_plugin_script_data perl_data;
+
extern int perl_quiet;
extern struct t_plugin_script *perl_scripts;
extern struct t_plugin_script *last_perl_script;
diff --git a/src/plugins/php/weechat-php-api.c b/src/plugins/php/weechat-php-api.c
index f272b79a7..ba66cddff 100644
--- a/src/plugins/php/weechat-php-api.c
+++ b/src/plugins/php/weechat-php-api.c
@@ -130,7 +130,7 @@ API_FUNC(register)
/* register script */
php_current_script = plugin_script_add (weechat_php_plugin,
- &php_scripts, &last_php_script,
+ &php_data,
(php_current_script_filename) ?
php_current_script_filename : "",
ZSTR_VAL(name),
diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c
index 1db9f8a0d..379867a2e 100644
--- a/src/plugins/php/weechat-php.c
+++ b/src/plugins/php/weechat-php.c
@@ -39,6 +39,11 @@ WEECHAT_PLUGIN_PRIORITY(4000);
struct t_weechat_plugin *weechat_php_plugin = NULL;
+struct t_plugin_script_data php_data;
+
+struct t_config_file *php_config_file = NULL;
+struct t_config_option *php_config_look_check_license = NULL;
+
int php_quiet = 0;
struct t_plugin_script *php_script_eval = NULL;
@@ -1234,8 +1239,6 @@ php_weechat_log_message (char *message)
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
- struct t_plugin_script_init init;
-
weechat_php_plugin = plugin;
/* set interpreter name and version */
@@ -1249,14 +1252,19 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
"");
#endif /* PHP_VERSION */
- init.callback_command = &weechat_php_command_cb;
- init.callback_completion = &weechat_php_completion_cb;
- init.callback_hdata = &weechat_php_hdata_cb;
- init.callback_info_eval = &weechat_php_info_eval_cb;
- init.callback_infolist = &weechat_php_infolist_cb;
- init.callback_signal_debug_dump = &weechat_php_signal_debug_dump_cb;
- init.callback_signal_script_action = &weechat_php_signal_script_action_cb;
- init.callback_load_file = &weechat_php_load_cb;
+ php_data.config_file = &php_config_file;
+ php_data.config_look_check_license = &php_config_look_check_license;
+ php_data.scripts = &php_scripts;
+ php_data.last_script = &last_php_script;
+ php_data.callback_command = &weechat_php_command_cb;
+ php_data.callback_completion = &weechat_php_completion_cb;
+ php_data.callback_hdata = &weechat_php_hdata_cb;
+ php_data.callback_info_eval = &weechat_php_info_eval_cb;
+ php_data.callback_infolist = &weechat_php_infolist_cb;
+ php_data.callback_signal_debug_dump = &weechat_php_signal_debug_dump_cb;
+ php_data.callback_signal_script_action = &weechat_php_signal_script_action_cb;
+ php_data.callback_load_file = &weechat_php_load_cb;
+ php_data.unload_all = &weechat_php_unload_all;
php_embed_module.startup = php_weechat_startup;
php_embed_module.ub_write = php_weechat_ub_write;
@@ -1269,7 +1277,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, &init);
+ plugin_script_init (weechat_php_plugin, argc, argv, &php_data);
php_quiet = 0;
plugin_script_display_short_list (weechat_php_plugin,
@@ -1288,7 +1296,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* unload all scripts */
php_quiet = 1;
- plugin_script_end (plugin, &php_scripts, &weechat_php_unload_all);
+ plugin_script_end (plugin, &php_data);
if (php_script_eval)
{
weechat_php_unload (php_script_eval);
diff --git a/src/plugins/php/weechat-php.h b/src/plugins/php/weechat-php.h
index c645f5657..50eb882b5 100644
--- a/src/plugins/php/weechat-php.h
+++ b/src/plugins/php/weechat-php.h
@@ -34,11 +34,13 @@ struct t_php_const
char *str_value;
};
-extern int php_quiet;
extern struct t_weechat_plugin *weechat_php_plugin;
+extern struct t_plugin_script_data php_data;
+
extern struct t_hashtable *weechat_php_function_map;
+extern int php_quiet;
extern struct t_plugin_script *php_scripts;
extern struct t_plugin_script *last_php_script;
extern struct t_plugin_script *php_current_script;
diff --git a/src/plugins/plugin-script-config.c b/src/plugins/plugin-script-config.c
new file mode 100644
index 000000000..9bbd1bc95
--- /dev/null
+++ b/src/plugins/plugin-script-config.c
@@ -0,0 +1,72 @@
+/*
+ * plugin-script-config.c - configuration options, used by script plugins
+ *
+ * Copyright (C) 2003-2018 Sébastien Helleu <flashcode@flashtux.org>
+ *
+ * This file is part of WeeChat, the extensible chat client.
+ *
+ * WeeChat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * WeeChat is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdlib.h>
+
+#include "weechat-plugin.h"
+#include "plugin-script.h"
+
+
+/*
+ * Initializes script configuration.
+ *
+ * Returns:
+ * 1: OK
+ * 0: error
+ */
+
+int
+plugin_script_config_init (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script_data *plugin_data)
+{
+ struct t_config_section *ptr_section;
+
+ *(plugin_data->config_file) = weechat_config_new (weechat_plugin->name,
+ NULL, NULL, NULL);
+ if (!(*plugin_data->config_file))
+ return 0;
+
+ /* look */
+ ptr_section = weechat_config_new_section (*(plugin_data->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 (*(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);
+
+ return 1;
+}
diff --git a/src/plugins/plugin-script-config.h b/src/plugins/plugin-script-config.h
new file mode 100644
index 000000000..59b4672cd
--- /dev/null
+++ b/src/plugins/plugin-script-config.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2003-2018 Sébastien Helleu <flashcode@flashtux.org>
+ *
+ * This file is part of WeeChat, the extensible chat client.
+ *
+ * WeeChat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * WeeChat is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WEECHAT_PLUGIN_PLUGIN_SCRIPT_CONFIG_H
+#define WEECHAT_PLUGIN_PLUGIN_SCRIPT_CONFIG_H
+
+extern int plugin_script_config_init (struct t_weechat_plugin *plugin,
+ struct t_plugin_script_data *plugin_data);
+
+#endif /* WEECHAT_PLUGIN_PLUGIN_SCRIPT_CONFIG_H */
diff --git a/src/plugins/plugin-script.c b/src/plugins/plugin-script.c
index c4534824d..dca382d07 100644
--- a/src/plugins/plugin-script.c
+++ b/src/plugins/plugin-script.c
@@ -33,57 +33,10 @@
#include "weechat-plugin.h"
#include "plugin-script.h"
-
-
-#define SCRIPT_OPTION_CHECK_LICENSE "check_license"
-
-int script_option_check_license = 0;
+#include "plugin-script-config.h"
/*
- * Reads script configuration.
- */
-
-void
-plugin_script_config_read (struct t_weechat_plugin *weechat_plugin)
-{
- const char *string;
-
- string = weechat_config_get_plugin (SCRIPT_OPTION_CHECK_LICENSE);
- if (!string)
- {
- weechat_config_set_plugin (SCRIPT_OPTION_CHECK_LICENSE, "off");
- string = weechat_config_get_plugin (SCRIPT_OPTION_CHECK_LICENSE);
- }
- if (string && (weechat_config_string_to_boolean (string) > 0))
- script_option_check_license = 1;
- else
- script_option_check_license = 0;
-}
-
-/*
- * Callback for changes on configuration option.
- */
-
-int
-plugin_script_config_cb (const void *pointer, void *data,
- const char *option, const char *value)
-{
- struct t_weechat_plugin *plugin;
-
- /* make C compiler happy */
- (void) data;
- (void) option;
- (void) value;
-
- plugin = (struct t_weechat_plugin *)pointer;
-
- plugin_script_config_read (plugin);
-
- return WEECHAT_RC_OK;
-}
-
-/*
* Displays name and version of interpreter used.
*/
@@ -212,22 +165,17 @@ plugin_script_create_dirs (struct t_weechat_plugin *weechat_plugin)
void
plugin_script_init (struct t_weechat_plugin *weechat_plugin,
int argc, char *argv[],
- struct t_plugin_script_init *init)
+ struct t_plugin_script_data *plugin_data)
{
char string[512], *completion;
char *action_signals[] = { "install", "remove", "autoload", NULL };
int i, auto_load_scripts;
- /* read script configuration */
- plugin_script_config_read (weechat_plugin);
+ /* initialize script configuration file (file: "<language>.conf") */
+ plugin_script_config_init (weechat_plugin, plugin_data);
- /* add hook for configuration option */
- snprintf (string, sizeof (string),
- "plugins.var.%s.%s",
- weechat_plugin->name,
- SCRIPT_OPTION_CHECK_LICENSE);
- weechat_hook_config (string,
- &plugin_script_config_cb, weechat_plugin, NULL);
+ /* read configuration file */
+ weechat_config_read (*plugin_data->config_file);
/* create directories in WeeChat home */
plugin_script_create_dirs (weechat_plugin);
@@ -276,29 +224,29 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
"\n"
"Without argument, this command lists all loaded scripts."),
completion,
- init->callback_command, NULL, NULL);
+ plugin_data->callback_command, NULL, NULL);
if (completion)
free (completion);
/* add completion, hdata and infolist */
snprintf (string, sizeof (string), "%s_script", weechat_plugin->name);
weechat_hook_completion (string, N_("list of scripts"),
- init->callback_completion, NULL, NULL);
+ plugin_data->callback_completion, NULL, NULL);
weechat_hook_hdata (string, N_("list of scripts"),
- init->callback_hdata, weechat_plugin, NULL);
+ plugin_data->callback_hdata, weechat_plugin, NULL);
weechat_hook_infolist (string, N_("list of scripts"),
N_("script pointer (optional)"),
N_("script name (wildcard \"*\" is allowed) "
"(optional)"),
- init->callback_infolist, NULL, NULL);
+ plugin_data->callback_infolist, NULL, NULL);
snprintf (string, sizeof (string), "%s_eval", weechat_plugin->name);
weechat_hook_info (string, N_("evaluation of source code"),
N_("source code to execute"),
- init->callback_info_eval, NULL, NULL);
+ plugin_data->callback_info_eval, NULL, NULL);
/* add signal for "debug_dump" */
weechat_hook_signal ("debug_dump",
- init->callback_signal_debug_dump, NULL, NULL);
+ plugin_data->callback_signal_debug_dump, NULL, NULL);
/* add signal for "debug_libs" */
weechat_hook_signal ("debug_libs",
@@ -310,8 +258,9 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
{
snprintf (string, sizeof (string),
"%s_script_%s", weechat_plugin->name, action_signals[i]);
- weechat_hook_signal (string,
- init->callback_signal_script_action, NULL, NULL);
+ weechat_hook_signal (
+ string,
+ plugin_data->callback_signal_script_action, NULL, NULL);
}
/* add infos */
@@ -338,7 +287,8 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
/* autoload scripts */
if (auto_load_scripts)
{
- plugin_script_auto_load (weechat_plugin, init->callback_load_file);
+ plugin_script_auto_load (weechat_plugin,
+ plugin_data->callback_load_file);
}
}
@@ -762,8 +712,7 @@ plugin_script_alloc (const char *filename, const char *name,
struct t_plugin_script *
plugin_script_add (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script **scripts,
- struct t_plugin_script **last_script,
+ struct t_plugin_script_data *plugin_data,
const char *filename, const char *name, const char *author,
const char *version, const char *license,
const char *description, const char *shutdown_func,
@@ -780,7 +729,7 @@ plugin_script_add (struct t_weechat_plugin *weechat_plugin,
return NULL;
}
- if (script_option_check_license
+ if (weechat_config_boolean (*(plugin_data->config_look_check_license))
&& (weechat_strcmp_ignore_chars (weechat_plugin->license, license,
"0123456789-.,/\\()[]{}", 0) != 0))
{
@@ -805,7 +754,9 @@ plugin_script_add (struct t_weechat_plugin *weechat_plugin,
/* add script to the list (except the internal "eval" fake script) */
if (strcmp (new_script->name, WEECHAT_SCRIPT_EVAL_NAME) != 0)
{
- plugin_script_insert_sorted (weechat_plugin, scripts, last_script,
+ plugin_script_insert_sorted (weechat_plugin,
+ plugin_data->scripts,
+ plugin_data->last_script,
new_script);
}
@@ -1787,20 +1738,22 @@ plugin_script_infolist_list_scripts (struct t_weechat_plugin *weechat_plugin,
void
plugin_script_end (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script **scripts,
- void (*callback_unload_all)())
+ struct t_plugin_script_data *plugin_data)
{
int scripts_loaded;
- scripts_loaded = (*scripts) ? 1 : 0;
-
- (void)(callback_unload_all) ();
-
+ /* unload all scripts */
+ scripts_loaded = (*(plugin_data->scripts)) ? 1 : 0;
+ (void)(plugin_data->unload_all) ();
if (scripts_loaded)
{
weechat_printf (NULL, _("%s: scripts unloaded"),
weechat_plugin->name);
}
+
+ /* write config file (file: "<language>.conf") */
+ weechat_config_write (*(plugin_data->config_file));
+ weechat_config_free (*(plugin_data->config_file));
}
/*
diff --git a/src/plugins/plugin-script.h b/src/plugins/plugin-script.h
index 324b199f8..0d6ad4ac6 100644
--- a/src/plugins/plugin-script.h
+++ b/src/plugins/plugin-script.h
@@ -69,43 +69,53 @@ struct t_plugin_script
struct t_plugin_script *next_script; /* link to next script */
};
-struct t_plugin_script_init
+struct t_plugin_script_data
{
- int (*callback_command)(const void *pointer, void *data,
- struct t_gui_buffer *buffer,
- int argc, char **argv, char **argv_eol);
- int (*callback_completion)(const void *pointer, void *data,
- const char *completion_item,
- struct t_gui_buffer *buffer,
- struct t_gui_completion *completion);
- struct t_hdata *(*callback_hdata)(const void *pointer,
- void *data,
- const char *hdata_name);
- const char *(*callback_info_eval)(const void *pointer,
- void *data,
- const char *info_name,
- const char *arguments);
- struct t_infolist *(*callback_infolist)(const void *pointer,
- void *data,
- const char *infolist_name,
- void *obj_pointer,
- const char *arguments);
- int (*callback_signal_debug_dump)(const void *pointer, void *data,
- const char *signal,
- const char *type_data,
- void *signal_data);
- int (*callback_signal_script_action)(const void *pointer, void *data,
- const char *signal,
- const char *type_data,
- void *signal_data);
- void (*callback_load_file)(void *data, const char *filename);
+ /* variables */
+ struct t_config_file **config_file;
+ struct t_config_option **config_look_check_license;
+ struct t_plugin_script **scripts;
+ struct t_plugin_script **last_script;
+
+ /* callbacks */
+ int (*callback_command) (const void *pointer, void *data,
+ struct t_gui_buffer *buffer,
+ int argc, char **argv, char **argv_eol);
+ int (*callback_completion) (const void *pointer, void *data,
+ const char *completion_item,
+ struct t_gui_buffer *buffer,
+ struct t_gui_completion *completion);
+ struct t_hdata *(*callback_hdata) (const void *pointer,
+ void *data,
+ const char *hdata_name);
+ const char *(*callback_info_eval) (const void *pointer,
+ void *data,
+ const char *info_name,
+ const char *arguments);
+ struct t_infolist *(*callback_infolist) (const void *pointer,
+ void *data,
+ const char *infolist_name,
+ void *obj_pointer,
+ const char *arguments);
+ int (*callback_signal_debug_dump) (const void *pointer, void *data,
+ const char *signal,
+ const char *type_data,
+ void *signal_data);
+ int (*callback_signal_script_action) (const void *pointer, void *data,
+ const char *signal,
+ const char *type_data,
+ void *signal_data);
+ void (*callback_load_file) (void *data, const char *filename);
+
+ /* functions */
+ void (*unload_all) ();
};
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_init *init);
+ struct t_plugin_script_data *plugin_data);
extern int plugin_script_valid (struct t_plugin_script *scripts,
struct t_plugin_script *script);
extern char *plugin_script_ptr2str (void *pointer);
@@ -135,8 +145,7 @@ extern struct t_plugin_script *plugin_script_alloc (const char *filename,
const char *shutdown_func,
const char *charset);
extern struct t_plugin_script *plugin_script_add (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script **scripts,
- struct t_plugin_script **last_script,
+ struct t_plugin_script_data *plugin_data,
const char *filename,
const char *name,
const char *author,
@@ -196,8 +205,7 @@ extern struct t_infolist *plugin_script_infolist_list_scripts (struct t_weechat_
void *pointer,
const char *arguments);
extern void plugin_script_end (struct t_weechat_plugin *weechat_plugin,
- struct t_plugin_script **scripts,
- void (*callback_unload_all)());
+ struct t_plugin_script_data *plugin_data);
extern void plugin_script_print_log (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *scripts);
diff --git a/src/plugins/python/weechat-python-api.c b/src/plugins/python/weechat-python-api.c
index b9b3ba14c..a6f812a2c 100644
--- a/src/plugins/python/weechat-python-api.c
+++ b/src/plugins/python/weechat-python-api.c
@@ -128,7 +128,7 @@ API_FUNC(register)
/* register script */
python_current_script = plugin_script_add (weechat_python_plugin,
- &python_scripts, &last_python_script,
+ &python_data,
(python_current_script_filename) ?
python_current_script_filename : "",
name, author, version, license,
diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c
index e34485417..4d5f58003 100644
--- a/src/plugins/python/weechat-python.c
+++ b/src/plugins/python/weechat-python.c
@@ -44,6 +44,11 @@ WEECHAT_PLUGIN_PRIORITY(4000);
struct t_weechat_plugin *weechat_python_plugin = NULL;
+struct t_plugin_script_data python_data;
+
+struct t_config_file *python_config_file = NULL;
+struct t_config_option *python_config_look_check_license = NULL;
+
int python_quiet = 0;
struct t_plugin_script *python_script_eval = NULL;
@@ -1470,8 +1475,6 @@ weechat_python_signal_script_action_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
- struct t_plugin_script_init init;
-
weechat_python_plugin = plugin;
/* set interpreter name and version */
@@ -1529,17 +1532,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
return WEECHAT_RC_ERROR;
}
- init.callback_command = &weechat_python_command_cb;
- init.callback_completion = &weechat_python_completion_cb;
- init.callback_hdata = &weechat_python_hdata_cb;
- init.callback_info_eval = &weechat_python_info_eval_cb;
- init.callback_infolist = &weechat_python_infolist_cb;
- init.callback_signal_debug_dump = &weechat_python_signal_debug_dump_cb;
- init.callback_signal_script_action = &weechat_python_signal_script_action_cb;
- init.callback_load_file = &weechat_python_load_cb;
+ python_data.config_file = &python_config_file;
+ python_data.config_look_check_license = &python_config_look_check_license;
+ python_data.scripts = &python_scripts;
+ python_data.last_script = &last_python_script;
+ python_data.callback_command = &weechat_python_command_cb;
+ python_data.callback_completion = &weechat_python_completion_cb;
+ python_data.callback_hdata = &weechat_python_hdata_cb;
+ python_data.callback_info_eval = &weechat_python_info_eval_cb;
+ python_data.callback_infolist = &weechat_python_infolist_cb;
+ python_data.callback_signal_debug_dump = &weechat_python_signal_debug_dump_cb;
+ python_data.callback_signal_script_action = &weechat_python_signal_script_action_cb;
+ python_data.callback_load_file = &weechat_python_load_cb;
+ python_data.unload_all = &weechat_python_unload_all;
python_quiet = 1;
- plugin_script_init (weechat_python_plugin, argc, argv, &init);
+ plugin_script_init (weechat_python_plugin, argc, argv, &python_data);
python_quiet = 0;
plugin_script_display_short_list (weechat_python_plugin,
@@ -1558,7 +1566,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* unload all scripts */
python_quiet = 1;
- plugin_script_end (plugin, &python_scripts, &weechat_python_unload_all);
+ plugin_script_end (plugin, &python_data);
if (python_script_eval)
{
weechat_python_unload (python_script_eval);
diff --git a/src/plugins/python/weechat-python.h b/src/plugins/python/weechat-python.h
index 62de5ca6d..af6a27984 100644
--- a/src/plugins/python/weechat-python.h
+++ b/src/plugins/python/weechat-python.h
@@ -44,6 +44,8 @@
extern struct t_weechat_plugin *weechat_python_plugin;
+extern struct t_plugin_script_data python_data;
+
extern int python_quiet;
extern struct t_plugin_script *python_scripts;
extern struct t_plugin_script *last_python_script;
diff --git a/src/plugins/ruby/weechat-ruby-api.c b/src/plugins/ruby/weechat-ruby-api.c
index 84da52a96..60bc49053 100644
--- a/src/plugins/ruby/weechat-ruby-api.c
+++ b/src/plugins/ruby/weechat-ruby-api.c
@@ -137,7 +137,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
/* register script */
ruby_current_script = plugin_script_add (weechat_ruby_plugin,
- &ruby_scripts, &last_ruby_script,
+ &ruby_data,
(ruby_current_script_filename) ?
ruby_current_script_filename : "",
c_name, c_author, c_version, c_license,
diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c
index 64242e3b8..5386f7759 100644
--- a/src/plugins/ruby/weechat-ruby.c
+++ b/src/plugins/ruby/weechat-ruby.c
@@ -65,6 +65,11 @@ WEECHAT_PLUGIN_PRIORITY(4000);
struct t_weechat_plugin *weechat_ruby_plugin = NULL;
+struct t_plugin_script_data ruby_data;
+
+struct t_config_file *ruby_config_file = NULL;
+struct t_config_option *ruby_config_look_check_license = NULL;
+
int ruby_quiet = 0;
int ruby_hide_errors = 0;
@@ -1238,7 +1243,6 @@ weechat_ruby_signal_script_action_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
- struct t_plugin_script_init init;
int ruby_error;
VALUE err;
char *weechat_ruby_code = {
@@ -1361,17 +1365,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
ruby_init_loadpath ();
- init.callback_command = &weechat_ruby_command_cb;
- init.callback_completion = &weechat_ruby_completion_cb;
- init.callback_hdata = &weechat_ruby_hdata_cb;
- init.callback_info_eval = &weechat_ruby_info_eval_cb;
- init.callback_infolist = &weechat_ruby_infolist_cb;
- init.callback_signal_debug_dump = &weechat_ruby_signal_debug_dump_cb;
- init.callback_signal_script_action = &weechat_ruby_signal_script_action_cb;
- init.callback_load_file = &weechat_ruby_load_cb;
+ ruby_data.config_file = &ruby_config_file;
+ ruby_data.config_look_check_license = &ruby_config_look_check_license;
+ ruby_data.scripts = &ruby_scripts;
+ ruby_data.last_script = &last_ruby_script;
+ ruby_data.callback_command = &weechat_ruby_command_cb;
+ ruby_data.callback_completion = &weechat_ruby_completion_cb;
+ ruby_data.callback_hdata = &weechat_ruby_hdata_cb;
+ ruby_data.callback_info_eval = &weechat_ruby_info_eval_cb;
+ ruby_data.callback_infolist = &weechat_ruby_infolist_cb;
+ ruby_data.callback_signal_debug_dump = &weechat_ruby_signal_debug_dump_cb;
+ ruby_data.callback_signal_script_action = &weechat_ruby_signal_script_action_cb;
+ ruby_data.callback_load_file = &weechat_ruby_load_cb;
+ ruby_data.unload_all = &weechat_ruby_unload_all;
ruby_quiet = 1;
- plugin_script_init (weechat_ruby_plugin, argc, argv, &init);
+ plugin_script_init (weechat_ruby_plugin, argc, argv, &ruby_data);
ruby_quiet = 0;
plugin_script_display_short_list (weechat_ruby_plugin,
@@ -1390,7 +1399,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* unload all scripts */
ruby_quiet = 1;
- plugin_script_end (plugin, &ruby_scripts, &weechat_ruby_unload_all);
+ plugin_script_end (plugin, &ruby_data);
if (ruby_script_eval)
{
weechat_ruby_unload (ruby_script_eval);
diff --git a/src/plugins/ruby/weechat-ruby.h b/src/plugins/ruby/weechat-ruby.h
index 85d91b350..938944759 100644
--- a/src/plugins/ruby/weechat-ruby.h
+++ b/src/plugins/ruby/weechat-ruby.h
@@ -28,6 +28,8 @@
extern struct t_weechat_plugin *weechat_ruby_plugin;
+extern struct t_plugin_script_data ruby_data;
+
extern int ruby_quiet;
extern struct t_plugin_script *ruby_scripts;
extern struct t_plugin_script *last_ruby_script;
diff --git a/src/plugins/tcl/weechat-tcl-api.c b/src/plugins/tcl/weechat-tcl-api.c
index 3d4975a53..1ad4c1151 100644
--- a/src/plugins/tcl/weechat-tcl-api.c
+++ b/src/plugins/tcl/weechat-tcl-api.c
@@ -259,7 +259,7 @@ API_FUNC(register)
/* register script */
tcl_current_script = plugin_script_add (weechat_tcl_plugin,
- &tcl_scripts, &last_tcl_script,
+ &tcl_data,
(tcl_current_script_filename) ?
tcl_current_script_filename : "",
name, author, version, license,
diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c
index 11f80ff43..fd228c791 100644
--- a/src/plugins/tcl/weechat-tcl.c
+++ b/src/plugins/tcl/weechat-tcl.c
@@ -44,6 +44,11 @@ WEECHAT_PLUGIN_PRIORITY(4000);
struct t_weechat_plugin *weechat_tcl_plugin = NULL;
+struct t_plugin_script_data tcl_data;
+
+struct t_config_file *tcl_config_file = NULL;
+struct t_config_option *tcl_config_look_check_license = NULL;
+
int tcl_quiet = 0;
struct t_plugin_script *tcl_script_eval = NULL;
@@ -904,8 +909,6 @@ weechat_tcl_signal_script_action_cb (const void *pointer, void *data,
int
weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
{
- struct t_plugin_script_init init;
-
weechat_tcl_plugin = plugin;
/* set interpreter name and version */
@@ -919,17 +922,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
"");
#endif /* TCL_VERSION */
- init.callback_command = &weechat_tcl_command_cb;
- init.callback_completion = &weechat_tcl_completion_cb;
- init.callback_hdata = &weechat_tcl_hdata_cb;
- init.callback_info_eval = &weechat_tcl_info_eval_cb;
- init.callback_infolist = &weechat_tcl_infolist_cb;
- init.callback_signal_debug_dump = &weechat_tcl_signal_debug_dump_cb;
- init.callback_signal_script_action = &weechat_tcl_signal_script_action_cb;
- init.callback_load_file = &weechat_tcl_load_cb;
+ tcl_data.config_file = &tcl_config_file;
+ tcl_data.config_look_check_license = &tcl_config_look_check_license;
+ tcl_data.scripts = &tcl_scripts;
+ tcl_data.last_script = &last_tcl_script;
+ tcl_data.callback_command = &weechat_tcl_command_cb;
+ tcl_data.callback_completion = &weechat_tcl_completion_cb;
+ tcl_data.callback_hdata = &weechat_tcl_hdata_cb;
+ tcl_data.callback_info_eval = &weechat_tcl_info_eval_cb;
+ tcl_data.callback_infolist = &weechat_tcl_infolist_cb;
+ tcl_data.callback_signal_debug_dump = &weechat_tcl_signal_debug_dump_cb;
+ tcl_data.callback_signal_script_action = &weechat_tcl_signal_script_action_cb;
+ tcl_data.callback_load_file = &weechat_tcl_load_cb;
+ tcl_data.unload_all = &weechat_tcl_unload_all;
tcl_quiet = 1;
- plugin_script_init (weechat_tcl_plugin, argc, argv, &init);
+ plugin_script_init (weechat_tcl_plugin, argc, argv, &tcl_data);
tcl_quiet = 0;
plugin_script_display_short_list (weechat_tcl_plugin,
@@ -948,7 +956,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
{
/* unload all scripts */
tcl_quiet = 1;
- plugin_script_end (plugin, &tcl_scripts, &weechat_tcl_unload_all);
+ plugin_script_end (plugin, &tcl_data);
if (tcl_script_eval)
{
weechat_tcl_unload (tcl_script_eval);
diff --git a/src/plugins/tcl/weechat-tcl.h b/src/plugins/tcl/weechat-tcl.h
index 63e4d5ab4..c5fa8c359 100644
--- a/src/plugins/tcl/weechat-tcl.h
+++ b/src/plugins/tcl/weechat-tcl.h
@@ -28,6 +28,8 @@
extern struct t_weechat_plugin *weechat_tcl_plugin;
+extern struct t_plugin_script_data tcl_data;
+
extern int tcl_quiet;
extern struct t_plugin_script *tcl_scripts;
extern struct t_plugin_script *last_tcl_script;