mirror of
https://github.com/weechat/weechat.git
synced 2026-07-07 18:23:13 +02:00
scripts: add configuration file for each script plugin
This commit is contained in:
@@ -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})
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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 */
|
||||
+30
-77
@@ -33,56 +33,9 @@
|
||||
|
||||
#include "weechat-plugin.h"
|
||||
#include "plugin-script.h"
|
||||
#include "plugin-script-config.h"
|
||||
|
||||
|
||||
#define SCRIPT_OPTION_CHECK_LICENSE "check_license"
|
||||
|
||||
int script_option_check_license = 0;
|
||||
|
||||
|
||||
/*
|
||||
* 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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+42
-34
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user