diff options
Diffstat (limited to 'src/plugins/scripts/perl/weechat-perl-api.c')
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 9d48b32c0..b4e08ad42 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -1119,14 +1119,14 @@ weechat_perl_api_config_section_read_cb (void *data, * weechat_perl_api_config_section_write_cb: callback for writing section */ -void +int weechat_perl_api_config_section_write_cb (void *data, struct t_config_file *config_file, const char *section_name) { struct t_script_callback *script_callback; char *perl_argv[4], empty_arg[1] = { '\0' }; - int *rc; + int *rc, ret; script_callback = (struct t_script_callback *)data; @@ -1142,11 +1142,20 @@ weechat_perl_api_config_section_write_cb (void *data, script_callback->function, perl_argv); - if (rc) + if (!rc) + ret = WEECHAT_CONFIG_WRITE_ERROR; + else + { + ret = *rc; free (rc); + } if (perl_argv[1]) free (perl_argv[1]); + + return ret; } + + return WEECHAT_CONFIG_WRITE_ERROR; } /* @@ -1154,17 +1163,17 @@ weechat_perl_api_config_section_write_cb (void *data, * default values for section */ -void +int weechat_perl_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 *perl_argv[4], empty_arg[1] = { '\0' }; - int *rc; + int *rc, ret; script_callback = (struct t_script_callback *)data; - + if (script_callback && script_callback->function && script_callback->function[0]) { perl_argv[0] = (script_callback->data) ? script_callback->data : empty_arg; @@ -1176,12 +1185,21 @@ weechat_perl_api_config_section_write_default_cb (void *data, WEECHAT_SCRIPT_EXEC_INT, script_callback->function, perl_argv); - - if (rc) + + if (!rc) + ret = WEECHAT_CONFIG_WRITE_ERROR; + else + { + ret = *rc; free (rc); + } if (perl_argv[1]) free (perl_argv[1]); + + return ret; } + + return WEECHAT_CONFIG_WRITE_ERROR; } /* |