summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/lua
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-02-21 21:31:46 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-02-21 21:31:46 +0100
commita708f9f81397e5d9e8a066cc74b2103f4cfc2178 (patch)
tree42327f4ee7a2b7a445add14441f61f2cbdbf5b58 /src/plugins/scripts/lua
parentafdee2d9194bced6af912daefb91895890a1fefd (diff)
downloadweechat-a708f9f81397e5d9e8a066cc74b2103f4cfc2178.zip
Add missing config functions in script plugin API to free sections and options
Diffstat (limited to 'src/plugins/scripts/lua')
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index b9d9ea66b..f39284df0 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -2274,6 +2274,121 @@ weechat_lua_api_config_reload (lua_State *L)
}
/*
+ * weechat_lua_api_config_option_free: free an option in configuration file
+ */
+
+static int
+weechat_lua_api_config_option_free (lua_State *L)
+{
+ const char *option;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_free");
+ LUA_RETURN_ERROR;
+ }
+
+ option = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_free");
+ LUA_RETURN_ERROR;
+ }
+
+ option = lua_tostring (lua_current_interpreter, -1);
+
+ script_api_config_option_free (weechat_lua_plugin,
+ lua_current_script,
+ script_str2ptr (option));
+
+ LUA_RETURN_OK;
+}
+
+/*
+ * weechat_lua_api_config_section_free_options: free all options of a section
+ * in configuration file
+ */
+
+static int
+weechat_lua_api_config_section_free_options (lua_State *L)
+{
+ const char *section;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free_options");
+ LUA_RETURN_ERROR;
+ }
+
+ section = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free_options");
+ LUA_RETURN_ERROR;
+ }
+
+ section = lua_tostring (lua_current_interpreter, -1);
+
+ script_api_config_section_free_options (weechat_lua_plugin,
+ lua_current_script,
+ script_str2ptr (section));
+
+ LUA_RETURN_OK;
+}
+
+/*
+ * weechat_lua_api_config_section_free: free section in configuration file
+ */
+
+static int
+weechat_lua_api_config_section_free (lua_State *L)
+{
+ const char *section;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free");
+ LUA_RETURN_ERROR;
+ }
+
+ section = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free");
+ LUA_RETURN_ERROR;
+ }
+
+ section = lua_tostring (lua_current_interpreter, -1);
+
+ script_api_config_section_free (weechat_lua_plugin,
+ lua_current_script,
+ script_str2ptr (section));
+
+ LUA_RETURN_OK;
+}
+
+/*
* weechat_lua_api_config_free: free configuration file
*/
@@ -6300,6 +6415,9 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "config_write", &weechat_lua_api_config_write },
{ "config_read", &weechat_lua_api_config_read },
{ "config_reload", &weechat_lua_api_config_reload },
+ { "config_option_free", &weechat_lua_api_config_option_free },
+ { "config_section_free_options", &weechat_lua_api_config_section_free_options },
+ { "config_section_free", &weechat_lua_api_config_section_free },
{ "config_free", &weechat_lua_api_config_free },
{ "config_get", &weechat_lua_api_config_get },
{ "config_get_plugin", &weechat_lua_api_config_get_plugin },