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.c26
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c27
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c28
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c27
-rw-r--r--src/plugins/scripts/tcl/weechat-tcl-api.c31
5 files changed, 134 insertions, 5 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 338f721d5..51ebcd0c6 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -3748,7 +3748,7 @@ weechat_lua_api_current_buffer (lua_State *L)
LUA_RETURN_EMPTY;
}
- result = script_ptr2str (weechat_current_buffer);
+ result = script_ptr2str (weechat_current_buffer ());
LUA_RETURN_STRING_FREE(result);
}
@@ -3985,6 +3985,29 @@ weechat_lua_api_buffer_set (lua_State *L)
}
/*
+ * weechat_lua_api_current_window: get current window
+ */
+
+static int
+weechat_lua_api_current_window (lua_State *L)
+{
+ char *result;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("current_window");
+ LUA_RETURN_EMPTY;
+ }
+
+ result = script_ptr2str (weechat_current_window ());
+
+ LUA_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat_lua_api_window_get_integer: get a window property as integer
*/
@@ -5893,6 +5916,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "buffer_get_string", &weechat_lua_api_buffer_get_string },
{ "buffer_get_pointer", &weechat_lua_api_buffer_get_pointer },
{ "buffer_set", &weechat_lua_api_buffer_set },
+ { "current_window", &weechat_lua_api_current_window },
{ "window_get_integer", &weechat_lua_api_window_get_integer },
{ "window_get_string", &weechat_lua_api_window_get_string },
{ "window_get_pointer", &weechat_lua_api_window_get_pointer },
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index 0c01452b1..f25824e3c 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -3173,7 +3173,7 @@ static XS (XS_weechat_api_current_buffer)
PERL_RETURN_EMPTY;
}
- result = script_ptr2str (weechat_current_buffer);
+ result = script_ptr2str (weechat_current_buffer ());
PERL_RETURN_STRING_FREE(result);
}
@@ -3365,6 +3365,30 @@ static XS (XS_weechat_api_buffer_set)
}
/*
+ * weechat::current_window: get current window
+ */
+
+static XS (XS_weechat_api_current_window)
+{
+ char *result;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) items;
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("current_window");
+ PERL_RETURN_EMPTY;
+ }
+
+ result = script_ptr2str (weechat_current_window ());
+
+ PERL_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat::window_get_integer: get a window property as integer
*/
@@ -4633,6 +4657,7 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::buffer_get_string", XS_weechat_api_buffer_get_string, "weechat");
newXS ("weechat::buffer_get_pointer", XS_weechat_api_buffer_get_pointer, "weechat");
newXS ("weechat::buffer_set", XS_weechat_api_buffer_set, "weechat");
+ newXS ("weechat::current_window", XS_weechat_api_current_window, "weechat");
newXS ("weechat::window_get_integer", XS_weechat_api_window_get_integer, "weechat");
newXS ("weechat::window_get_string", XS_weechat_api_window_get_string, "weechat");
newXS ("weechat::window_get_pointer", XS_weechat_api_window_get_pointer, "weechat");
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index e299255bc..d4d5da1aa 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -3365,7 +3365,7 @@ weechat_python_api_current_buffer (PyObject *self, PyObject *args)
PYTHON_RETURN_EMPTY;
}
- result = script_ptr2str (weechat_current_buffer);
+ result = script_ptr2str (weechat_current_buffer ());
PYTHON_RETURN_STRING_FREE(result);
}
@@ -3570,6 +3570,31 @@ weechat_python_api_buffer_set (PyObject *self, PyObject *args)
}
/*
+ * weechat_python_api_current_window: get current window
+ */
+
+static PyObject *
+weechat_python_api_current_window (PyObject *self, PyObject *args)
+{
+ char *result;
+ PyObject *object;
+
+ /* make C compiler happy */
+ (void) self;
+ (void) args;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("current_window");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ result = script_ptr2str (weechat_current_window ());
+
+ PYTHON_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat_python_api_window_get_integer get a window property as integer
*/
@@ -4922,6 +4947,7 @@ PyMethodDef weechat_python_funcs[] =
{ "buffer_get_string", &weechat_python_api_buffer_get_string, METH_VARARGS, "" },
{ "buffer_get_pointer", &weechat_python_api_buffer_get_pointer, METH_VARARGS, "" },
{ "buffer_set", &weechat_python_api_buffer_set, METH_VARARGS, "" },
+ { "current_window", &weechat_python_api_current_window, METH_VARARGS, "" },
{ "window_get_integer", &weechat_python_api_window_get_integer, METH_VARARGS, "" },
{ "window_get_string", &weechat_python_api_window_get_string, METH_VARARGS, "" },
{ "window_get_pointer", &weechat_python_api_window_get_pointer, METH_VARARGS, "" },
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 2d80aac8a..fd09a9e7f 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -3850,7 +3850,7 @@ weechat_ruby_api_current_buffer (VALUE class)
RUBY_RETURN_EMPTY;
}
- result = script_ptr2str (weechat_current_buffer);
+ result = script_ptr2str (weechat_current_buffer ());
RUBY_RETURN_STRING_FREE(result);
}
@@ -4079,6 +4079,30 @@ weechat_ruby_api_buffer_set (VALUE class, VALUE buffer, VALUE property,
}
/*
+ * weechat_ruby_api_current_window: get current window
+ */
+
+static VALUE
+weechat_ruby_api_current_window (VALUE class)
+{
+ char *result;
+ VALUE return_value;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("current_window");
+ RUBY_RETURN_EMPTY;
+ }
+
+ result = script_ptr2str (weechat_current_window ());
+
+ RUBY_RETURN_STRING_FREE(result);
+}
+
+/*
* weechat_ruby_api_window_get_integer: get a window property as integer
*/
@@ -5653,6 +5677,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "buffer_get_string", &weechat_ruby_api_buffer_get_string, 2);
rb_define_module_function (ruby_mWeechat, "buffer_get_pointer", &weechat_ruby_api_buffer_get_pointer, 2);
rb_define_module_function (ruby_mWeechat, "buffer_set", &weechat_ruby_api_buffer_set, 3);
+ rb_define_module_function (ruby_mWeechat, "current_window", &weechat_ruby_api_current_window, 0);
rb_define_module_function (ruby_mWeechat, "window_get_integer", &weechat_ruby_api_window_get_integer, 2);
rb_define_module_function (ruby_mWeechat, "window_get_string", &weechat_ruby_api_window_get_string, 2);
rb_define_module_function (ruby_mWeechat, "window_get_pointer", &weechat_ruby_api_window_get_pointer, 2);
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",