1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-23 19:36:37 +02:00

Add missing functions in script plugin API to get default values of options

This commit is contained in:
Sebastien Helleu
2009-02-22 09:51:25 +01:00
parent a708f9f813
commit b2584798a1
5 changed files with 682 additions and 0 deletions
@@ -1761,6 +1761,38 @@ weechat_python_api_config_boolean (PyObject *self, PyObject *args)
PYTHON_RETURN_INT(value);
}
/*
* weechat_python_api_config_boolean_default: return default boolean value of option
*/
static PyObject *
weechat_python_api_config_boolean_default (PyObject *self, PyObject *args)
{
char *option;
int value;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_boolean_default");
PYTHON_RETURN_INT(0);
}
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_boolean_default");
PYTHON_RETURN_INT(0);
}
value = weechat_config_boolean_default (script_str2ptr (option));
PYTHON_RETURN_INT(value);
}
/*
* weechat_python_api_config_integer: return integer value of option
*/
@@ -1793,6 +1825,38 @@ weechat_python_api_config_integer (PyObject *self, PyObject *args)
PYTHON_RETURN_INT(value);
}
/*
* weechat_python_api_config_integer_default: return default integer value of option
*/
static PyObject *
weechat_python_api_config_integer_default (PyObject *self, PyObject *args)
{
char *option;
int value;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_integer_default");
PYTHON_RETURN_INT(0);
}
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_integer_default");
PYTHON_RETURN_INT(0);
}
value = weechat_config_integer_default (script_str2ptr (option));
PYTHON_RETURN_INT(value);
}
/*
* weechat_python_api_config_string: return string value of option
*/
@@ -1825,6 +1889,38 @@ weechat_python_api_config_string (PyObject *self, PyObject *args)
PYTHON_RETURN_STRING(result);
}
/*
* weechat_python_api_config_string_default: return default string value of option
*/
static PyObject *
weechat_python_api_config_string_default (PyObject *self, PyObject *args)
{
char *option;
const char *result;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_string_default");
PYTHON_RETURN_EMPTY;
}
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_string_default");
PYTHON_RETURN_EMPTY;
}
result = weechat_config_string_default (script_str2ptr (option));
PYTHON_RETURN_STRING(result);
}
/*
* weechat_python_api_config_color: return color value of option
*/
@@ -1857,6 +1953,38 @@ weechat_python_api_config_color (PyObject *self, PyObject *args)
PYTHON_RETURN_STRING(result);
}
/*
* weechat_python_api_config_color_default: return default color value of option
*/
static PyObject *
weechat_python_api_config_color_default (PyObject *self, PyObject *args)
{
char *option;
const char *result;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_color_default");
PYTHON_RETURN_INT(0);
}
option = NULL;
if (!PyArg_ParseTuple (args, "s", &option))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_color_default");
PYTHON_RETURN_INT(0);
}
result = weechat_config_color_default (script_str2ptr (option));
PYTHON_RETURN_STRING(result);
}
/*
* weechat_python_api_config_write_option: write an option in configuration file
*/
@@ -5378,9 +5506,13 @@ PyMethodDef weechat_python_funcs[] =
{ "config_option_is_null", &weechat_python_api_config_option_is_null, METH_VARARGS, "" },
{ "config_option_default_is_null", &weechat_python_api_config_option_default_is_null, METH_VARARGS, "" },
{ "config_boolean", &weechat_python_api_config_boolean, METH_VARARGS, "" },
{ "config_boolean_default", &weechat_python_api_config_boolean_default, METH_VARARGS, "" },
{ "config_integer", &weechat_python_api_config_integer, METH_VARARGS, "" },
{ "config_integer_default", &weechat_python_api_config_integer_default, METH_VARARGS, "" },
{ "config_string", &weechat_python_api_config_string, METH_VARARGS, "" },
{ "config_string_default", &weechat_python_api_config_string_default, METH_VARARGS, "" },
{ "config_color", &weechat_python_api_config_color, METH_VARARGS, "" },
{ "config_color_default", &weechat_python_api_config_color_default, METH_VARARGS, "" },
{ "config_write_option", &weechat_python_api_config_write_option, METH_VARARGS, "" },
{ "config_write_line", &weechat_python_api_config_write_line, METH_VARARGS, "" },
{ "config_write", &weechat_python_api_config_write, METH_VARARGS, "" },