1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 09:43:13 +02:00

Add function config_unset_plugin in API, fix return code of config_set_plugin

This commit is contained in:
Sebastien Helleu
2009-02-01 13:31:20 +01:00
parent 33e733cb0a
commit 5205be4b87
12 changed files with 340 additions and 56 deletions
+43 -9
View File
@@ -1948,6 +1948,7 @@ static XS (XS_weechat_api_config_get_plugin)
static XS (XS_weechat_api_config_set_plugin)
{
char *option, *value;
int rc;
dXSARGS;
/* make C compiler happy */
@@ -1956,24 +1957,56 @@ static XS (XS_weechat_api_config_set_plugin)
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_set_plugin");
PERL_RETURN_ERROR;
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
if (items < 2)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_set_plugin");
PERL_RETURN_ERROR;
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_SET_ERROR);
}
option = SvPV (ST (0), PL_na);
value = SvPV (ST (1), PL_na);
if (script_api_config_set_plugin (weechat_perl_plugin,
perl_current_script,
option,
value))
PERL_RETURN_OK;
rc = script_api_config_set_plugin (weechat_perl_plugin,
perl_current_script,
option,
value);
PERL_RETURN_ERROR;
PERL_RETURN_INT(rc);
}
/*
* weechat::config_unset_plugin: unset a plugin option
*/
static XS (XS_weechat_api_config_unset_plugin)
{
char *option;
int rc;
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_unset_plugin");
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
if (items < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_unset_plugin");
PERL_RETURN_INT(WEECHAT_CONFIG_OPTION_UNSET_ERROR);
}
option = SvPV (ST (0), PL_na);
rc = script_api_config_unset_plugin (weechat_perl_plugin,
perl_current_script,
option);
PERL_RETURN_INT(rc);
}
/*
@@ -4766,6 +4799,7 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::config_get", XS_weechat_api_config_get, "weechat");
newXS ("weechat::config_get_plugin", XS_weechat_api_config_get_plugin, "weechat");
newXS ("weechat::config_set_plugin", XS_weechat_api_config_set_plugin, "weechat");
newXS ("weechat::config_unset_plugin", XS_weechat_api_config_unset_plugin, "weechat");
newXS ("weechat::prefix", XS_weechat_api_prefix, "weechat");
newXS ("weechat::color", XS_weechat_api_color, "weechat");
newXS ("weechat::print", XS_weechat_api_print, "weechat");