mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 23:06:38 +02:00
scripts: add option "version" in script commands (closes #1075)
This commit is contained in:
@@ -629,6 +629,10 @@ weechat_guile_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
weechat_guile_unload_all ();
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "version") == 0)
|
||||
{
|
||||
plugin_script_display_interpreter (weechat_guile_plugin, 0);
|
||||
}
|
||||
else
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
@@ -785,35 +789,6 @@ weechat_guile_signal_debug_dump_cb (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display infos about external libraries used.
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_guile_signal_debug_libs_cb (const void *pointer, void *data,
|
||||
const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
#if defined(SCM_MAJOR_VERSION) && defined(SCM_MINOR_VERSION) && defined(SCM_MICRO_VERSION)
|
||||
weechat_printf (NULL, " %s: %d.%d.%d",
|
||||
GUILE_PLUGIN_NAME,
|
||||
SCM_MAJOR_VERSION,
|
||||
SCM_MINOR_VERSION,
|
||||
SCM_MICRO_VERSION);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", GUILE_PLUGIN_NAME);
|
||||
#endif /* defined(SCM_MAJOR_VERSION) && defined(SCM_MINOR_VERSION) && defined(SCM_MICRO_VERSION) */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer for executing actions.
|
||||
*/
|
||||
@@ -964,9 +939,27 @@ 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;
|
||||
|
||||
/* set interpreter name and version */
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_name",
|
||||
plugin->name);
|
||||
#if defined(SCM_MAJOR_VERSION) && defined(SCM_MINOR_VERSION) && defined(SCM_MICRO_VERSION)
|
||||
snprintf (str_version, sizeof (str_version),
|
||||
"%d.%d.%d",
|
||||
SCM_MAJOR_VERSION,
|
||||
SCM_MINOR_VERSION,
|
||||
SCM_MICRO_VERSION);
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
str_version);
|
||||
#else
|
||||
(void) str_version;
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
"");
|
||||
#endif /* defined(SCM_MAJOR_VERSION) && defined(SCM_MINOR_VERSION) && defined(SCM_MICRO_VERSION) */
|
||||
|
||||
guile_stdout = NULL;
|
||||
|
||||
#ifdef HAVE_GUILE_GMP_MEMORY_FUNCTIONS
|
||||
@@ -991,7 +984,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_hdata = &weechat_guile_hdata_cb;
|
||||
init.callback_infolist = &weechat_guile_infolist_cb;
|
||||
init.callback_signal_debug_dump = &weechat_guile_signal_debug_dump_cb;
|
||||
init.callback_signal_debug_libs = &weechat_guile_signal_debug_libs_cb;
|
||||
init.callback_signal_script_action = &weechat_guile_signal_script_action_cb;
|
||||
init.callback_load_file = &weechat_guile_load_cb;
|
||||
|
||||
|
||||
@@ -557,6 +557,10 @@ weechat_js_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
weechat_js_unload_all ();
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "version") == 0)
|
||||
{
|
||||
plugin_script_display_interpreter (weechat_js_plugin, 0);
|
||||
}
|
||||
else
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
@@ -702,28 +706,6 @@ weechat_js_signal_debug_dump_cb (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display infos about external libraries used.
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_js_signal_debug_libs_cb (const void *pointer, void *data,
|
||||
const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C++ compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
weechat_printf (NULL, " %s (v8): %s",
|
||||
JS_PLUGIN_NAME, v8::V8::GetVersion());
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer for executing actions.
|
||||
*/
|
||||
@@ -820,15 +802,23 @@ 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;
|
||||
|
||||
/* set interpreter name and version */
|
||||
snprintf (str_interpreter, sizeof (str_interpreter),
|
||||
"%s (v8)", plugin->name);
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_name",
|
||||
str_interpreter);
|
||||
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_infolist = &weechat_js_infolist_cb;
|
||||
init.callback_signal_debug_dump = &weechat_js_signal_debug_dump_cb;
|
||||
init.callback_signal_debug_libs = &weechat_js_signal_debug_libs_cb;
|
||||
init.callback_signal_script_action = &weechat_js_signal_script_action_cb;
|
||||
init.callback_load_file = &weechat_js_load_cb;
|
||||
|
||||
|
||||
@@ -668,6 +668,10 @@ weechat_lua_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
weechat_lua_unload_all ();
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "version") == 0)
|
||||
{
|
||||
plugin_script_display_interpreter (weechat_lua_plugin, 0);
|
||||
}
|
||||
else
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
@@ -813,31 +817,6 @@ weechat_lua_signal_debug_dump_cb (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display infos about external libraries used.
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_lua_signal_debug_libs_cb (const void *pointer, void *data,
|
||||
const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
#ifdef LUA_VERSION
|
||||
weechat_printf (NULL, " %s: %s", LUA_PLUGIN_NAME, LUA_VERSION);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", LUA_PLUGIN_NAME);
|
||||
#endif /* LUA_VERSION */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer for executing actions.
|
||||
*/
|
||||
@@ -936,12 +915,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
weechat_lua_plugin = plugin;
|
||||
|
||||
/* set interpreter name and version */
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_name",
|
||||
plugin->name);
|
||||
#ifdef LUA_VERSION
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
LUA_VERSION);
|
||||
#else
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
"");
|
||||
#endif /* LUA_VERSION */
|
||||
|
||||
init.callback_command = &weechat_lua_command_cb;
|
||||
init.callback_completion = &weechat_lua_completion_cb;
|
||||
init.callback_hdata = &weechat_lua_hdata_cb;
|
||||
init.callback_infolist = &weechat_lua_infolist_cb;
|
||||
init.callback_signal_debug_dump = &weechat_lua_signal_debug_dump_cb;
|
||||
init.callback_signal_debug_libs = &weechat_lua_signal_debug_libs_cb;
|
||||
init.callback_signal_script_action = &weechat_lua_signal_script_action_cb;
|
||||
init.callback_load_file = &weechat_lua_load_cb;
|
||||
|
||||
|
||||
@@ -678,6 +678,10 @@ weechat_perl_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
weechat_perl_unload_all ();
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "version") == 0)
|
||||
{
|
||||
plugin_script_display_interpreter (weechat_perl_plugin, 0);
|
||||
}
|
||||
else
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
@@ -823,31 +827,6 @@ weechat_perl_signal_debug_dump_cb (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display infos about external libraries used.
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_perl_signal_debug_libs_cb (const void *pointer, void *data,
|
||||
const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
#ifdef PERL_VERSION_STRING
|
||||
weechat_printf (NULL, " %s: %s", PERL_PLUGIN_NAME, PERL_VERSION_STRING);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", PERL_PLUGIN_NAME);
|
||||
#endif /* PERL_VERSION_STRING */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer for executing actions.
|
||||
*/
|
||||
@@ -977,6 +956,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
weechat_perl_plugin = plugin;
|
||||
|
||||
/* set interpreter name and version */
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_name",
|
||||
plugin->name);
|
||||
#ifdef PERL_VERSION_STRING
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
PERL_VERSION_STRING);
|
||||
#else
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
"");
|
||||
#endif /* PERL_VERSION_STRING */
|
||||
|
||||
#ifndef MULTIPLICITY
|
||||
perl_main = perl_alloc ();
|
||||
|
||||
@@ -999,7 +989,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_hdata = &weechat_perl_hdata_cb;
|
||||
init.callback_infolist = &weechat_perl_infolist_cb;
|
||||
init.callback_signal_debug_dump = &weechat_perl_signal_debug_dump_cb;
|
||||
init.callback_signal_debug_libs = &weechat_perl_signal_debug_libs_cb;
|
||||
init.callback_signal_script_action = &weechat_perl_signal_script_action_cb;
|
||||
init.callback_load_file = &weechat_perl_load_cb;
|
||||
|
||||
|
||||
@@ -840,6 +840,10 @@ weechat_php_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
weechat_php_unload_all ();
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "version") == 0)
|
||||
{
|
||||
plugin_script_display_interpreter (weechat_php_plugin, 0);
|
||||
}
|
||||
else
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
@@ -985,31 +989,6 @@ weechat_php_signal_debug_dump_cb (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display infos about external libraries used.
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_php_signal_debug_libs_cb (const void *pointer, void *data,
|
||||
const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
#ifdef PHP_VERSION
|
||||
weechat_printf (NULL, " %s: %s", PHP_PLUGIN_NAME, PHP_VERSION);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", PHP_PLUGIN_NAME);
|
||||
#endif /* PHP_VERSION */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer for executing actions.
|
||||
*/
|
||||
@@ -1149,12 +1128,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
weechat_php_plugin = plugin;
|
||||
|
||||
/* set interpreter name and version */
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_name",
|
||||
plugin->name);
|
||||
#ifdef PHP_VERSION
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
PHP_VERSION);
|
||||
#else
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
"");
|
||||
#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_infolist = &weechat_php_infolist_cb;
|
||||
init.callback_signal_debug_dump = &weechat_php_signal_debug_dump_cb;
|
||||
init.callback_signal_debug_libs = &weechat_php_signal_debug_libs_cb;
|
||||
init.callback_signal_script_action = &weechat_php_signal_script_action_cb;
|
||||
init.callback_load_file = &weechat_php_load_cb;
|
||||
|
||||
|
||||
@@ -83,6 +83,55 @@ plugin_script_config_cb (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Displays name and version of interpreter used.
|
||||
*/
|
||||
|
||||
void
|
||||
plugin_script_display_interpreter (struct t_weechat_plugin *weechat_plugin,
|
||||
int indent)
|
||||
{
|
||||
const char *ptr_name, *ptr_version;
|
||||
|
||||
ptr_name = weechat_hashtable_get (weechat_plugin->variables,
|
||||
"interpreter_name");
|
||||
ptr_version = weechat_hashtable_get (weechat_plugin->variables,
|
||||
"interpreter_version");
|
||||
if (ptr_name)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
"%s%s: %s",
|
||||
(indent) ? " " : "",
|
||||
ptr_name,
|
||||
(ptr_version && ptr_version[0]) ? ptr_version : "(?)");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback for signal "debug_libs".
|
||||
*/
|
||||
|
||||
int
|
||||
plugin_script_signal_debug_libs_cb (const void *pointer, void *data,
|
||||
const char *signal,
|
||||
const char *type_data,
|
||||
void *signal_data)
|
||||
{
|
||||
struct t_weechat_plugin *plugin;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
plugin = (struct t_weechat_plugin *)pointer;
|
||||
|
||||
plugin_script_display_interpreter (plugin, 1);
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates directories for plugin in WeeChat home:
|
||||
* - ~/.weechat/XXX/
|
||||
@@ -156,7 +205,8 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
|
||||
" || load %(filename)"
|
||||
" || autoload"
|
||||
" || reload %s"
|
||||
" || unload %s",
|
||||
" || unload %s"
|
||||
" || version",
|
||||
"%s",
|
||||
string);
|
||||
}
|
||||
@@ -166,7 +216,8 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
|
||||
N_("list|listfull [<name>]"
|
||||
" || load [-q] <filename>"
|
||||
" || autoload"
|
||||
" || reload|unload [-q] [<name>]"),
|
||||
" || reload|unload [-q] [<name>]"
|
||||
" || version"),
|
||||
N_(" list: list loaded scripts\n"
|
||||
"listfull: list loaded scripts (verbose)\n"
|
||||
" load: load a script\n"
|
||||
@@ -178,6 +229,7 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
|
||||
" name: a script name (name used in call to \"register\" "
|
||||
"function)\n"
|
||||
" -q: quiet mode: do not display messages\n"
|
||||
" version: display the version of interpreter used\n"
|
||||
"\n"
|
||||
"Without argument, this command lists all loaded scripts."),
|
||||
completion,
|
||||
@@ -211,7 +263,8 @@ plugin_script_init (struct t_weechat_plugin *weechat_plugin,
|
||||
|
||||
/* add signal for "debug_libs" */
|
||||
weechat_hook_signal ("debug_libs",
|
||||
init->callback_signal_debug_libs, NULL, NULL);
|
||||
plugin_script_signal_debug_libs_cb,
|
||||
weechat_plugin, NULL);
|
||||
|
||||
/* add signals for script actions (install/remove/autoload) */
|
||||
for (i = 0; action_signals[i]; i++)
|
||||
|
||||
@@ -87,10 +87,6 @@ struct t_plugin_script_init
|
||||
const char *signal,
|
||||
const char *type_data,
|
||||
void *signal_data);
|
||||
int (*callback_signal_debug_libs)(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,
|
||||
@@ -98,6 +94,8 @@ struct t_plugin_script_init
|
||||
void (*callback_load_file)(void *data, const char *filename);
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
@@ -968,6 +968,10 @@ weechat_python_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
weechat_python_unload_all ();
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "version") == 0)
|
||||
{
|
||||
plugin_script_display_interpreter (weechat_python_plugin, 0);
|
||||
}
|
||||
else
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
@@ -1148,31 +1152,6 @@ weechat_python_signal_debug_dump_cb (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display infos about external libraries used.
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_python_signal_debug_libs_cb (const void *pointer, void *data,
|
||||
const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
#ifdef PY_VERSION
|
||||
weechat_printf (NULL, " %s: %s", PYTHON_PLUGIN_NAME, PY_VERSION);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", PYTHON_PLUGIN_NAME);
|
||||
#endif /* PY_VERSION */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer for executing actions.
|
||||
*/
|
||||
@@ -1272,6 +1251,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
weechat_python_plugin = plugin;
|
||||
|
||||
/* set interpreter name and version */
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_name",
|
||||
plugin->name);
|
||||
#ifdef PY_VERSION
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
PY_VERSION);
|
||||
#else
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
"");
|
||||
#endif /* PY_VERSION */
|
||||
|
||||
/*
|
||||
* hook info to get path to python 2.x interpreter
|
||||
* (some scripts using hook_process need that)
|
||||
@@ -1317,7 +1307,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_hdata = &weechat_python_hdata_cb;
|
||||
init.callback_infolist = &weechat_python_infolist_cb;
|
||||
init.callback_signal_debug_dump = &weechat_python_signal_debug_dump_cb;
|
||||
init.callback_signal_debug_libs = &weechat_python_signal_debug_libs_cb;
|
||||
init.callback_signal_script_action = &weechat_python_signal_script_action_cb;
|
||||
init.callback_load_file = &weechat_python_load_cb;
|
||||
|
||||
|
||||
@@ -816,6 +816,10 @@ weechat_ruby_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
weechat_ruby_unload_all ();
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "version") == 0)
|
||||
{
|
||||
plugin_script_display_interpreter (weechat_ruby_plugin, 0);
|
||||
}
|
||||
else
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
@@ -961,31 +965,6 @@ weechat_ruby_signal_debug_dump_cb (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display infos about external libraries used.
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_signal_debug_libs_cb (const void *pointer, void *data,
|
||||
const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
#ifdef HAVE_RUBY_VERSION_H
|
||||
weechat_printf (NULL, " %s: %s", RUBY_PLUGIN_NAME, ruby_version);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", RUBY_PLUGIN_NAME);
|
||||
#endif /* HAVE_RUBY_VERSION_H */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer for executing actions.
|
||||
*/
|
||||
@@ -1139,6 +1118,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
weechat_ruby_plugin = plugin;
|
||||
|
||||
/* set interpreter name and version */
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_name",
|
||||
plugin->name);
|
||||
#ifdef HAVE_RUBY_VERSION_H
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
ruby_version);
|
||||
#else
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
"");
|
||||
#endif /* HAVE_RUBY_VERSION_H */
|
||||
|
||||
ruby_error = 0;
|
||||
|
||||
/* init stdout/stderr buffer */
|
||||
@@ -1185,7 +1175,6 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
init.callback_hdata = &weechat_ruby_hdata_cb;
|
||||
init.callback_infolist = &weechat_ruby_infolist_cb;
|
||||
init.callback_signal_debug_dump = &weechat_ruby_signal_debug_dump_cb;
|
||||
init.callback_signal_debug_libs = &weechat_ruby_signal_debug_libs_cb;
|
||||
init.callback_signal_script_action = &weechat_ruby_signal_script_action_cb;
|
||||
init.callback_load_file = &weechat_ruby_load_cb;
|
||||
|
||||
|
||||
@@ -559,6 +559,10 @@ weechat_tcl_command_cb (const void *pointer, void *data,
|
||||
{
|
||||
weechat_tcl_unload_all ();
|
||||
}
|
||||
else if (weechat_strcasecmp (argv[1], "version") == 0)
|
||||
{
|
||||
plugin_script_display_interpreter (weechat_tcl_plugin, 0);
|
||||
}
|
||||
else
|
||||
WEECHAT_COMMAND_ERROR;
|
||||
}
|
||||
@@ -704,31 +708,6 @@ weechat_tcl_signal_debug_dump_cb (const void *pointer, void *data,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Display infos about external libraries used.
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_tcl_signal_debug_libs_cb (const void *pointer, void *data,
|
||||
const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) pointer;
|
||||
(void) data;
|
||||
(void) signal;
|
||||
(void) type_data;
|
||||
(void) signal_data;
|
||||
|
||||
#ifdef TCL_VERSION
|
||||
weechat_printf (NULL, " %s: %s", TCL_PLUGIN_NAME, TCL_VERSION);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", TCL_PLUGIN_NAME);
|
||||
#endif /* TCL_VERSION */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* Timer for executing actions.
|
||||
*/
|
||||
@@ -827,12 +806,22 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
weechat_tcl_plugin = plugin;
|
||||
|
||||
/* set interpreter name and version */
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_name",
|
||||
plugin->name);
|
||||
#ifdef TCL_VERSION
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
TCL_VERSION);
|
||||
#else
|
||||
weechat_hashtable_set (plugin->variables, "interpreter_version",
|
||||
"");
|
||||
#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_infolist = &weechat_tcl_infolist_cb;
|
||||
init.callback_signal_debug_dump = &weechat_tcl_signal_debug_dump_cb;
|
||||
init.callback_signal_debug_libs = &weechat_tcl_signal_debug_libs_cb;
|
||||
init.callback_signal_script_action = &weechat_tcl_signal_script_action_cb;
|
||||
init.callback_load_file = &weechat_tcl_load_cb;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user