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.c39
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c36
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c36
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c40
-rw-r--r--src/plugins/scripts/script-api.c25
-rw-r--r--src/plugins/scripts/script-api.h4
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c40
7 files changed, 220 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 286b4509b..c89ad16d0 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -2912,6 +2912,44 @@ weechat_lua_api_config_set_plugin (lua_State *L)
}
/*
+ * weechat_lua_api_config_set_desc_plugin: set description of a plugin option
+ */
+
+static int
+weechat_lua_api_config_set_desc_plugin (lua_State *L)
+{
+ const char *option, *description;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script || !lua_current_script->name)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ LUA_RETURN_ERROR;
+ }
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ LUA_RETURN_ERROR;
+ }
+
+ option = lua_tostring (lua_current_interpreter, -2);
+ description = lua_tostring (lua_current_interpreter, -1);
+
+ script_api_config_set_desc_plugin (weechat_lua_plugin,
+ lua_current_script,
+ option,
+ description);
+
+ LUA_RETURN_OK;
+}
+
+/*
* weechat_lua_api_config_unset_plugin: unset plugin option
*/
@@ -7800,6 +7838,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "config_get_plugin", &weechat_lua_api_config_get_plugin },
{ "config_is_set_plugin", &weechat_lua_api_config_is_set_plugin },
{ "config_set_plugin", &weechat_lua_api_config_set_plugin },
+ { "config_set_desc_plugin", &weechat_lua_api_config_set_desc_plugin },
{ "config_unset_plugin", &weechat_lua_api_config_unset_plugin },
{ "prefix", &weechat_lua_api_prefix },
{ "color", &weechat_lua_api_color },
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 0219a8e08..97f54c8a6 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -2611,6 +2611,41 @@ XS (XS_weechat_api_config_set_plugin)
}
/*
+ * weechat::config_set_desc_plugin: set description of a plugin option
+ */
+
+XS (XS_weechat_api_config_set_desc_plugin)
+{
+ char *option, *description;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script || !perl_current_script->name)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ PERL_RETURN_ERROR;
+ }
+
+ if (items < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ PERL_RETURN_ERROR;
+ }
+
+ option = SvPV (ST (0), PL_na);
+ description = SvPV (ST (1), PL_na);
+
+ script_api_config_set_desc_plugin (weechat_perl_plugin,
+ perl_current_script,
+ option,
+ description);
+
+ PERL_RETURN_OK;
+}
+
+/*
* weechat::config_unset_plugin: unset a plugin option
*/
@@ -6729,6 +6764,7 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::config_get_plugin", XS_weechat_api_config_get_plugin, "weechat");
newXS ("weechat::config_is_set_plugin", XS_weechat_api_config_is_set_plugin, "weechat");
newXS ("weechat::config_set_plugin", XS_weechat_api_config_set_plugin, "weechat");
+ newXS ("weechat::config_set_desc_plugin", XS_weechat_api_config_set_desc_plugin, "weechat");
newXS ("weechat::config_unset_plugin", XS_weechat_api_config_unset_plugin, "weechat");
newXS ("weechat::prefix", XS_weechat_api_prefix, "weechat");
newXS ("weechat::color", XS_weechat_api_color, "weechat");
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index 9a3924fc4..daf7d8b75 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -2760,6 +2760,41 @@ weechat_python_api_config_set_plugin (PyObject *self, PyObject *args)
}
/*
+ * weechat_python_api_config_set_desc_plugin: set description of a plugin option
+ */
+
+static PyObject *
+weechat_python_api_config_set_desc_plugin (PyObject *self, PyObject *args)
+{
+ char *option, *description;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script || !python_current_script->name)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ PYTHON_RETURN_ERROR;
+ }
+
+ option = NULL;
+ description = NULL;
+
+ if (!PyArg_ParseTuple (args, "ss", &option, &description))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ PYTHON_RETURN_ERROR;
+ }
+
+ script_api_config_set_desc_plugin (weechat_python_plugin,
+ python_current_script,
+ option,
+ description);
+
+ PYTHON_RETURN_OK;
+}
+
+/*
* weechat_python_api_config_unset_plugin: unset plugin option
*/
@@ -7066,6 +7101,7 @@ PyMethodDef weechat_python_funcs[] =
{ "config_get_plugin", &weechat_python_api_config_get_plugin, METH_VARARGS, "" },
{ "config_is_set_plugin", &weechat_python_api_config_is_set_plugin, METH_VARARGS, "" },
{ "config_set_plugin", &weechat_python_api_config_set_plugin, METH_VARARGS, "" },
+ { "config_set_desc_plugin", &weechat_python_api_config_set_desc_plugin, METH_VARARGS, "" },
{ "config_unset_plugin", &weechat_python_api_config_unset_plugin, METH_VARARGS, "" },
{ "prefix", &weechat_python_api_prefix, METH_VARARGS, "" },
{ "color", &weechat_python_api_color, METH_VARARGS, "" },
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index cfa82cf88..a9df9537a 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -2993,6 +2993,45 @@ weechat_ruby_api_config_set_plugin (VALUE class, VALUE option, VALUE value)
}
/*
+ * weechat_ruby_api_config_set_desc_plugin: set description of a plugin option
+ */
+
+static VALUE
+weechat_ruby_api_config_set_desc_plugin (VALUE class, VALUE option,
+ VALUE description)
+{
+ char *c_option, *c_description;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script || !ruby_current_script->name)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ RUBY_RETURN_ERROR;
+ }
+
+ if (NIL_P (option) || NIL_P (description))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ RUBY_RETURN_ERROR;
+ }
+
+ Check_Type (option, T_STRING);
+ Check_Type (description, T_STRING);
+
+ c_option = StringValuePtr (option);
+ c_description = StringValuePtr (description);
+
+ script_api_config_set_desc_plugin (weechat_ruby_plugin,
+ ruby_current_script,
+ c_option,
+ c_description);
+
+ RUBY_RETURN_OK;
+}
+
+/*
* weechat_ruby_api_config_unset_plugin: unset plugin option
*/
@@ -7737,6 +7776,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "config_get_plugin", &weechat_ruby_api_config_get_plugin, 1);
rb_define_module_function (ruby_mWeechat, "config_is_set_plugin", &weechat_ruby_api_config_is_set_plugin, 1);
rb_define_module_function (ruby_mWeechat, "config_set_plugin", &weechat_ruby_api_config_set_plugin, 2);
+ rb_define_module_function (ruby_mWeechat, "config_set_desc_plugin", &weechat_ruby_api_config_set_desc_plugin, 2);
rb_define_module_function (ruby_mWeechat, "config_unset_plugin", &weechat_ruby_api_config_unset_plugin, 1);
rb_define_module_function (ruby_mWeechat, "prefix", &weechat_ruby_api_prefix, 1);
rb_define_module_function (ruby_mWeechat, "color", &weechat_ruby_api_color, 1);
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index 4fb0cd09b..3aefdd446 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -1681,6 +1681,31 @@ script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
}
/*
+ * script_api_config_set_plugin: set value of a script config option
+ * format in file is "plugin.script.option"
+ */
+
+void
+script_api_config_set_desc_plugin (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script,
+ const char *option, const char *description)
+{
+ char *option_fullname;
+
+ option_fullname = malloc ((strlen (script->name) +
+ strlen (option) + 2));
+ if (!option_fullname)
+ return;
+
+ strcpy (option_fullname, script->name);
+ strcat (option_fullname, ".");
+ strcat (option_fullname, option);
+
+ weechat_config_set_desc_plugin (option_fullname, description);
+ free (option_fullname);
+}
+
+/*
* script_api_config_unset_plugin: unset script config option
* format in file is "plugin.script.option"
*/
diff --git a/src/plugins/scripts/script-api.h b/src/plugins/scripts/script-api.h
index 73f419b34..a9bc5fe32 100644
--- a/src/plugins/scripts/script-api.h
+++ b/src/plugins/scripts/script-api.h
@@ -317,6 +317,10 @@ extern int script_api_config_is_set_plugin (struct t_weechat_plugin *weechat_plu
extern int script_api_config_set_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option, const char *value);
+extern void script_api_config_set_desc_plugin (struct t_weechat_plugin *weechat_plugin,
+ struct t_plugin_script *script,
+ const char *option,
+ const char *description);
extern int script_api_config_unset_plugin (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *option);
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index b36d72ad3..03e84c30f 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -2985,6 +2985,44 @@ weechat_tcl_api_config_set_plugin (ClientData clientData, Tcl_Interp *interp,
}
/*
+ * weechat_tcl_api_config_set_desc_plugin: set description of a plugin option
+ */
+
+static int
+weechat_tcl_api_config_set_desc_plugin (ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[])
+{
+ Tcl_Obj *objp;
+ char *option, *description;
+ int i;
+
+ /* make C compiler happy */
+ (void) clientData;
+
+ if (!tcl_current_script || !tcl_current_script->name)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ TCL_RETURN_ERROR;
+ }
+
+ if (objc < 3)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "config_set_desc_plugin");
+ TCL_RETURN_ERROR;
+ }
+
+ option = Tcl_GetStringFromObj (objv[1], &i);
+ description = Tcl_GetStringFromObj (objv[2], &i);
+
+ script_api_config_set_desc_plugin (weechat_tcl_plugin,
+ tcl_current_script,
+ option,
+ description);
+
+ TCL_RETURN_OK;
+}
+
+/*
* weechat_tcl_api_config_set_plugin: unset plugin option
*/
@@ -7639,6 +7677,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
weechat_tcl_api_config_is_set_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::config_set_plugin",
weechat_tcl_api_config_set_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateObjCommand (interp, "weechat::config_set_desc_plugin",
+ weechat_tcl_api_config_set_desc_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::config_unset_plugin",
weechat_tcl_api_config_unset_plugin, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::prefix",