mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 21:06:38 +02:00
Fix bug with arguments of config_read callback in script plugins
This commit is contained in:
@@ -1088,10 +1088,11 @@ weechat_lua_api_config_new (lua_State *L)
|
||||
void
|
||||
weechat_lua_api_config_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name, const char *value)
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *lua_argv[4];
|
||||
char *lua_argv[5];
|
||||
int *rc;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
@@ -1099,9 +1100,10 @@ weechat_lua_api_config_read_cb (void *data,
|
||||
if (script_callback->function && script_callback->function[0])
|
||||
{
|
||||
lua_argv[0] = script_ptr2str (config_file);
|
||||
lua_argv[1] = (char *)option_name;
|
||||
lua_argv[2] = (char *)value;
|
||||
lua_argv[3] = NULL;
|
||||
lua_argv[1] = script_ptr2str (section);
|
||||
lua_argv[2] = (char *)option_name;
|
||||
lua_argv[3] = (char *)value;
|
||||
lua_argv[4] = NULL;
|
||||
|
||||
rc = (int *) weechat_lua_exec (script_callback->script,
|
||||
WEECHAT_SCRIPT_EXEC_INT,
|
||||
@@ -1112,6 +1114,8 @@ weechat_lua_api_config_read_cb (void *data,
|
||||
free (rc);
|
||||
if (lua_argv[0])
|
||||
free (lua_argv[0]);
|
||||
if (lua_argv[1])
|
||||
free (lua_argv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -896,10 +896,12 @@ static XS (XS_weechat_api_config_new)
|
||||
void
|
||||
weechat_perl_api_config_section_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
const char *option_name, const char *value)
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value)
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *perl_argv[4];
|
||||
char *perl_argv[5];
|
||||
int *rc;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
@@ -907,9 +909,10 @@ weechat_perl_api_config_section_read_cb (void *data,
|
||||
if (script_callback->function && script_callback->function[0])
|
||||
{
|
||||
perl_argv[0] = script_ptr2str (config_file);
|
||||
perl_argv[1] = (char *)option_name;
|
||||
perl_argv[2] = (char *)value;
|
||||
perl_argv[3] = NULL;
|
||||
perl_argv[1] = script_ptr2str (section);
|
||||
perl_argv[2] = (char *)option_name;
|
||||
perl_argv[3] = (char *)value;
|
||||
perl_argv[4] = NULL;
|
||||
|
||||
rc = (int *) weechat_perl_exec (script_callback->script,
|
||||
WEECHAT_SCRIPT_EXEC_INT,
|
||||
@@ -920,6 +923,8 @@ weechat_perl_api_config_section_read_cb (void *data,
|
||||
free (rc);
|
||||
if (perl_argv[0])
|
||||
free (perl_argv[0]);
|
||||
if (perl_argv[1])
|
||||
free (perl_argv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -952,10 +952,11 @@ weechat_python_api_config_new (PyObject *self, PyObject *args)
|
||||
void
|
||||
weechat_python_api_config_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name, const char *value)
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *python_argv[4];
|
||||
char *python_argv[5];
|
||||
int *rc;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
@@ -963,9 +964,10 @@ weechat_python_api_config_read_cb (void *data,
|
||||
if (script_callback->function && script_callback->function[0])
|
||||
{
|
||||
python_argv[0] = script_ptr2str (config_file);
|
||||
python_argv[1] = (char *)option_name;
|
||||
python_argv[2] = (char *)value;
|
||||
python_argv[3] = NULL;
|
||||
python_argv[1] = script_ptr2str (section);
|
||||
python_argv[2] = (char *)option_name;
|
||||
python_argv[3] = (char *)value;
|
||||
python_argv[4] = NULL;
|
||||
|
||||
rc = (int *) weechat_python_exec (script_callback->script,
|
||||
WEECHAT_SCRIPT_EXEC_INT,
|
||||
@@ -976,6 +978,8 @@ weechat_python_api_config_read_cb (void *data,
|
||||
free (rc);
|
||||
if (python_argv[0])
|
||||
free (python_argv[0]);
|
||||
if (python_argv[1])
|
||||
free (python_argv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1085,10 +1085,11 @@ weechat_ruby_api_config_new (VALUE class, VALUE name, VALUE function)
|
||||
void
|
||||
weechat_ruby_api_config_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name, const char *value)
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *ruby_argv[4];
|
||||
char *ruby_argv[5];
|
||||
int *rc;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
@@ -1096,9 +1097,10 @@ weechat_ruby_api_config_read_cb (void *data,
|
||||
if (script_callback->function && script_callback->function[0])
|
||||
{
|
||||
ruby_argv[0] = script_ptr2str (config_file);
|
||||
ruby_argv[1] = (char *)option_name;
|
||||
ruby_argv[2] = (char *)value;
|
||||
ruby_argv[3] = NULL;
|
||||
ruby_argv[1] = script_ptr2str (section);
|
||||
ruby_argv[2] = (char *)option_name;
|
||||
ruby_argv[3] = (char *)value;
|
||||
ruby_argv[4] = NULL;
|
||||
|
||||
rc = (int *) weechat_ruby_exec (script_callback->script,
|
||||
WEECHAT_SCRIPT_EXEC_INT,
|
||||
@@ -1109,6 +1111,8 @@ weechat_ruby_api_config_read_cb (void *data,
|
||||
free (rc);
|
||||
if (ruby_argv[0])
|
||||
free (ruby_argv[0]);
|
||||
if (ruby_argv[1])
|
||||
free (ruby_argv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
|
||||
int user_can_delete_options,
|
||||
void (*callback_read)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value),
|
||||
char *function_read,
|
||||
|
||||
@@ -35,6 +35,7 @@ extern struct t_config_section *script_api_config_new_section (struct t_weechat_
|
||||
int user_can_delete_options,
|
||||
void (*callback_read)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name,
|
||||
const char *value),
|
||||
const char *function_read,
|
||||
|
||||
@@ -1099,11 +1099,12 @@ weechat_tcl_api_config_new (ClientData clientData, Tcl_Interp *interp,
|
||||
|
||||
void
|
||||
weechat_tcl_api_config_section_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
const char *option_name, const char *value)
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
const char *option_name, const char *value)
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *tcl_argv[4];
|
||||
char *tcl_argv[5];
|
||||
int *rc;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
@@ -1111,9 +1112,10 @@ weechat_tcl_api_config_section_read_cb (void *data,
|
||||
if (script_callback->function && script_callback->function[0])
|
||||
{
|
||||
tcl_argv[0] = script_ptr2str (config_file);
|
||||
tcl_argv[1] = (char *)option_name;
|
||||
tcl_argv[2] = (char *)value;
|
||||
tcl_argv[3] = NULL;
|
||||
tcl_argv[1] = script_ptr2str (section);
|
||||
tcl_argv[2] = (char *)option_name;
|
||||
tcl_argv[3] = (char *)value;
|
||||
tcl_argv[4] = NULL;
|
||||
|
||||
rc = (int *) weechat_tcl_exec (script_callback->script,
|
||||
WEECHAT_SCRIPT_EXEC_INT,
|
||||
@@ -1124,6 +1126,8 @@ weechat_tcl_api_config_section_read_cb (void *data,
|
||||
free (rc);
|
||||
if (tcl_argv[0])
|
||||
free (tcl_argv[0]);
|
||||
if (tcl_argv[1])
|
||||
free (tcl_argv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user