mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 09:13:14 +02:00
Add return code value for config_read callback in script plugins
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user