mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 04:46:37 +02:00
Add missing config functions in script plugin API to free sections and options
This commit is contained in:
@@ -2273,6 +2273,121 @@ weechat_lua_api_config_reload (lua_State *L)
|
||||
LUA_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 },
|
||||
|
||||
@@ -1903,6 +1903,97 @@ static XS (XS_weechat_api_config_reload)
|
||||
PERL_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::config_option_free: free an option in configuration file
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_api_config_option_free)
|
||||
{
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_free");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_free");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
script_api_config_option_free (weechat_perl_plugin,
|
||||
perl_current_script,
|
||||
script_str2ptr (SvPV (ST (0), PL_na))); /* option */
|
||||
|
||||
PERL_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::config_section_free_options: free options of a section in
|
||||
* configuration file
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_api_config_section_free_options)
|
||||
{
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free_options");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free_options");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
script_api_config_section_free_options (weechat_perl_plugin,
|
||||
perl_current_script,
|
||||
script_str2ptr (SvPV (ST (0), PL_na))); /* section */
|
||||
|
||||
PERL_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::config_section_free: free section in configuration file
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_api_config_section_free)
|
||||
{
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
script_api_config_section_free (weechat_perl_plugin,
|
||||
perl_current_script,
|
||||
script_str2ptr (SvPV (ST (0), PL_na))); /* section */
|
||||
|
||||
PERL_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::config_free: free configuration file
|
||||
*/
|
||||
@@ -4984,6 +5075,9 @@ weechat_perl_api_init (pTHX)
|
||||
newXS ("weechat::config_write", XS_weechat_api_config_write, "weechat");
|
||||
newXS ("weechat::config_read", XS_weechat_api_config_read, "weechat");
|
||||
newXS ("weechat::config_reload", XS_weechat_api_config_reload, "weechat");
|
||||
newXS ("weechat::config_option_free", XS_weechat_api_config_option_free, "weechat");
|
||||
newXS ("weechat::config_section_free_options", XS_weechat_api_config_section_free_options, "weechat");
|
||||
newXS ("weechat::config_section_free", XS_weechat_api_config_section_free, "weechat");
|
||||
newXS ("weechat::config_free", XS_weechat_api_config_free, "weechat");
|
||||
newXS ("weechat::config_get", XS_weechat_api_config_get, "weechat");
|
||||
newXS ("weechat::config_get_plugin", XS_weechat_api_config_get_plugin, "weechat");
|
||||
|
||||
@@ -2022,6 +2022,106 @@ weechat_python_api_config_reload (PyObject *self, PyObject *args)
|
||||
PYTHON_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_config_option_free: free an option in configuration file
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_config_option_free (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *option;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_free");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
option = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", &option))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_free");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
script_api_config_option_free (weechat_python_plugin,
|
||||
python_current_script,
|
||||
script_str2ptr (option));
|
||||
|
||||
PYTHON_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_config_section_free_options: free all options of a section
|
||||
* in configuration file
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_config_section_free_options (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *section;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free_options");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
section = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", §ion))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free_options");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
script_api_config_section_free_options (weechat_python_plugin,
|
||||
python_current_script,
|
||||
script_str2ptr (section));
|
||||
|
||||
PYTHON_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_config_section_free: free section in configuration file
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_config_section_free (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *section;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
section = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", §ion))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
script_api_config_section_free (weechat_python_plugin,
|
||||
python_current_script,
|
||||
script_str2ptr (section));
|
||||
|
||||
PYTHON_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_config_free: free configuration file
|
||||
*/
|
||||
@@ -5286,6 +5386,9 @@ PyMethodDef weechat_python_funcs[] =
|
||||
{ "config_write", &weechat_python_api_config_write, METH_VARARGS, "" },
|
||||
{ "config_read", &weechat_python_api_config_read, METH_VARARGS, "" },
|
||||
{ "config_reload", &weechat_python_api_config_reload, METH_VARARGS, "" },
|
||||
{ "config_option_free", &weechat_python_api_config_option_free, METH_VARARGS, "" },
|
||||
{ "config_section_free_options", &weechat_python_api_config_section_free_options, METH_VARARGS, "" },
|
||||
{ "config_section_free", &weechat_python_api_config_section_free, METH_VARARGS, "" },
|
||||
{ "config_free", &weechat_python_api_config_free, METH_VARARGS, "" },
|
||||
{ "config_get", &weechat_python_api_config_get, METH_VARARGS, "" },
|
||||
{ "config_get_plugin", &weechat_python_api_config_get_plugin, METH_VARARGS, "" },
|
||||
|
||||
@@ -2326,6 +2326,118 @@ weechat_ruby_api_config_reload (VALUE class, VALUE config_file)
|
||||
RUBY_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_config_option_free: free an option in configuration file
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_option_free (VALUE class, VALUE option)
|
||||
{
|
||||
char *c_option;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_free");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
c_option = NULL;
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_free");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
|
||||
c_option = STR2CSTR (option);
|
||||
|
||||
script_api_config_option_free (weechat_ruby_plugin,
|
||||
ruby_current_script,
|
||||
script_str2ptr (c_option));
|
||||
|
||||
RUBY_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_config_section_free_options: free all options of a section
|
||||
* in configuration file
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_section_free_options (VALUE class, VALUE section)
|
||||
{
|
||||
char *c_section;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free_options");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
c_section = NULL;
|
||||
|
||||
if (NIL_P (section))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free_options");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
Check_Type (section, T_STRING);
|
||||
|
||||
c_section = STR2CSTR (section);
|
||||
|
||||
script_api_config_section_free_options (weechat_ruby_plugin,
|
||||
ruby_current_script,
|
||||
script_str2ptr (c_section));
|
||||
|
||||
RUBY_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_config_section_free: free section in configuration file
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_section_free (VALUE class, VALUE section)
|
||||
{
|
||||
char *c_section;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
c_section = NULL;
|
||||
|
||||
if (NIL_P (section))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
Check_Type (section, T_STRING);
|
||||
|
||||
c_section = STR2CSTR (section);
|
||||
|
||||
script_api_config_section_free (weechat_ruby_plugin,
|
||||
ruby_current_script,
|
||||
script_str2ptr (c_section));
|
||||
|
||||
RUBY_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_config_free: free configuration file
|
||||
*/
|
||||
@@ -6053,6 +6165,9 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
rb_define_module_function (ruby_mWeechat, "config_write", &weechat_ruby_api_config_write, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_read", &weechat_ruby_api_config_read, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_reload", &weechat_ruby_api_config_reload, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_option_free", &weechat_ruby_api_config_option_free, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_section_free_options", &weechat_ruby_api_config_section_free_options, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_section_free", &weechat_ruby_api_config_section_free, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_free", &weechat_ruby_api_config_free, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_get", &weechat_ruby_api_config_get, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_get_plugin", &weechat_ruby_api_config_get_plugin, 1);
|
||||
|
||||
@@ -475,6 +475,92 @@ script_api_config_new_option (struct t_weechat_plugin *weechat_plugin,
|
||||
return new_option;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_config_option_free: free an option in configuration file
|
||||
*/
|
||||
|
||||
void
|
||||
script_api_config_option_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_option *option)
|
||||
{
|
||||
struct t_script_callback *ptr_script_callback, *next_callback;
|
||||
|
||||
if (!weechat_plugin || !script || !option)
|
||||
return;
|
||||
|
||||
weechat_config_option_free (option);
|
||||
|
||||
ptr_script_callback = script->callbacks;
|
||||
while (ptr_script_callback)
|
||||
{
|
||||
next_callback = ptr_script_callback->next_callback;
|
||||
|
||||
if (ptr_script_callback->config_option == option)
|
||||
script_callback_remove (script, ptr_script_callback);
|
||||
|
||||
ptr_script_callback = next_callback;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_config_section_free_options: free all options of a section in
|
||||
* configuration file
|
||||
*/
|
||||
|
||||
void
|
||||
script_api_config_section_free_options (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_section *section)
|
||||
{
|
||||
struct t_script_callback *ptr_script_callback, *next_callback;
|
||||
|
||||
if (!weechat_plugin || !script || !section)
|
||||
return;
|
||||
|
||||
weechat_config_section_free_options (section);
|
||||
|
||||
ptr_script_callback = script->callbacks;
|
||||
while (ptr_script_callback)
|
||||
{
|
||||
next_callback = ptr_script_callback->next_callback;
|
||||
|
||||
if ((ptr_script_callback->config_section == section)
|
||||
&& ptr_script_callback->config_option)
|
||||
script_callback_remove (script, ptr_script_callback);
|
||||
|
||||
ptr_script_callback = next_callback;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_config_section_free: free a section in configuration file
|
||||
*/
|
||||
|
||||
void
|
||||
script_api_config_section_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_section *section)
|
||||
{
|
||||
struct t_script_callback *ptr_script_callback, *next_callback;
|
||||
|
||||
if (!weechat_plugin || !script || !section)
|
||||
return;
|
||||
|
||||
weechat_config_section_free (section);
|
||||
|
||||
ptr_script_callback = script->callbacks;
|
||||
while (ptr_script_callback)
|
||||
{
|
||||
next_callback = ptr_script_callback->next_callback;
|
||||
|
||||
if (ptr_script_callback->config_section == section)
|
||||
script_callback_remove (script, ptr_script_callback);
|
||||
|
||||
ptr_script_callback = next_callback;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* script_api_config_free: free configuration file
|
||||
*/
|
||||
|
||||
@@ -80,6 +80,15 @@ extern struct t_config_option *script_api_config_new_option (struct t_weechat_pl
|
||||
void (*callback_delete)(void *data,
|
||||
struct t_config_option *option),
|
||||
const char *function_delete);
|
||||
extern void script_api_config_option_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_option *option);
|
||||
extern void script_api_config_section_free_options (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_section *section);
|
||||
extern void script_api_config_section_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_section *section);
|
||||
extern void script_api_config_free (struct t_weechat_plugin *weechat_plugin,
|
||||
struct t_plugin_script *script,
|
||||
struct t_config_file *config_file);
|
||||
|
||||
@@ -2205,6 +2205,106 @@ weechat_tcl_api_config_reload (ClientData clientData, Tcl_Interp *interp,
|
||||
TCL_RETURN_INT(rc);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_config_option_free: free an option in configuration file
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_tcl_api_config_option_free (ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
int i;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) clientData;
|
||||
|
||||
if (!tcl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_free");
|
||||
TCL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (objc < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_free");
|
||||
TCL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
script_api_config_option_free (weechat_tcl_plugin,
|
||||
tcl_current_script,
|
||||
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */
|
||||
|
||||
TCL_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_config_section_free_options: free all options of a section
|
||||
* in configuration file
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_tcl_api_config_section_free_options (ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
int i;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) clientData;
|
||||
|
||||
if (!tcl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free_options");
|
||||
TCL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (objc < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free_options");
|
||||
TCL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
script_api_config_section_free_options (weechat_tcl_plugin,
|
||||
tcl_current_script,
|
||||
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* section */
|
||||
|
||||
TCL_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_config_section_free: free section in configuration file
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_tcl_api_config_section_free (ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj *objp;
|
||||
int i;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) clientData;
|
||||
|
||||
if (!tcl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_section_free");
|
||||
TCL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (objc < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_section_free");
|
||||
TCL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
script_api_config_section_free (weechat_tcl_plugin,
|
||||
tcl_current_script,
|
||||
script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* section */
|
||||
|
||||
TCL_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_tcl_api_config_free: free configuration file
|
||||
*/
|
||||
@@ -5724,6 +5824,12 @@ void weechat_tcl_api_init (Tcl_Interp *interp) {
|
||||
weechat_tcl_api_config_read, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp,"weechat::config_reload",
|
||||
weechat_tcl_api_config_reload, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp,"weechat::config_option_free",
|
||||
weechat_tcl_api_config_option_free, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp,"weechat::config_section_free_options",
|
||||
weechat_tcl_api_config_section_free_options, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp,"weechat::config_section_free",
|
||||
weechat_tcl_api_config_section_free, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp,"weechat::config_free",
|
||||
weechat_tcl_api_config_free, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
|
||||
Tcl_CreateObjCommand (interp,"weechat::config_get",
|
||||
|
||||
Reference in New Issue
Block a user