diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 15 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 15 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 18 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 17 | ||||
-rw-r--r-- | src/plugins/scripts/script-api.c | 10 | ||||
-rw-r--r-- | src/plugins/scripts/script-api.h | 10 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 17 |
7 files changed, 75 insertions, 27 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 84dca4110..98a879094 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -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; } /* diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index aaecfd70c..556594270 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -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; } /* diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 0848cf284..fe709237f 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -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; } /* diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 72845827a..4c3595148 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -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; } /* diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c index 742e5fe18..0e4b2a8c8 100644 --- a/src/plugins/scripts/script-api.c +++ b/src/plugins/scripts/script-api.c @@ -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, diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h index fd6918cdf..4505098f4 100644 --- a/src/plugins/scripts/script-api.h +++ b/src/plugins/scripts/script-api.h @@ -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, diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index b9560d323..4e4f2ee1e 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -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; } /* |