mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 12:56:37 +02:00
Remove some messages during startup about scripts and plugins loaded
It is still possible to see messages by changing debug level for "core" or plugins (perl, python, ruby, lua, tcl).
This commit is contained in:
@@ -107,7 +107,7 @@ weechat_lua_api_register (lua_State *L)
|
||||
|
||||
/* register script */
|
||||
lua_current_script = script_add (weechat_lua_plugin,
|
||||
&lua_scripts,
|
||||
&lua_scripts, &last_lua_script,
|
||||
(lua_current_script_filename) ?
|
||||
lua_current_script_filename : "",
|
||||
name,
|
||||
@@ -119,10 +119,13 @@ weechat_lua_api_register (lua_State *L)
|
||||
charset);
|
||||
if (lua_current_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
LUA_PLUGIN_NAME, name, version, description);
|
||||
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
LUA_PLUGIN_NAME, name, version, description);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -42,7 +42,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
|
||||
|
||||
struct t_weechat_plugin *weechat_lua_plugin;
|
||||
|
||||
int lua_quiet = 0;
|
||||
struct t_plugin_script *lua_scripts = NULL;
|
||||
struct t_plugin_script *last_lua_script = NULL;
|
||||
struct t_plugin_script *lua_current_script = NULL;
|
||||
const char *lua_current_script_filename = NULL;
|
||||
lua_State *lua_current_interpreter = NULL;
|
||||
@@ -95,7 +97,8 @@ weechat_lua_exec (struct t_plugin_script *script,
|
||||
if (argv[6])
|
||||
{
|
||||
argc = 7;
|
||||
lua_pushstring (lua_current_interpreter, argv[6]);
|
||||
lua_pushstring (lua_current_interpreter,
|
||||
argv[6]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,9 +163,12 @@ weechat_lua_load (const char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
LUA_PLUGIN_NAME, filename);
|
||||
if ((weechat_lua_plugin->debug >= 1) || !lua_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
LUA_PLUGIN_NAME, filename);
|
||||
}
|
||||
|
||||
lua_current_script = NULL;
|
||||
|
||||
@@ -233,7 +239,7 @@ weechat_lua_load (const char *filename)
|
||||
fclose (fp);
|
||||
/* if script was registered, removing from list */
|
||||
if (lua_current_script)
|
||||
script_remove (weechat_lua_plugin, &lua_scripts,
|
||||
script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script,
|
||||
lua_current_script);
|
||||
return 0;
|
||||
}
|
||||
@@ -298,7 +304,7 @@ weechat_lua_unload (struct t_plugin_script *script)
|
||||
lua_current_script = (lua_current_script->prev_script) ?
|
||||
lua_current_script->prev_script : lua_current_script->next_script;
|
||||
|
||||
script_remove (weechat_lua_plugin, &lua_scripts, script);
|
||||
script_remove (weechat_lua_plugin, &lua_scripts, &last_lua_script, script);
|
||||
|
||||
lua_close (script->interpreter);
|
||||
}
|
||||
@@ -448,8 +454,8 @@ weechat_lua_completion_cb (void *data, const char *completion_item,
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_lua_debug_dump_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_lua_debug_dump_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -467,8 +473,8 @@ weechat_lua_debug_dump_cb (void *data, const char *signal, const char *type_data
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_lua_buffer_closed_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_lua_buffer_closed_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -494,12 +500,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
weechat_lua_plugin = plugin;
|
||||
|
||||
lua_quiet = 1;
|
||||
script_init (weechat_lua_plugin,
|
||||
&weechat_lua_command_cb,
|
||||
&weechat_lua_completion_cb,
|
||||
&weechat_lua_debug_dump_cb,
|
||||
&weechat_lua_buffer_closed_cb,
|
||||
&weechat_lua_load_cb);
|
||||
lua_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_lua_plugin,
|
||||
lua_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
|
||||
extern struct t_weechat_plugin *weechat_lua_plugin;
|
||||
|
||||
extern int lua_quiet;
|
||||
extern struct t_plugin_script *lua_scripts;
|
||||
extern struct t_plugin_script *last_lua_script;
|
||||
extern struct t_plugin_script *lua_current_script;
|
||||
extern const char *lua_current_script_filename;
|
||||
extern lua_State *lua_current_interpreter;
|
||||
|
||||
@@ -104,17 +104,20 @@ static XS (XS_weechat_api_register)
|
||||
|
||||
/* register script */
|
||||
perl_current_script = script_add (weechat_perl_plugin,
|
||||
&perl_scripts,
|
||||
&perl_scripts, &last_perl_script,
|
||||
(perl_current_script_filename) ?
|
||||
perl_current_script_filename : "",
|
||||
name, author, version, license,
|
||||
description, shutdown_func, charset);
|
||||
if (perl_current_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
PERL_PLUGIN_NAME, name, version, description);
|
||||
if ((weechat_perl_plugin->debug >= 1) || !perl_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
PERL_PLUGIN_NAME, name, version, description);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,7 +40,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
|
||||
|
||||
struct t_weechat_plugin *weechat_perl_plugin = NULL;
|
||||
|
||||
int perl_quiet = 0;
|
||||
struct t_plugin_script *perl_scripts = NULL;
|
||||
struct t_plugin_script *last_perl_script = NULL;
|
||||
struct t_plugin_script *perl_current_script = NULL;
|
||||
const char *perl_current_script_filename = NULL;
|
||||
|
||||
@@ -259,9 +261,12 @@ weechat_perl_load (const char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
PERL_PLUGIN_NAME, filename);
|
||||
if ((weechat_perl_plugin->debug >= 1) || !perl_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
PERL_PLUGIN_NAME, filename);
|
||||
}
|
||||
|
||||
perl_current_script = NULL;
|
||||
|
||||
@@ -354,7 +359,8 @@ weechat_perl_load (const char *filename)
|
||||
#endif
|
||||
if (perl_current_script && (perl_current_script != &temp_script))
|
||||
{
|
||||
script_remove (weechat_perl_plugin, &perl_scripts,
|
||||
script_remove (weechat_perl_plugin,
|
||||
&perl_scripts, &last_perl_script,
|
||||
perl_current_script);
|
||||
}
|
||||
|
||||
@@ -436,7 +442,8 @@ weechat_perl_unload (struct t_plugin_script *script)
|
||||
perl_current_script = (perl_current_script->prev_script) ?
|
||||
perl_current_script->prev_script : perl_current_script->next_script;
|
||||
|
||||
script_remove (weechat_perl_plugin, &perl_scripts, script);
|
||||
script_remove (weechat_perl_plugin, &perl_scripts, &last_perl_script,
|
||||
script);
|
||||
|
||||
#ifdef MULTIPLICITY
|
||||
perl_destruct (interpreter);
|
||||
@@ -592,8 +599,8 @@ weechat_perl_completion_cb (void *data, const char *completion_item,
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_perl_debug_dump_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_perl_debug_dump_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -611,8 +618,8 @@ weechat_perl_debug_dump_cb (void *data, const char *signal, const char *type_dat
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_perl_buffer_closed_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_perl_buffer_closed_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -669,12 +676,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
eval_pv (perl_weechat_code, TRUE);
|
||||
#endif
|
||||
|
||||
perl_quiet = 1;
|
||||
script_init (weechat_perl_plugin,
|
||||
&weechat_perl_command_cb,
|
||||
&weechat_perl_completion_cb,
|
||||
&weechat_perl_debug_dump_cb,
|
||||
&weechat_perl_buffer_closed_cb,
|
||||
&weechat_perl_load_cb);
|
||||
perl_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_perl_plugin,
|
||||
perl_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
|
||||
extern struct t_weechat_plugin *weechat_perl_plugin;
|
||||
|
||||
extern int perl_quiet;
|
||||
extern struct t_plugin_script *perl_scripts;
|
||||
extern struct t_plugin_script *last_perl_script;
|
||||
extern struct t_plugin_script *perl_current_script;
|
||||
extern const char *perl_current_script_filename;
|
||||
|
||||
|
||||
@@ -95,17 +95,20 @@ weechat_python_api_register (PyObject *self, PyObject *args)
|
||||
|
||||
/* register script */
|
||||
python_current_script = script_add (weechat_python_plugin,
|
||||
&python_scripts,
|
||||
&python_scripts, &last_python_script,
|
||||
(python_current_script_filename) ?
|
||||
python_current_script_filename : "",
|
||||
name, author, version, license,
|
||||
description, shutdown_func, charset);
|
||||
if (python_current_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
PYTHON_PLUGIN_NAME, name, version, description);
|
||||
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
PYTHON_PLUGIN_NAME, name, version, description);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -38,7 +38,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
|
||||
|
||||
struct t_weechat_plugin *weechat_python_plugin = NULL;
|
||||
|
||||
int python_quiet;
|
||||
struct t_plugin_script *python_scripts = NULL;
|
||||
struct t_plugin_script *last_python_script = NULL;
|
||||
struct t_plugin_script *python_current_script = NULL;
|
||||
const char *python_current_script_filename = NULL;
|
||||
PyThreadState *python_mainThreadState = NULL;
|
||||
@@ -94,21 +96,25 @@ weechat_python_exec (struct t_plugin_script *script,
|
||||
{
|
||||
if (argv[6])
|
||||
{
|
||||
rc = PyObject_CallFunction (evFunc, "sssssss", argv[0],
|
||||
argv[1], argv[2], argv[3],
|
||||
argv[4], argv[5], argv[6]);
|
||||
rc = PyObject_CallFunction (evFunc, "sssssss",
|
||||
argv[0], argv[1],
|
||||
argv[2], argv[3],
|
||||
argv[4], argv[5],
|
||||
argv[6]);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PyObject_CallFunction (evFunc, "ssssss", argv[0],
|
||||
argv[1], argv[2], argv[3],
|
||||
rc = PyObject_CallFunction (evFunc, "ssssss",
|
||||
argv[0], argv[1],
|
||||
argv[2], argv[3],
|
||||
argv[4], argv[5]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PyObject_CallFunction (evFunc, "sssss", argv[0],
|
||||
argv[1], argv[2], argv[3],
|
||||
rc = PyObject_CallFunction (evFunc, "sssss",
|
||||
argv[0], argv[1],
|
||||
argv[2], argv[3],
|
||||
argv[4]);
|
||||
}
|
||||
}
|
||||
@@ -283,9 +289,12 @@ weechat_python_load (const char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
PYTHON_PLUGIN_NAME, filename);
|
||||
if ((weechat_python_plugin->debug >= 1) || !python_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
PYTHON_PLUGIN_NAME, filename);
|
||||
}
|
||||
|
||||
python_current_script = NULL;
|
||||
|
||||
@@ -389,7 +398,8 @@ weechat_python_load (const char *filename)
|
||||
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_INT", PyString_FromString(WEECHAT_HOOK_SIGNAL_INT));
|
||||
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_POINTER", PyString_FromString(WEECHAT_HOOK_SIGNAL_POINTER));
|
||||
|
||||
weechat_outputs = Py_InitModule("weechatOutputs", weechat_python_output_funcs);
|
||||
weechat_outputs = Py_InitModule("weechatOutputs",
|
||||
weechat_python_output_funcs);
|
||||
if (weechat_outputs == NULL)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
@@ -426,11 +436,14 @@ weechat_python_load (const char *filename)
|
||||
PyErr_Print ();
|
||||
Py_EndInterpreter (python_current_interpreter);
|
||||
/* PyEval_ReleaseLock (); */
|
||||
|
||||
|
||||
/* if script was registered, removing from list */
|
||||
if (python_current_script != NULL)
|
||||
script_remove (weechat_python_plugin, &python_scripts,
|
||||
python_current_script);
|
||||
{
|
||||
script_remove (weechat_python_plugin,
|
||||
&python_scripts, &last_python_script,
|
||||
python_current_script);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -501,7 +514,8 @@ weechat_python_unload (struct t_plugin_script *script)
|
||||
python_current_script = (python_current_script->prev_script) ?
|
||||
python_current_script->prev_script : python_current_script->next_script;
|
||||
|
||||
script_remove (weechat_python_plugin, &python_scripts, script);
|
||||
script_remove (weechat_python_plugin, &python_scripts, &last_python_script,
|
||||
script);
|
||||
|
||||
PyThreadState_Swap (interpreter);
|
||||
Py_EndInterpreter (interpreter);
|
||||
@@ -653,8 +667,8 @@ weechat_python_completion_cb (void *data, const char *completion_item,
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_python_debug_dump_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_python_debug_dump_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -672,8 +686,8 @@ weechat_python_debug_dump_cb (void *data, const char *signal, const char *type_d
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_python_buffer_closed_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_python_buffer_closed_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -725,13 +739,18 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
weechat_prefix ("error"), PYTHON_PLUGIN_NAME);
|
||||
return WEECHAT_RC_ERROR;
|
||||
}
|
||||
|
||||
|
||||
python_quiet = 1;
|
||||
script_init (weechat_python_plugin,
|
||||
&weechat_python_command_cb,
|
||||
&weechat_python_completion_cb,
|
||||
&weechat_python_debug_dump_cb,
|
||||
&weechat_python_buffer_closed_cb,
|
||||
&weechat_python_load_cb);
|
||||
python_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_python_plugin,
|
||||
python_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
|
||||
extern struct t_weechat_plugin *weechat_python_plugin;
|
||||
|
||||
extern int python_quiet;
|
||||
extern struct t_plugin_script *python_scripts;
|
||||
extern struct t_plugin_script *last_python_script;
|
||||
extern struct t_plugin_script *python_current_script;
|
||||
extern const char *python_current_script_filename;
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
|
||||
|
||||
/* register script */
|
||||
ruby_current_script = script_add (weechat_ruby_plugin,
|
||||
&ruby_scripts,
|
||||
&ruby_scripts, &last_ruby_script,
|
||||
(ruby_current_script_filename) ?
|
||||
ruby_current_script_filename : "",
|
||||
c_name, c_author, c_version, c_license,
|
||||
@@ -120,10 +120,13 @@ weechat_ruby_api_register (VALUE class, VALUE name, VALUE author,
|
||||
|
||||
if (ruby_current_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
RUBY_PLUGIN_NAME, c_name, c_version, c_description);
|
||||
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
RUBY_PLUGIN_NAME, c_name, c_version, c_description);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -41,7 +41,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
|
||||
|
||||
struct t_weechat_plugin *weechat_ruby_plugin = NULL;
|
||||
|
||||
int ruby_quiet = 0;
|
||||
struct t_plugin_script *ruby_scripts = NULL;
|
||||
struct t_plugin_script *last_ruby_script = NULL;
|
||||
struct t_plugin_script *ruby_current_script = NULL;
|
||||
const char *ruby_current_script_filename = NULL;
|
||||
|
||||
@@ -340,9 +342,12 @@ weechat_ruby_load (const char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
RUBY_PLUGIN_NAME, filename);
|
||||
if ((weechat_ruby_plugin->debug >= 1) || !ruby_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
RUBY_PLUGIN_NAME, filename);
|
||||
}
|
||||
|
||||
ruby_current_script = NULL;
|
||||
|
||||
@@ -429,7 +434,8 @@ weechat_ruby_load (const char *filename)
|
||||
|
||||
if (ruby_current_script != NULL)
|
||||
{
|
||||
script_remove (weechat_ruby_plugin, &ruby_scripts,
|
||||
script_remove (weechat_ruby_plugin,
|
||||
&ruby_scripts, &last_ruby_script,
|
||||
ruby_current_script);
|
||||
}
|
||||
|
||||
@@ -495,7 +501,8 @@ weechat_ruby_unload (struct t_plugin_script *script)
|
||||
ruby_current_script = (ruby_current_script->prev_script) ?
|
||||
ruby_current_script->prev_script : ruby_current_script->next_script;
|
||||
|
||||
script_remove (weechat_ruby_plugin, &ruby_scripts, script);
|
||||
script_remove (weechat_ruby_plugin, &ruby_scripts, &last_ruby_script,
|
||||
script);
|
||||
|
||||
if (interpreter)
|
||||
rb_gc_unregister_address (interpreter);
|
||||
@@ -646,8 +653,8 @@ weechat_ruby_completion_cb (void *data, const char *completion_item,
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_debug_dump_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_ruby_debug_dump_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -665,8 +672,8 @@ weechat_ruby_debug_dump_cb (void *data, const char *signal, const char *type_dat
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_ruby_buffer_closed_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_ruby_buffer_closed_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -750,10 +757,14 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
/* redirect stdin and stdout */
|
||||
ruby_mWeechatOutputs = rb_define_module("WeechatOutputs");
|
||||
rb_define_singleton_method(ruby_mWeechatOutputs, "write", weechat_ruby_output, 1);
|
||||
rb_define_singleton_method(ruby_mWeechatOutputs, "puts", weechat_ruby_output, 1);
|
||||
rb_define_singleton_method(ruby_mWeechatOutputs, "p", weechat_ruby_output, 1);
|
||||
rb_define_singleton_method(ruby_mWeechatOutputs, "flush", weechat_ruby_output_flush, 0);
|
||||
rb_define_singleton_method(ruby_mWeechatOutputs, "write",
|
||||
weechat_ruby_output, 1);
|
||||
rb_define_singleton_method(ruby_mWeechatOutputs, "puts",
|
||||
weechat_ruby_output, 1);
|
||||
rb_define_singleton_method(ruby_mWeechatOutputs, "p",
|
||||
weechat_ruby_output, 1);
|
||||
rb_define_singleton_method(ruby_mWeechatOutputs, "flush",
|
||||
weechat_ruby_output_flush, 0);
|
||||
|
||||
rb_eval_string_protect(weechat_ruby_code, &ruby_error);
|
||||
if (ruby_error)
|
||||
@@ -770,12 +781,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
return WEECHAT_RC_ERROR;
|
||||
}
|
||||
|
||||
ruby_quiet = 1;
|
||||
script_init (weechat_ruby_plugin,
|
||||
&weechat_ruby_command_cb,
|
||||
&weechat_ruby_completion_cb,
|
||||
&weechat_ruby_debug_dump_cb,
|
||||
&weechat_ruby_buffer_closed_cb,
|
||||
&weechat_ruby_load_cb);
|
||||
ruby_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_ruby_plugin,
|
||||
ruby_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
|
||||
extern struct t_weechat_plugin *weechat_ruby_plugin;
|
||||
|
||||
extern int ruby_quiet;
|
||||
extern struct t_plugin_script *ruby_scripts;
|
||||
extern struct t_plugin_script *last_ruby_script;
|
||||
extern struct t_plugin_script *ruby_current_script;
|
||||
extern const char *ruby_current_script_filename;
|
||||
|
||||
|
||||
@@ -90,10 +90,10 @@ script_callback_remove (struct t_plugin_script *script,
|
||||
{
|
||||
/* remove callback from list */
|
||||
if (script_callback->prev_callback)
|
||||
script_callback->prev_callback->next_callback =
|
||||
(script_callback->prev_callback)->next_callback =
|
||||
script_callback->next_callback;
|
||||
if (script_callback->next_callback)
|
||||
script_callback->next_callback->prev_callback =
|
||||
(script_callback->next_callback)->prev_callback =
|
||||
script_callback->prev_callback;
|
||||
if (script->callbacks == script_callback)
|
||||
script->callbacks = script_callback->next_callback;
|
||||
|
||||
+118
-10
@@ -342,6 +342,71 @@ script_search_full_name (struct t_weechat_plugin *weechat_plugin,
|
||||
return strdup (filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* script_find_pos: find position for a script (for sorting scripts list)
|
||||
*/
|
||||
|
||||
struct t_plugin_script *
|
||||
script_find_pos (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
struct t_plugin_script *script)
|
||||
{
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
for (ptr_script = scripts; ptr_script; ptr_script = ptr_script->next_script)
|
||||
{
|
||||
if (weechat_strcasecmp (script->name, ptr_script->name) < 0)
|
||||
return ptr_script;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_insert_sorted: insert a script in list, keeping sort on name
|
||||
*/
|
||||
|
||||
void
|
||||
script_insert_sorted (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
struct t_plugin_script *script)
|
||||
{
|
||||
struct t_plugin_script *pos_script;
|
||||
|
||||
if (*scripts)
|
||||
{
|
||||
pos_script = script_find_pos (weechat_plugin, *scripts, script);
|
||||
|
||||
if (pos_script)
|
||||
{
|
||||
/* insert script into the list (before script found) */
|
||||
script->prev_script = pos_script->prev_script;
|
||||
script->next_script = pos_script;
|
||||
if (pos_script->prev_script)
|
||||
(pos_script->prev_script)->next_script = script;
|
||||
else
|
||||
*scripts = script;
|
||||
pos_script->prev_script = script;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add script to the end */
|
||||
script->prev_script = *last_script;
|
||||
script->next_script = NULL;
|
||||
(*last_script)->next_script = script;
|
||||
*last_script = script;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* first script in list */
|
||||
script->prev_script = NULL;
|
||||
script->next_script = NULL;
|
||||
*scripts = script;
|
||||
*last_script = script;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* script_add: add a script to list of scripts
|
||||
*/
|
||||
@@ -349,6 +414,7 @@ script_search_full_name (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *
|
||||
script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
const char *filename, const char *name, const char *author, const char *version,
|
||||
const char *license, const char *description, const char *shutdown_func,
|
||||
const char *charset)
|
||||
@@ -388,15 +454,9 @@ script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
new_script->shutdown_func = (shutdown_func) ?
|
||||
strdup (shutdown_func) : NULL;
|
||||
new_script->charset = (charset) ? strdup (charset) : NULL;
|
||||
|
||||
new_script->callbacks = NULL;
|
||||
|
||||
/* add new script to list */
|
||||
if (*scripts)
|
||||
(*scripts)->prev_script = new_script;
|
||||
new_script->prev_script = NULL;
|
||||
new_script->next_script = *scripts;
|
||||
*scripts = new_script;
|
||||
script_insert_sorted (weechat_plugin, scripts, last_script, new_script);
|
||||
|
||||
return new_script;
|
||||
}
|
||||
@@ -443,6 +503,7 @@ script_remove_buffer_callbacks (struct t_plugin_script *scripts,
|
||||
void
|
||||
script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
struct t_plugin_script *script)
|
||||
{
|
||||
struct t_script_callback *ptr_script_callback, *next_script_callback;
|
||||
@@ -456,7 +517,7 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
weechat_unhook (ptr_script_callback->hook);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ptr_script_callback = script->callbacks;
|
||||
while (ptr_script_callback)
|
||||
{
|
||||
@@ -516,10 +577,12 @@ script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
/* remove script from list */
|
||||
if (script->prev_script)
|
||||
(script->prev_script)->next_script = script->next_script;
|
||||
else
|
||||
*scripts = script->next_script;
|
||||
if (script->next_script)
|
||||
(script->next_script)->prev_script = script->prev_script;
|
||||
if (*scripts == script)
|
||||
*scripts = script->next_script;
|
||||
if (*last_script == script)
|
||||
*last_script = script->prev_script;
|
||||
|
||||
/* free script */
|
||||
free (script);
|
||||
@@ -591,6 +654,51 @@ script_display_list (struct t_weechat_plugin *weechat_plugin,
|
||||
weechat_printf (NULL, _(" (none)"));
|
||||
}
|
||||
|
||||
/*
|
||||
* script_display_short_list: print list of scripts on one line
|
||||
*/
|
||||
|
||||
void
|
||||
script_display_short_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts)
|
||||
{
|
||||
const char *scripts_loaded;
|
||||
char *buf;
|
||||
int length;
|
||||
struct t_plugin_script *ptr_script;
|
||||
|
||||
if (scripts)
|
||||
{
|
||||
/* TRANSLATORS: %s is language (for example "perl") */
|
||||
scripts_loaded = _("%s scripts loaded:");
|
||||
|
||||
length = strlen (scripts_loaded) + strlen (weechat_plugin->name) + 1;
|
||||
|
||||
for (ptr_script = scripts; ptr_script;
|
||||
ptr_script = ptr_script->next_script)
|
||||
{
|
||||
length += strlen (ptr_script->name) + 2;
|
||||
}
|
||||
length++;
|
||||
|
||||
buf = malloc (length);
|
||||
if (buf)
|
||||
{
|
||||
snprintf (buf, length, scripts_loaded, weechat_plugin->name);
|
||||
strcat (buf, " ");
|
||||
for (ptr_script = scripts; ptr_script;
|
||||
ptr_script = ptr_script->next_script)
|
||||
{
|
||||
strcat (buf, ptr_script->name);
|
||||
if (ptr_script->next_script)
|
||||
strcat (buf, ", ");
|
||||
}
|
||||
weechat_printf (NULL, "%s", buf);
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* script_print_log: print script infos in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
@@ -85,6 +85,7 @@ extern char *script_search_full_name (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *filename);
|
||||
extern struct t_plugin_script *script_add (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
const char *filename, const char *name,
|
||||
const char *author, const char *version,
|
||||
const char *license, const char *description,
|
||||
@@ -93,6 +94,7 @@ extern void script_remove_buffer_callbacks (struct t_plugin_script *scripts,
|
||||
struct t_gui_buffer *buffer);
|
||||
extern void script_remove (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script **scripts,
|
||||
struct t_plugin_script **last_script,
|
||||
struct t_plugin_script *script);
|
||||
extern void script_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_gui_completion *completion,
|
||||
@@ -100,6 +102,8 @@ extern void script_completion (struct t_weechat_plugin *weechat_plugin,
|
||||
extern void script_display_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts,
|
||||
const char *name, int full);
|
||||
extern void script_display_short_list (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts);
|
||||
extern void script_print_log (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *scripts);
|
||||
|
||||
|
||||
@@ -198,17 +198,20 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
|
||||
|
||||
/* register script */
|
||||
tcl_current_script = script_add (weechat_tcl_plugin,
|
||||
&tcl_scripts,
|
||||
&tcl_scripts, &last_tcl_script,
|
||||
(tcl_current_script_filename) ?
|
||||
tcl_current_script_filename : "",
|
||||
name, author, version, license,
|
||||
description, shutdown_func, charset);
|
||||
if (tcl_current_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
TCL_PLUGIN_NAME, name, version, description);
|
||||
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: registered script \"%s\", "
|
||||
"version %s (%s)"),
|
||||
TCL_PLUGIN_NAME, name, version, description);
|
||||
}
|
||||
tcl_current_script->interpreter = (void *)interp;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -43,7 +43,9 @@ WEECHAT_PLUGIN_LICENSE("GPL3");
|
||||
|
||||
struct t_weechat_plugin *weechat_tcl_plugin = NULL;
|
||||
|
||||
int tcl_quiet = 0;
|
||||
struct t_plugin_script *tcl_scripts = NULL;
|
||||
struct t_plugin_script *last_tcl_script = NULL;
|
||||
struct t_plugin_script *tcl_current_script = NULL;
|
||||
const char *tcl_current_script_filename = NULL;
|
||||
|
||||
@@ -155,9 +157,12 @@ weechat_tcl_load (const char *filename)
|
||||
return 0;
|
||||
}
|
||||
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
TCL_PLUGIN_NAME, filename);
|
||||
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s: loading script \"%s\""),
|
||||
TCL_PLUGIN_NAME, filename);
|
||||
}
|
||||
|
||||
tcl_current_script = NULL;
|
||||
|
||||
@@ -239,7 +244,7 @@ weechat_tcl_unload (struct t_plugin_script *script)
|
||||
tcl_current_script = (tcl_current_script->prev_script) ?
|
||||
tcl_current_script->prev_script : tcl_current_script->next_script;
|
||||
|
||||
script_remove (weechat_tcl_plugin, &tcl_scripts, script);
|
||||
script_remove (weechat_tcl_plugin, &tcl_scripts, &last_tcl_script, script);
|
||||
|
||||
Tcl_DeleteInterp(interp);
|
||||
}
|
||||
@@ -389,8 +394,8 @@ weechat_tcl_completion_cb (void *data, const char *completion_item,
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_tcl_debug_dump_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_tcl_debug_dump_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -408,8 +413,8 @@ weechat_tcl_debug_dump_cb (void *data, const char *signal, const char *type_data
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_tcl_buffer_closed_cb (void *data, const char *signal, const char *type_data,
|
||||
void *signal_data)
|
||||
weechat_tcl_buffer_closed_cb (void *data, const char *signal,
|
||||
const char *type_data, void *signal_data)
|
||||
{
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -435,12 +440,17 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
|
||||
weechat_tcl_plugin = plugin;
|
||||
|
||||
tcl_quiet = 1;
|
||||
script_init (weechat_tcl_plugin,
|
||||
weechat_tcl_command_cb,
|
||||
weechat_tcl_completion_cb,
|
||||
weechat_tcl_debug_dump_cb,
|
||||
weechat_tcl_buffer_closed_cb,
|
||||
weechat_tcl_load_cb);
|
||||
tcl_quiet = 0;
|
||||
|
||||
script_display_short_list (weechat_tcl_plugin,
|
||||
tcl_scripts);
|
||||
|
||||
/* init ok */
|
||||
return WEECHAT_RC_OK;
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
|
||||
extern struct t_weechat_plugin *weechat_tcl_plugin;
|
||||
|
||||
extern int tcl_quiet;
|
||||
extern struct t_plugin_script *tcl_scripts;
|
||||
extern struct t_plugin_script *last_tcl_script;
|
||||
extern struct t_plugin_script *tcl_current_script;
|
||||
extern const char *tcl_current_script_filename;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user