diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index f39284df0..2b0284e5b 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -1975,6 +1975,42 @@ weechat_lua_api_config_boolean (lua_State *L) LUA_RETURN_INT(value); } +/* + * weechat_lua_api_config_boolean_default: return default boolean value of option + */ + +static int +weechat_lua_api_config_boolean_default (lua_State *L) +{ + const char *option; + int n, value; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_boolean_default"); + LUA_RETURN_INT(0); + } + + option = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_boolean_default"); + LUA_RETURN_INT(0); + } + + option = lua_tostring (lua_current_interpreter, -1); + + value = weechat_config_boolean_default (script_str2ptr (option)); + + LUA_RETURN_INT(value); +} + /* * weechat_lua_api_config_integer: return integer value of option */ @@ -2011,6 +2047,42 @@ weechat_lua_api_config_integer (lua_State *L) LUA_RETURN_INT(value); } +/* + * weechat_lua_api_config_integer_default: return default integer value of option + */ + +static int +weechat_lua_api_config_integer_default (lua_State *L) +{ + const char *option; + int n, value; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_integer_default"); + LUA_RETURN_INT(0); + } + + option = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_integer_default"); + LUA_RETURN_INT(0); + } + + option = lua_tostring (lua_current_interpreter, -1); + + value = weechat_config_integer_default (script_str2ptr (option)); + + LUA_RETURN_INT(value); +} + /* * weechat_lua_api_config_string: return string value of option */ @@ -2047,6 +2119,42 @@ weechat_lua_api_config_string (lua_State *L) LUA_RETURN_STRING(result); } +/* + * weechat_lua_api_config_string_default: return default string value of option + */ + +static int +weechat_lua_api_config_string_default (lua_State *L) +{ + const char *option, *result; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_string_default"); + LUA_RETURN_EMPTY; + } + + option = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_string_default"); + LUA_RETURN_INT(0); + } + + option = lua_tostring (lua_current_interpreter, -1); + + result = weechat_config_string_default (script_str2ptr (option)); + + LUA_RETURN_STRING(result); +} + /* * weechat_lua_api_config_color: return color value of option */ @@ -2083,6 +2191,42 @@ weechat_lua_api_config_color (lua_State *L) LUA_RETURN_STRING(result); } +/* + * weechat_lua_api_config_color_default: return default color value of option + */ + +static int +weechat_lua_api_config_color_default (lua_State *L) +{ + const char *option, *result; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_color_default"); + LUA_RETURN_INT(0); + } + + option = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_color_default"); + LUA_RETURN_INT(0); + } + + option = lua_tostring (lua_current_interpreter, -1); + + result = weechat_config_color_default (script_str2ptr (option)); + + LUA_RETURN_STRING(result); +} + /* * weechat_lua_api_config_write_option: write an option in configuration file */ @@ -6407,9 +6551,13 @@ const struct luaL_reg weechat_lua_api_funcs[] = { { "config_option_is_null", &weechat_lua_api_config_option_is_null }, { "config_option_default_is_null", &weechat_lua_api_config_option_default_is_null }, { "config_boolean", &weechat_lua_api_config_boolean }, + { "config_boolean_default", &weechat_lua_api_config_boolean_default }, { "config_integer", &weechat_lua_api_config_integer }, + { "config_integer_default", &weechat_lua_api_config_integer_default }, { "config_string", &weechat_lua_api_config_string }, + { "config_string_default", &weechat_lua_api_config_string_default }, { "config_color", &weechat_lua_api_config_color }, + { "config_color_default", &weechat_lua_api_config_color_default }, { "config_write_option", &weechat_lua_api_config_write_option }, { "config_write_line", &weechat_lua_api_config_write_line }, { "config_write", &weechat_lua_api_config_write }, diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 6e314afe1..33cfe9c41 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -1664,6 +1664,35 @@ static XS (XS_weechat_api_config_boolean) PERL_RETURN_INT(value); } +/* + * weechat::config_boolean_default: return default boolean value of option + */ + +static XS (XS_weechat_api_config_boolean_default) +{ + int value; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_boolean_default"); + PERL_RETURN_INT(0); + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_boolean_default"); + PERL_RETURN_INT(0); + } + + value = weechat_config_boolean_default (script_str2ptr (SvPV (ST (0), PL_na))); /* option */ + + PERL_RETURN_INT(value); +} + /* * weechat::config_integer: return integer value of option */ @@ -1693,6 +1722,35 @@ static XS (XS_weechat_api_config_integer) PERL_RETURN_INT(value); } +/* + * weechat::config_integer_default: return default integer value of option + */ + +static XS (XS_weechat_api_config_integer_default) +{ + int value; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_integer_default"); + PERL_RETURN_INT(0); + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_integer_default"); + PERL_RETURN_INT(0); + } + + value = weechat_config_integer_default (script_str2ptr (SvPV (ST (0), PL_na))); /* option */ + + PERL_RETURN_INT(value); +} + /* * weechat::config_string: return string value of option */ @@ -1722,6 +1780,35 @@ static XS (XS_weechat_api_config_string) PERL_RETURN_STRING(result); } +/* + * weechat::config_string_default: return default string value of option + */ + +static XS (XS_weechat_api_config_string_default) +{ + const char *result; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_string_default"); + PERL_RETURN_EMPTY; + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_string_default"); + PERL_RETURN_EMPTY; + } + + result = weechat_config_string_default (script_str2ptr (SvPV (ST (0), PL_na))); /* option */ + + PERL_RETURN_STRING(result); +} + /* * weechat::config_color: return color value of option */ @@ -1751,6 +1838,35 @@ static XS (XS_weechat_api_config_color) PERL_RETURN_STRING(result); } +/* + * weechat::config_color_default: return default color value of option + */ + +static XS (XS_weechat_api_config_color_default) +{ + const char *result; + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_color_default"); + PERL_RETURN_INT(0); + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_color_default"); + PERL_RETURN_INT(0); + } + + result = weechat_config_color_default (script_str2ptr (SvPV (ST (0), PL_na))); /* option */ + + PERL_RETURN_STRING(result); +} + /* * weechat::config_write_option: write an option in configuration file */ @@ -5067,9 +5183,13 @@ weechat_perl_api_init (pTHX) newXS ("weechat::config_option_is_null", XS_weechat_api_config_option_is_null, "weechat"); newXS ("weechat::config_option_default_is_null", XS_weechat_api_config_option_default_is_null, "weechat"); newXS ("weechat::config_boolean", XS_weechat_api_config_boolean, "weechat"); + newXS ("weechat::config_boolean_default", XS_weechat_api_config_boolean_default, "weechat"); newXS ("weechat::config_integer", XS_weechat_api_config_integer, "weechat"); + newXS ("weechat::config_integer_default", XS_weechat_api_config_integer_default, "weechat"); newXS ("weechat::config_string", XS_weechat_api_config_string, "weechat"); + newXS ("weechat::config_string_default", XS_weechat_api_config_string_default, "weechat"); newXS ("weechat::config_color", XS_weechat_api_config_color, "weechat"); + newXS ("weechat::config_color_default", XS_weechat_api_config_color_default, "weechat"); newXS ("weechat::config_write_option", XS_weechat_api_config_write_option, "weechat"); newXS ("weechat::config_write_line", XS_weechat_api_config_write_line, "weechat"); newXS ("weechat::config_write", XS_weechat_api_config_write, "weechat"); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 841e5428e..eba98086c 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -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, "" }, diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index b26d222ab..0b884aa90 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -2025,6 +2025,42 @@ weechat_ruby_api_config_boolean (VALUE class, VALUE option) RUBY_RETURN_INT(value); } +/* + * weechat_ruby_api_config_boolean_default: return default boolean value of option + */ + +static VALUE +weechat_ruby_api_config_boolean_default (VALUE class, VALUE option) +{ + char *c_option; + int value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_boolean_default"); + RUBY_RETURN_INT(0); + } + + c_option = NULL; + + if (NIL_P (option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_boolean_default"); + RUBY_RETURN_INT(0); + } + + Check_Type (option, T_STRING); + + c_option = STR2CSTR (option); + + value = weechat_config_boolean_default (script_str2ptr (c_option)); + + RUBY_RETURN_INT(value); +} + /* * weechat_ruby_api_config_integer: return integer value of option */ @@ -2061,6 +2097,42 @@ weechat_ruby_api_config_integer (VALUE class, VALUE option) RUBY_RETURN_INT(value); } +/* + * weechat_ruby_api_config_integer_default: return default integer value of option + */ + +static VALUE +weechat_ruby_api_config_integer_default (VALUE class, VALUE option) +{ + char *c_option; + int value; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_integer_default"); + RUBY_RETURN_INT(0); + } + + c_option = NULL; + + if (NIL_P (option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_integer_default"); + RUBY_RETURN_INT(0); + } + + Check_Type (option, T_STRING); + + c_option = STR2CSTR (option); + + value = weechat_config_integer_default (script_str2ptr (c_option)); + + RUBY_RETURN_INT(value); +} + /* * weechat_ruby_api_config_string: return string value of option */ @@ -2097,6 +2169,42 @@ weechat_ruby_api_config_string (VALUE class, VALUE option) RUBY_RETURN_STRING(result); } +/* + * weechat_ruby_api_config_string_default: return default string value of option + */ + +static VALUE +weechat_ruby_api_config_string_default (VALUE class, VALUE option) +{ + char *c_option; + const char *result; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_string_default"); + RUBY_RETURN_EMPTY; + } + + c_option = NULL; + + if (NIL_P (option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_string_default"); + RUBY_RETURN_EMPTY; + } + + Check_Type (option, T_STRING); + + c_option = STR2CSTR (option); + + result = weechat_config_string_default (script_str2ptr (c_option)); + + RUBY_RETURN_STRING(result); +} + /* * weechat_ruby_api_config_color: return color value of option */ @@ -2133,6 +2241,42 @@ weechat_ruby_api_config_color (VALUE class, VALUE option) RUBY_RETURN_STRING(result); } +/* + * weechat_ruby_api_config_color_default: return default color value of option + */ + +static VALUE +weechat_ruby_api_config_color_default (VALUE class, VALUE option) +{ + char *c_option; + const char *result; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_color_default"); + RUBY_RETURN_INT(0); + } + + c_option = NULL; + + if (NIL_P (option)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_color_default"); + RUBY_RETURN_INT(0); + } + + Check_Type (option, T_STRING); + + c_option = STR2CSTR (option); + + result = weechat_config_color_default (script_str2ptr (c_option)); + + RUBY_RETURN_STRING(result); +} + /* * weechat_ruby_api_config_write_option: write an option in configuration file */ @@ -6157,9 +6301,13 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) rb_define_module_function (ruby_mWeechat, "config_option_is_null", &weechat_ruby_api_config_option_is_null, 1); rb_define_module_function (ruby_mWeechat, "config_option_default_is_null", &weechat_ruby_api_config_option_default_is_null, 1); rb_define_module_function (ruby_mWeechat, "config_boolean", &weechat_ruby_api_config_boolean, 1); + rb_define_module_function (ruby_mWeechat, "config_boolean_default", &weechat_ruby_api_config_boolean_default, 1); rb_define_module_function (ruby_mWeechat, "config_integer", &weechat_ruby_api_config_integer, 1); + rb_define_module_function (ruby_mWeechat, "config_integer_default", &weechat_ruby_api_config_integer_default, 1); rb_define_module_function (ruby_mWeechat, "config_string", &weechat_ruby_api_config_string, 1); + rb_define_module_function (ruby_mWeechat, "config_string_default", &weechat_ruby_api_config_string_default, 1); rb_define_module_function (ruby_mWeechat, "config_color", &weechat_ruby_api_config_color, 1); + rb_define_module_function (ruby_mWeechat, "config_color_default", &weechat_ruby_api_config_color_default, 1); rb_define_module_function (ruby_mWeechat, "config_write_option", &weechat_ruby_api_config_write_option, 2); rb_define_module_function (ruby_mWeechat, "config_write_line", &weechat_ruby_api_config_write_line, 3); rb_define_module_function (ruby_mWeechat, "config_write", &weechat_ruby_api_config_write, 1); diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index b93f8ae2e..7ef405f74 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -1943,6 +1943,37 @@ weechat_tcl_api_config_boolean (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_INT(result); } +/* + * weechat_tcl_api_config_boolean_default: return default boolean value of option + */ + +static int +weechat_tcl_api_config_boolean_default (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj* objp; + int result, i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_boolean_default"); + TCL_RETURN_INT(0); + } + + if (objc < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_boolean_default"); + TCL_RETURN_INT(0); + } + + result = weechat_config_boolean_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + + TCL_RETURN_INT(result); +} + /* * weechat_tcl_api_config_integer: return integer value of option */ @@ -1974,6 +2005,37 @@ weechat_tcl_api_config_integer (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_INT(result); } +/* + * weechat_tcl_api_config_integer_default: return default integer value of option + */ + +static int +weechat_tcl_api_config_integer_default (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj* objp; + int result, i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_integer_default"); + TCL_RETURN_INT(0); + } + + if (objc < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_integer_default"); + TCL_RETURN_INT(0); + } + + result = weechat_config_integer_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + + TCL_RETURN_INT(result); +} + /* * weechat_tcl_api_config_string: return string value of option */ @@ -2006,6 +2068,38 @@ weechat_tcl_api_config_string (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_STRING(result); } +/* + * weechat_tcl_api_config_string_default: return default string value of option + */ + +static int +weechat_tcl_api_config_string_default (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + const char *result; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_string_default"); + TCL_RETURN_EMPTY; + } + + if (objc < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_string_default"); + TCL_RETURN_EMPTY; + } + + result = weechat_config_string_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + + TCL_RETURN_STRING(result); +} + /* * weechat_tcl_api_config_color: return color value of option */ @@ -2038,6 +2132,38 @@ weechat_tcl_api_config_color (ClientData clientData, Tcl_Interp *interp, TCL_RETURN_STRING(result); } +/* + * weechat_tcl_api_config_color_default: return default color value of option + */ + +static int +weechat_tcl_api_config_color_default (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + const char *result; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_color_default"); + TCL_RETURN_INT(0); + } + + if (objc < 2) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_color_default"); + TCL_RETURN_INT(0); + } + + result = weechat_config_color_default (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i))); /* option */ + + TCL_RETURN_STRING(result); +} + /* * weechat_tcl_api_config_write_option: write an option in configuration file */ @@ -5808,12 +5934,20 @@ void weechat_tcl_api_init (Tcl_Interp *interp) { weechat_tcl_api_config_option_default_is_null, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_boolean", weechat_tcl_api_config_boolean, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::config_boolean_default", + weechat_tcl_api_config_boolean_default, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_integer", weechat_tcl_api_config_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::config_integer_default", + weechat_tcl_api_config_integer_default, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_string", weechat_tcl_api_config_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::config_string_default", + weechat_tcl_api_config_string_default, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_color", weechat_tcl_api_config_color, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::config_color_default", + weechat_tcl_api_config_color_default, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_write_option", weechat_tcl_api_config_write_option, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::config_write_line",