mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 23:06:38 +02:00
Add return code value for config_read callback in script plugins
This commit is contained in:
@@ -1085,7 +1085,7 @@ weechat_lua_api_config_new (lua_State *L)
|
||||
* weechat_lua_api_config_read_cb: callback for reading option in section
|
||||
*/
|
||||
|
||||
void
|
||||
int
|
||||
weechat_lua_api_config_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
@@ -1093,7 +1093,7 @@ weechat_lua_api_config_read_cb (void *data,
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *lua_argv[5];
|
||||
int *rc;
|
||||
int *rc, ret;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
|
||||
@@ -1110,13 +1110,22 @@ weechat_lua_api_config_read_cb (void *data,
|
||||
script_callback->function,
|
||||
lua_argv);
|
||||
|
||||
if (rc)
|
||||
if (!rc)
|
||||
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
else
|
||||
{
|
||||
ret = *rc;
|
||||
free (rc);
|
||||
}
|
||||
if (lua_argv[0])
|
||||
free (lua_argv[0]);
|
||||
if (lua_argv[1])
|
||||
free (lua_argv[1]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -893,7 +893,7 @@ static XS (XS_weechat_api_config_new)
|
||||
* weechat_perl_api_config_section_read_cb: callback for reading option in section
|
||||
*/
|
||||
|
||||
void
|
||||
int
|
||||
weechat_perl_api_config_section_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
@@ -902,7 +902,7 @@ weechat_perl_api_config_section_read_cb (void *data,
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *perl_argv[5];
|
||||
int *rc;
|
||||
int *rc, ret;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
|
||||
@@ -919,13 +919,22 @@ weechat_perl_api_config_section_read_cb (void *data,
|
||||
script_callback->function,
|
||||
perl_argv);
|
||||
|
||||
if (rc)
|
||||
if (!rc)
|
||||
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
else
|
||||
{
|
||||
ret = *rc;
|
||||
free (rc);
|
||||
}
|
||||
if (perl_argv[0])
|
||||
free (perl_argv[0]);
|
||||
if (perl_argv[1])
|
||||
free (perl_argv[1]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -949,7 +949,7 @@ weechat_python_api_config_new (PyObject *self, PyObject *args)
|
||||
* weechat_python_api_config_read_cb: callback for reading option in section
|
||||
*/
|
||||
|
||||
void
|
||||
int
|
||||
weechat_python_api_config_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
@@ -957,10 +957,10 @@ weechat_python_api_config_read_cb (void *data,
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *python_argv[5];
|
||||
int *rc;
|
||||
int *rc, ret;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
|
||||
|
||||
if (script_callback->function && script_callback->function[0])
|
||||
{
|
||||
python_argv[0] = script_ptr2str (config_file);
|
||||
@@ -974,13 +974,25 @@ weechat_python_api_config_read_cb (void *data,
|
||||
script_callback->function,
|
||||
python_argv);
|
||||
|
||||
if (!rc)
|
||||
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
else
|
||||
{
|
||||
ret = *rc;
|
||||
free (rc);
|
||||
}
|
||||
|
||||
if (rc)
|
||||
free (rc);
|
||||
if (python_argv[0])
|
||||
free (python_argv[0]);
|
||||
if (python_argv[1])
|
||||
free (python_argv[1]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1082,7 +1082,7 @@ weechat_ruby_api_config_new (VALUE class, VALUE name, VALUE function)
|
||||
* weechat_ruby_api_config_read_cb: callback for reading option in section
|
||||
*/
|
||||
|
||||
void
|
||||
int
|
||||
weechat_ruby_api_config_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
@@ -1090,10 +1090,10 @@ weechat_ruby_api_config_read_cb (void *data,
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *ruby_argv[5];
|
||||
int *rc;
|
||||
int *rc, ret;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
|
||||
|
||||
if (script_callback->function && script_callback->function[0])
|
||||
{
|
||||
ruby_argv[0] = script_ptr2str (config_file);
|
||||
@@ -1107,13 +1107,22 @@ weechat_ruby_api_config_read_cb (void *data,
|
||||
script_callback->function,
|
||||
ruby_argv);
|
||||
|
||||
if (rc)
|
||||
if (!rc)
|
||||
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
else
|
||||
{
|
||||
ret = *rc;
|
||||
free (rc);
|
||||
}
|
||||
if (ruby_argv[0])
|
||||
free (ruby_argv[0]);
|
||||
if (ruby_argv[1])
|
||||
free (ruby_argv[1]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -100,11 +100,11 @@ script_api_config_new_section (struct t_weechat_plugin *weechat_plugin,
|
||||
const char *name,
|
||||
int user_can_add_options,
|
||||
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),
|
||||
int (*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,
|
||||
void (*callback_write)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
|
||||
@@ -33,11 +33,11 @@ extern struct t_config_section *script_api_config_new_section (struct t_weechat_
|
||||
const char *name,
|
||||
int user_can_add_options,
|
||||
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),
|
||||
int (*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,
|
||||
void (*callback_write)(void *data,
|
||||
struct t_config_file *config_file,
|
||||
|
||||
@@ -1097,7 +1097,7 @@ weechat_tcl_api_config_new (ClientData clientData, Tcl_Interp *interp,
|
||||
* section
|
||||
*/
|
||||
|
||||
void
|
||||
int
|
||||
weechat_tcl_api_config_section_read_cb (void *data,
|
||||
struct t_config_file *config_file,
|
||||
struct t_config_section *section,
|
||||
@@ -1105,10 +1105,10 @@ weechat_tcl_api_config_section_read_cb (void *data,
|
||||
{
|
||||
struct t_script_callback *script_callback;
|
||||
char *tcl_argv[5];
|
||||
int *rc;
|
||||
int *rc, ret;
|
||||
|
||||
script_callback = (struct t_script_callback *)data;
|
||||
|
||||
|
||||
if (script_callback->function && script_callback->function[0])
|
||||
{
|
||||
tcl_argv[0] = script_ptr2str (config_file);
|
||||
@@ -1122,13 +1122,22 @@ weechat_tcl_api_config_section_read_cb (void *data,
|
||||
script_callback->function,
|
||||
tcl_argv);
|
||||
|
||||
if (rc)
|
||||
if (!rc)
|
||||
ret = WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
else
|
||||
{
|
||||
ret = *rc;
|
||||
free (rc);
|
||||
}
|
||||
if (tcl_argv[0])
|
||||
free (tcl_argv[0]);
|
||||
if (tcl_argv[1])
|
||||
free (tcl_argv[1]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user