diff options
Diffstat (limited to 'src/plugins/scripts/lua/weechat-lua-api.c')
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 3c124282b..1a0de8ee6 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -1345,14 +1345,14 @@ weechat_lua_api_config_read_cb (void *data, * weechat_lua_api_config_section_write_cb: callback for writing section */ -void +int weechat_lua_api_config_section_write_cb (void *data, struct t_config_file *config_file, const char *section_name) { struct t_script_callback *script_callback; char *lua_argv[4], empty_arg[1] = { '\0' }; - int *rc; + int *rc, ret; script_callback = (struct t_script_callback *)data; @@ -1368,11 +1368,20 @@ weechat_lua_api_config_section_write_cb (void *data, script_callback->function, lua_argv); - if (rc) + if (!rc) + ret = WEECHAT_CONFIG_WRITE_ERROR; + else + { + ret = *rc; free (rc); + } if (lua_argv[1]) free (lua_argv[1]); + + return ret; } + + return WEECHAT_CONFIG_WRITE_ERROR; } /* @@ -1380,14 +1389,14 @@ weechat_lua_api_config_section_write_cb (void *data, * default values for section */ -void +int weechat_lua_api_config_section_write_default_cb (void *data, struct t_config_file *config_file, const char *section_name) { struct t_script_callback *script_callback; char *lua_argv[4], empty_arg[1] = { '\0' }; - int *rc; + int *rc, ret; script_callback = (struct t_script_callback *)data; @@ -1403,11 +1412,20 @@ weechat_lua_api_config_section_write_default_cb (void *data, script_callback->function, lua_argv); - if (rc) + if (!rc) + ret = WEECHAT_CONFIG_WRITE_ERROR; + else + { + ret = *rc; free (rc); + } if (lua_argv[1]) free (lua_argv[1]); + + return ret; } + + return WEECHAT_CONFIG_WRITE_ERROR; } /* |