summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/tcl
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2008-11-29 16:08:55 +0100
committerSebastien Helleu <flashcode@flashtux.org>2008-11-29 16:08:55 +0100
commitbc00946a0da47dbc16cefbb915ae7f94b0ac3abf (patch)
tree011ad7fad54e5997a8c749ccc57ae214c8bfa28d /src/plugins/scripts/tcl
parent364aa00ab775f0dfdfad897f68bdbce2cfd71088 (diff)
downloadweechat-bc00946a0da47dbc16cefbb915ae7f94b0ac3abf.zip
Add current_window function in plugin API, add window functions in english developer guide
Diffstat (limited to 'src/plugins/scripts/tcl')
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c
index 59b9448c5..090f999dc 100644
--- a/src/plugins/scripts/tcl/weechat-tcl-api.c
+++ b/src/plugins/scripts/tcl/weechat-tcl-api.c
@@ -3605,7 +3605,7 @@ weechat_tcl_api_current_buffer (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_EMPTY;
}
- result = script_ptr2str (weechat_current_buffer);
+ result = script_ptr2str (weechat_current_buffer ());
TCL_RETURN_STRING_FREE(result);
}
@@ -3819,6 +3819,33 @@ weechat_tcl_api_buffer_set (ClientData clientData, Tcl_Interp *interp,
}
/*
+ * weechat_tcl_api_current_window: get current window
+ */
+
+static int
+weechat_tcl_api_current_window (ClientData clientData, Tcl_Interp *interp,
+ int objc, Tcl_Obj *CONST objv[])
+{
+ Tcl_Obj *objp;
+ char *result;
+
+ /* make C compiler happy */
+ (void) clientData;
+ (void) objc;
+ (void) objv;
+
+ if (!tcl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("current_window");
+ TCL_RETURN_EMPTY;
+ }
+
+ result = script_ptr2str (weechat_current_window ());
+
+ TCL_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat_tcl_api_window_get_integer: get a window property as integer
*/
@@ -5378,6 +5405,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) {
weechat_tcl_api_buffer_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::buffer_set",
weechat_tcl_api_buffer_set, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
+ Tcl_CreateObjCommand (interp,"weechat::current_window",
+ weechat_tcl_api_current_window, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::window_get_integer",
weechat_tcl_api_window_get_integer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp,"weechat::window_get_string",