summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/tcl/weechat-tcl-api.c
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 /src/plugins/scripts/tcl/weechat-tcl-api.c
parent846fb5d28342f338a9586089b3d6609a5d791549 (diff)
downloadweechat-58df8c2d83ce3ea4b22b48d3a801170066bb801f.zip
Add function "infolist_new_item" in script API
Diffstat (limited to 'src/plugins/scripts/tcl/weechat-tcl-api.c')
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c34
1 files changed, 34 insertions, 0 deletions
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",