summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-12-18 18:09:12 +0100
committerSebastien Helleu <flashcode@flashtux.org>2009-12-18 18:09:12 +0100
commit58df8c2d83ce3ea4b22b48d3a801170066bb801f (patch)
tree35a85129cec206d5f15bdd514b36edc7aed58fd7
parent846fb5d28342f338a9586089b3d6609a5d791549 (diff)
downloadweechat-58df8c2d83ce3ea4b22b48d3a801170066bb801f.zip
Add function "infolist_new_item" in script API
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c38
-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.c35
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c34
-rw-r--r--src/plugins/weechat-plugin.h2
6 files changed, 173 insertions, 1 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index f97eeb968..0ca3c8796 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -6013,6 +6013,43 @@ weechat_lua_api_infolist_new (lua_State *L)
}
/*
+ * weechat_lua_api_infolist_new_item: create new item in infolist
+ */
+
+static int
+weechat_lua_api_infolist_new_item (lua_State *L)
+{
+ const char *infolist;
+ char *result;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ LUA_RETURN_EMPTY;
+ }
+
+ infolist = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ LUA_RETURN_EMPTY;
+ }
+
+ infolist = lua_tostring (lua_current_interpreter, -1);
+
+ result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
+
+ LUA_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat_lua_api_infolist_new_var_integer: create new integer variable in
* infolist
*/
@@ -7254,6 +7291,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "command", &weechat_lua_api_command },
{ "info_get", &weechat_lua_api_info_get },
{ "infolist_new", &weechat_lua_api_infolist_new },
+ { "infolist_new_item", &weechat_lua_api_infolist_new_item },
{ "infolist_new_var_integer", &weechat_lua_api_infolist_new_var_integer },
{ "infolist_new_var_string", &weechat_lua_api_infolist_new_var_string },
{ "infolist_new_var_pointer", &weechat_lua_api_infolist_new_var_pointer },
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 1538e7177..a6032b356 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -5093,6 +5093,37 @@ XS (XS_weechat_api_infolist_new)
}
/*
+ * weechat::infolist_new_item: create new item in infolist
+ */
+
+XS (XS_weechat_api_infolist_new_item)
+{
+ char *infolist, *result;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ PERL_RETURN_EMPTY;
+ }
+
+ if (items < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ PERL_RETURN_EMPTY;
+ }
+
+ infolist = SvPV (ST (0), PL_na);
+
+ result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
+
+ PERL_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat::infolist_new_var_integer: create new integer variable in infolist
*/
@@ -5830,6 +5861,7 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::command", XS_weechat_api_command, "weechat");
newXS ("weechat::info_get", XS_weechat_api_info_get, "weechat");
newXS ("weechat::infolist_new", XS_weechat_api_infolist_new, "weechat");
+ newXS ("weechat::infolist_new_item", XS_weechat_api_infolist_new_item, "weechat");
newXS ("weechat::infolist_new_var_integer", XS_weechat_api_infolist_new_var_integer, "weechat");
newXS ("weechat::infolist_new_var_string", XS_weechat_api_infolist_new_var_string, "weechat");
newXS ("weechat::infolist_new_var_pointer", XS_weechat_api_infolist_new_var_pointer, "weechat");
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index c13e9cb18..35782cd63 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -5353,6 +5353,38 @@ weechat_python_api_infolist_new (PyObject *self, PyObject *args)
}
/*
+ * weechat_python_api_infolist_new_item: create new item in infolist
+ */
+
+static PyObject *
+weechat_python_api_infolist_new_item (PyObject *self, PyObject *args)
+{
+ char *infolist, *result;
+ PyObject *object;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ infolist = NULL;
+
+ if (!PyArg_ParseTuple (args, "s", &infolist))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (infolist)));
+
+ PYTHON_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat_python_api_infolist_new_var_integer: create new integer variable in
* infolist
*/
@@ -6118,6 +6150,7 @@ PyMethodDef weechat_python_funcs[] =
{ "command", &weechat_python_api_command, METH_VARARGS, "" },
{ "info_get", &weechat_python_api_info_get, METH_VARARGS, "" },
{ "infolist_new", &weechat_python_api_infolist_new, METH_VARARGS, "" },
+ { "infolist_new_item", &weechat_python_api_infolist_new_item, METH_VARARGS, "" },
{ "infolist_new_var_integer", &weechat_python_api_infolist_new_var_integer, METH_VARARGS, "" },
{ "infolist_new_var_string", &weechat_python_api_infolist_new_var_string, METH_VARARGS, "" },
{ "infolist_new_var_pointer", &weechat_python_api_infolist_new_var_pointer, METH_VARARGS, "" },
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 930489cc8..46b608d86 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -6170,6 +6170,40 @@ weechat_ruby_api_infolist_new (VALUE class)
}
/*
+ * weechat_ruby_api_infolist_new_item: create new item in infolist
+ */
+
+static VALUE
+weechat_ruby_api_infolist_new_item (VALUE class, VALUE infolist)
+{
+ char *c_infolist, *result;
+ VALUE return_value;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ RUBY_RETURN_EMPTY;
+ }
+
+ if (NIL_P (infolist))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ RUBY_RETURN_EMPTY;
+ }
+
+ Check_Type (infolist, T_STRING);
+
+ c_infolist = STR2CSTR (infolist);
+
+ result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (c_infolist)));
+
+ RUBY_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat_ruby_api_infolist_new_var_integer: create new integer variable in
* infolist
*/
@@ -7044,6 +7078,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "command", &weechat_ruby_api_command, 2);
rb_define_module_function (ruby_mWeechat, "info_get", &weechat_ruby_api_info_get, 2);
rb_define_module_function (ruby_mWeechat, "infolist_new", &weechat_ruby_api_infolist_new, 0);
+ rb_define_module_function (ruby_mWeechat, "infolist_new_item", &weechat_ruby_api_infolist_new_item, 1);
rb_define_module_function (ruby_mWeechat, "infolist_new_var_integer", &weechat_ruby_api_infolist_new_var_integer, 3);
rb_define_module_function (ruby_mWeechat, "infolist_new_var_string", &weechat_ruby_api_infolist_new_var_string, 3);
rb_define_module_function (ruby_mWeechat, "infolist_new_var_pointer", &weechat_ruby_api_infolist_new_var_pointer, 3);
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 63701f3e1..b4dcb56d1 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -5689,6 +5689,38 @@ weechat_tcl_api_infolist_new (ClientData clientData, Tcl_Interp *interp,
}
/*
+ * weechat_tcl_api_infolist_new_item: create new item in infolist
+ */
+
+static int
+weechat_tcl_api_infolist_new_item (ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[])
+{
+ Tcl_Obj *objp;
+ char *result;
+ int i;
+
+ /* make C compiler happy */
+ (void) clientData;
+
+ if (!tcl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ TCL_RETURN_INT(0);
+ }
+
+ if (objc < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "infolist_new_item");
+ TCL_RETURN_INT(0);
+ }
+
+ result = script_ptr2str (weechat_infolist_new_item (script_str2ptr (Tcl_GetStringFromObj (objv[1], &i)))); /* infolist */
+
+ TCL_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat_tcl_api_infolist_new_var_integer: create new integer variable in
* infolist
*/
@@ -6699,6 +6731,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
weechat_tcl_api_info_get, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::infolist_new",
weechat_tcl_api_infolist_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateObjCommand (interp, "weechat::infolist_new_item",
+ weechat_tcl_api_infolist_new_item, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::infolist_new_var_integer",
weechat_tcl_api_infolist_new_var_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::infolist_new_var_string",
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index b4b4a7a4d..2b8b2594d 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -34,7 +34,7 @@ struct t_weelist;
struct timeval;
/* API version (used to check that plugin has same API and can be loaded) */
-#define WEECHAT_PLUGIN_API_VERSION "20091204-01"
+#define WEECHAT_PLUGIN_API_VERSION "20091218-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \