diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2009-02-01 13:31:20 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2009-02-01 13:31:20 +0100 |
commit | 5205be4b875c7fbc5d82818367e51ad49b667f72 (patch) | |
tree | ca4d107431f558e46a36a4b382ac89bf30585893 /src/plugins/scripts/script-api.c | |
parent | 33e733cb0adad382fde58764a2de29031c2df767 (diff) | |
download | weechat-5205be4b875c7fbc5d82818367e51ad49b667f72.zip |
Add function config_unset_plugin in API, fix return code of config_set_plugin
Diffstat (limited to 'src/plugins/scripts/script-api.c')
-rw-r--r-- | src/plugins/scripts/script-api.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c index d0fabb10a..911f1acb0 100644 --- a/src/plugins/scripts/script-api.c +++ b/src/plugins/scripts/script-api.c @@ -1314,7 +1314,7 @@ script_api_command (struct t_weechat_plugin *weechat_plugin, /* * script_api_config_get_plugin: get a value of a script option - * format in file is: plugin.script.option = value + * format in file is "plugin.script.option" */ const char * @@ -1342,7 +1342,7 @@ script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin, /* * script_api_config_set_plugin: set value of a script config option - * format in file is: plugin.script.option = value + * format in file is "plugin.script.option" */ int @@ -1367,3 +1367,31 @@ script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin, return return_code; } + +/* + * script_api_config_unset_plugin: unset script config option + * format in file is "plugin.script.option" + */ + +int +script_api_config_unset_plugin (struct t_weechat_plugin *weechat_plugin, + struct t_plugin_script *script, + const char *option) +{ + char *option_fullname; + int return_code; + + option_fullname = malloc ((strlen (script->name) + + strlen (option) + 2)); + if (!option_fullname) + return 0; + + strcpy (option_fullname, script->name); + strcat (option_fullname, "."); + strcat (option_fullname, option); + + return_code = weechat_config_unset_plugin (option_fullname); + free (option_fullname); + + return return_code; +} |