summaryrefslogtreecommitdiff
path: root/src/plugins/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/scripts')
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c37
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c32
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c33
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c37
4 files changed, 139 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 0491b8ddf..b117a4d52 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -1479,6 +1479,42 @@ weechat_lua_api_config_option_set (lua_State *L)
}
/*
+ * weechat_lua_api_config_option_unset: unset an option
+ */
+
+static int
+weechat_lua_api_config_option_unset (lua_State *L)
+{
+ const char *option;
+ int n, rc;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset");
+ LUA_RETURN_INT(0);
+ }
+
+ option = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset");
+ LUA_RETURN_INT(0);
+ }
+
+ option = lua_tostring (lua_current_interpreter, -1);
+
+ rc = weechat_config_option_unset (script_str2ptr (option));
+
+ LUA_RETURN_INT(rc);
+}
+
+/*
* weechat_lua_api_config_option_rename: rename an option
*/
@@ -4950,6 +4986,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "config_string_to_boolean", &weechat_lua_api_config_string_to_boolean },
{ "config_option_reset", &weechat_lua_api_config_option_reset },
{ "config_option_set", &weechat_lua_api_config_option_set },
+ { "config_option_unset", &weechat_lua_api_config_option_unset },
{ "config_option_rename", &weechat_lua_api_config_option_rename },
{ "config_boolean", &weechat_lua_api_config_boolean },
{ "config_integer", &weechat_lua_api_config_integer },
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index bcee5ce30..0926e4653 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -1234,6 +1234,37 @@ static XS (XS_weechat_config_option_set)
}
/*
+ * weechat::config_option_unset: unset an option
+ */
+
+static XS (XS_weechat_config_option_unset)
+{
+ int rc;
+ char *option;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset");
+ PERL_RETURN_INT(0);
+ }
+
+ if (items < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset");
+ PERL_RETURN_INT(0);
+ }
+
+ option = SvPV (ST (0), PL_na);
+ rc = weechat_config_option_unset (script_str2ptr (option));
+
+ PERL_RETURN_INT(rc);
+}
+
+/*
* weechat::config_option_rename: rename an option
*/
@@ -3878,6 +3909,7 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::config_string_to_boolean", XS_weechat_config_string_to_boolean, "weechat");
newXS ("weechat::config_option_reset", XS_weechat_config_option_reset, "weechat");
newXS ("weechat::config_option_set", XS_weechat_config_option_set, "weechat");
+ newXS ("weechat::config_option_unset", XS_weechat_config_option_unset, "weechat");
newXS ("weechat::config_option_rename", XS_weechat_config_option_rename, "weechat");
newXS ("weechat::config_boolean", XS_weechat_config_boolean, "weechat");
newXS ("weechat::config_integer", XS_weechat_config_integer, "weechat");
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 755e16300..5adc196e1 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -1303,6 +1303,38 @@ weechat_python_api_config_option_set (PyObject *self, PyObject *args)
}
/*
+ * weechat_python_api_config_option_unset: unset an option
+ */
+
+static PyObject *
+weechat_python_api_config_option_unset (PyObject *self, PyObject *args)
+{
+ char *option;
+ int rc;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset");
+ PYTHON_RETURN_INT(0);
+ }
+
+ option = NULL;
+
+ if (!PyArg_ParseTuple (args, "s", &option))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset");
+ PYTHON_RETURN_INT(0);
+ }
+
+ rc = weechat_config_option_unset (script_str2ptr (option));
+
+ PYTHON_RETURN_INT(rc);
+}
+
+/*
* weechat_python_api_config_option_rename: rename an option
*/
@@ -4121,6 +4153,7 @@ PyMethodDef weechat_python_funcs[] =
{ "config_string_to_boolean", &weechat_python_api_config_string_to_boolean, METH_VARARGS, "" },
{ "config_option_reset", &weechat_python_api_config_option_reset, METH_VARARGS, "" },
{ "config_option_set", &weechat_python_api_config_option_set, METH_VARARGS, "" },
+ { "config_option_unset", &weechat_python_api_config_option_unset, METH_VARARGS, "" },
{ "config_option_rename", &weechat_python_api_config_option_rename, METH_VARARGS, "" },
{ "config_boolean", &weechat_python_api_config_boolean, METH_VARARGS, "" },
{ "config_integer", &weechat_python_api_config_integer, METH_VARARGS, "" },
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index c41010fd6..3a876e349 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -1510,6 +1510,42 @@ weechat_ruby_api_config_option_set (VALUE class, VALUE option, VALUE new_value,
}
/*
+ * weechat_ruby_api_config_option_unset: unset an option
+ */
+
+static VALUE
+weechat_ruby_api_config_option_unset (VALUE class, VALUE option)
+{
+ char *c_option;
+ int rc;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_option_unset");
+ RUBY_RETURN_INT(0);
+ }
+
+ c_option = NULL;
+
+ if (NIL_P (option))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_option_unset");
+ RUBY_RETURN_INT(0);
+ }
+
+ Check_Type (option, T_STRING);
+
+ c_option = STR2CSTR (option);
+
+ rc = weechat_config_option_unset (script_str2ptr (c_option));
+
+ RUBY_RETURN_INT(rc);
+}
+
+/*
* weechat_ruby_api_config_option_rename: rename an option
*/
@@ -4756,6 +4792,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "config_string_to_boolean", &weechat_ruby_api_config_string_to_boolean, 1);
rb_define_module_function (ruby_mWeechat, "config_option_reset", &weechat_ruby_api_config_option_reset, 2);
rb_define_module_function (ruby_mWeechat, "config_option_set", &weechat_ruby_api_config_option_set, 3);
+ rb_define_module_function (ruby_mWeechat, "config_option_unset", &weechat_ruby_api_config_option_unset, 1);
rb_define_module_function (ruby_mWeechat, "config_option_rename", &weechat_ruby_api_config_option_rename, 2);
rb_define_module_function (ruby_mWeechat, "config_boolean", &weechat_ruby_api_config_boolean, 1);
rb_define_module_function (ruby_mWeechat, "config_integer", &weechat_ruby_api_config_integer, 1);