diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-11 13:36:31 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-11-11 13:36:31 +0100 |
commit | 1214f10526277d856816ce4fbb5a6caf7c4e2749 (patch) | |
tree | da9e2eee98bef0ee7c92bcb4d2f0c4e3d5426d55 /src/plugins/scripts/tcl/weechat-tcl-api.c | |
parent | 60f7b939bec9e07b1fd1d07afe6160aa7afa51e0 (diff) | |
download | weechat-1214f10526277d856816ce4fbb5a6caf7c4e2749.zip |
Add function "current_buffer" in script API
Diffstat (limited to 'src/plugins/scripts/tcl/weechat-tcl-api.c')
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 7c0f4da6c..e12dc4e44 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -3580,6 +3580,33 @@ weechat_tcl_api_buffer_search (ClientData clientData, Tcl_Interp *interp, } /* + * weechat_tcl_api_current_buffer: get current buffer + */ + +static int +weechat_tcl_api_current_buffer (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_buffer"); + TCL_RETURN_EMPTY; + } + + result = script_ptr2str (weechat_current_buffer); + + TCL_RETURN_STRING_FREE(result); +} + +/* * weechat_tcl_api_buffer_clear: clear a buffer */ @@ -5230,6 +5257,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) { weechat_tcl_api_buffer_new, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::buffer_search", weechat_tcl_api_buffer_search, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp,"weechat::current_buffer", + weechat_tcl_api_current_buffer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::buffer_clear", weechat_tcl_api_buffer_clear, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp,"weechat::buffer_close", |