mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 12:56:37 +02:00
Fix bug with callbacks when loading a script already loaded
This commit is contained in:
@@ -170,6 +170,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
|
||||
(void) clientData;
|
||||
|
||||
tcl_current_script = NULL;
|
||||
tcl_registered_script = NULL;
|
||||
|
||||
if (objc < 8)
|
||||
{
|
||||
@@ -205,6 +206,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
|
||||
description, shutdown_func, charset);
|
||||
if (tcl_current_script)
|
||||
{
|
||||
tcl_registered_script = tcl_current_script;
|
||||
if ((weechat_tcl_plugin->debug >= 1) || !tcl_quiet)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
@@ -218,7 +220,7 @@ weechat_tcl_api_register (ClientData clientData, Tcl_Interp *interp, int objc,
|
||||
{
|
||||
TCL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
|
||||
TCL_RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ 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;
|
||||
struct t_plugin_script *tcl_registered_script = NULL;
|
||||
const char *tcl_current_script_filename = NULL;
|
||||
|
||||
/*
|
||||
@@ -181,6 +182,7 @@ weechat_tcl_load (const char *filename)
|
||||
}
|
||||
|
||||
tcl_current_script = NULL;
|
||||
tcl_registered_script = NULL;
|
||||
|
||||
if (!(interp = Tcl_CreateInterp ())) {
|
||||
weechat_printf (NULL,
|
||||
@@ -204,7 +206,7 @@ weechat_tcl_load (const char *filename)
|
||||
/* return 0; */
|
||||
}
|
||||
|
||||
if (!tcl_current_script)
|
||||
if (!tcl_registered_script)
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s%s: function \"register\" not "
|
||||
@@ -213,6 +215,7 @@ weechat_tcl_load (const char *filename)
|
||||
Tcl_DeleteInterp (interp);
|
||||
return 0;
|
||||
}
|
||||
tcl_current_script = tcl_registered_script;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ 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 struct t_plugin_script *tcl_registered_script;
|
||||
extern const char *tcl_current_script_filename;
|
||||
|
||||
extern void *weechat_tcl_exec (struct t_plugin_script *script,
|
||||
|
||||
Reference in New Issue
Block a user