diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/plugin.c | 1 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua-api.c | 37 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl-api.c | 29 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python-api.c | 38 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby-api.c | 34 | ||||
-rw-r--r-- | src/plugins/scripts/tcl/weechat-tcl-api.c | 36 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 5 |
7 files changed, 176 insertions, 4 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 06428efad..623e802cc 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -527,6 +527,7 @@ plugin_load (const char *filename) new_plugin->window_get_integer = &gui_window_get_integer; new_plugin->window_get_string = &gui_window_get_string; new_plugin->window_get_pointer = &gui_window_get_pointer; + new_plugin->window_set_title = &gui_window_set_title; new_plugin->nicklist_add_group = &gui_nicklist_add_group; new_plugin->nicklist_search_group = &gui_nicklist_search_group; diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c index 854fc16a8..a19eb6b34 100644 --- a/src/plugins/scripts/lua/weechat-lua-api.c +++ b/src/plugins/scripts/lua/weechat-lua-api.c @@ -5003,6 +5003,42 @@ weechat_lua_api_window_get_pointer (lua_State *L) } /* + * weechat_lua_api_window_set_title: set window title + */ + +static int +weechat_lua_api_window_set_title (lua_State *L) +{ + const char *title; + int n; + + /* make C compiler happy */ + (void) L; + + if (!lua_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_set_title"); + LUA_RETURN_ERROR; + } + + title = NULL; + + n = lua_gettop (lua_current_interpreter); + + if (n < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "window_set_title"); + LUA_RETURN_ERROR; + } + + title = lua_tostring (lua_current_interpreter, -1); + + weechat_window_set_title (title); + + LUA_RETURN_OK; +} + +/* * weechat_lua_api_nicklist_add_group: add a group in nicklist */ @@ -7050,6 +7086,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = { { "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 }, + { "window_set_title", &weechat_lua_api_window_set_title }, { "nicklist_add_group", &weechat_lua_api_nicklist_add_group }, { "nicklist_search_group", &weechat_lua_api_nicklist_search_group }, { "nicklist_add_nick", &weechat_lua_api_nicklist_add_nick }, diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c index 0b99bc2cf..419f8b45b 100644 --- a/src/plugins/scripts/perl/weechat-perl-api.c +++ b/src/plugins/scripts/perl/weechat-perl-api.c @@ -4268,6 +4268,34 @@ static XS (XS_weechat_api_window_get_pointer) } /* + * weechat::window_set_title: set window title + */ + +static XS (XS_weechat_api_window_set_title) +{ + dXSARGS; + + /* make C compiler happy */ + (void) cv; + + if (!perl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_set_title"); + PERL_RETURN_ERROR; + } + + if (items < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "window_set_title"); + PERL_RETURN_ERROR; + } + + weechat_window_set_title (SvPV (ST (0), PL_na)); /* title */ + + PERL_RETURN_OK; +} + +/* * weechat::nicklist_add_group: add a group in nicklist */ @@ -5657,6 +5685,7 @@ weechat_perl_api_init (pTHX) 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"); + newXS ("weechat::window_set_title", XS_weechat_api_window_set_title, "weechat"); newXS ("weechat::nicklist_add_group", XS_weechat_api_nicklist_add_group, "weechat"); newXS ("weechat::nicklist_search_group", XS_weechat_api_nicklist_search_group, "weechat"); newXS ("weechat::nicklist_add_nick", XS_weechat_api_nicklist_add_nick, "weechat"); diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c index 45282370f..6cf94d2e3 100644 --- a/src/plugins/scripts/python/weechat-python-api.c +++ b/src/plugins/scripts/python/weechat-python-api.c @@ -4298,7 +4298,7 @@ weechat_python_api_buffer_get_pointer (PyObject *self, PyObject *args) if (!python_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_pointer"); - PYTHON_RETURN_ERROR; + PYTHON_RETURN_EMPTY; } buffer = NULL; @@ -4425,7 +4425,7 @@ weechat_python_api_window_get_string (PyObject *self, PyObject *args) if (!python_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_string"); - PYTHON_RETURN_ERROR; + PYTHON_RETURN_EMPTY; } window = NULL; @@ -4458,7 +4458,7 @@ weechat_python_api_window_get_pointer (PyObject *self, PyObject *args) if (!python_current_script) { WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_pointer"); - PYTHON_RETURN_ERROR; + PYTHON_RETURN_EMPTY; } window = NULL; @@ -4477,6 +4477,37 @@ weechat_python_api_window_get_pointer (PyObject *self, PyObject *args) } /* + * weechat_python_api_window_set_title: set window title + */ + +static PyObject * +weechat_python_api_window_set_title (PyObject *self, PyObject *args) +{ + char *title; + + /* make C compiler happy */ + (void) self; + + if (!python_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title"); + PYTHON_RETURN_ERROR; + } + + title = NULL; + + if (!PyArg_ParseTuple (args, "s", &title)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title"); + PYTHON_RETURN_ERROR; + } + + weechat_window_set_title (title); + + PYTHON_RETURN_OK; +} + +/* * weechat_python_api_nicklist_add_group: add a group in nicklist */ @@ -5932,6 +5963,7 @@ PyMethodDef weechat_python_funcs[] = { "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, "" }, + { "window_set_title", &weechat_python_api_window_set_title, METH_VARARGS, "" }, { "nicklist_add_group", &weechat_python_api_nicklist_add_group, METH_VARARGS, "" }, { "nicklist_search_group", &weechat_python_api_nicklist_search_group, METH_VARARGS, "" }, { "nicklist_add_nick", &weechat_python_api_nicklist_add_nick, METH_VARARGS, "" }, diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c index 103d80ed3..082b918bb 100644 --- a/src/plugins/scripts/ruby/weechat-ruby-api.c +++ b/src/plugins/scripts/ruby/weechat-ruby-api.c @@ -5146,6 +5146,39 @@ weechat_ruby_api_window_get_pointer (VALUE class, VALUE window, VALUE property) } /* + * weechat_ruby_api_window_set_title: set window title + */ + +static VALUE +weechat_ruby_api_window_set_title (VALUE class, VALUE title) +{ + char *c_title; + + /* make C compiler happy */ + (void) class; + + if (!ruby_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "window_set_title"); + RUBY_RETURN_ERROR; + } + + if (NIL_P (title)) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "window_set_title"); + RUBY_RETURN_ERROR; + } + + Check_Type (title, T_STRING); + + c_title = STR2CSTR (title); + + weechat_window_set_title (c_title); + + RUBY_RETURN_OK; +} + +/* * weechat_ruby_api_nicklist_add_group: add a group in nicklist */ @@ -6843,6 +6876,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat) 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); + rb_define_module_function (ruby_mWeechat, "window_set_title", &weechat_ruby_api_window_set_title, 1); rb_define_module_function (ruby_mWeechat, "nicklist_add_group", &weechat_ruby_api_nicklist_add_group, 5); rb_define_module_function (ruby_mWeechat, "nicklist_search_group", &weechat_ruby_api_nicklist_search_group, 3); rb_define_module_function (ruby_mWeechat, "nicklist_add_nick", &weechat_ruby_api_nicklist_add_nick, 7); diff --git a/src/plugins/scripts/tcl/weechat-tcl-api.c b/src/plugins/scripts/tcl/weechat-tcl-api.c index 92f247abc..9fc2e964b 100644 --- a/src/plugins/scripts/tcl/weechat-tcl-api.c +++ b/src/plugins/scripts/tcl/weechat-tcl-api.c @@ -4774,6 +4774,40 @@ weechat_tcl_api_window_get_pointer (ClientData clientData, Tcl_Interp *interp, } /* + * weechat_tcl_api_window_set_title: set window title + */ + +static int +weechat_tcl_api_window_set_title (ClientData clientData, Tcl_Interp *interp, + int objc, Tcl_Obj *CONST objv[]) +{ + Tcl_Obj *objp; + char *title; + int i; + + /* make C compiler happy */ + (void) clientData; + + if (!tcl_current_script) + { + WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "window_set_title"); + TCL_RETURN_ERROR; + } + + if (objc < 1) + { + WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_set_title"); + TCL_RETURN_ERROR; + } + + title = Tcl_GetStringFromObj (objv[1], &i); + + weechat_window_set_title (title); + + TCL_RETURN_OK; +} + +/* * weechat_tcl_api_nicklist_add_group: add a group in nicklist */ @@ -6478,6 +6512,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp) weechat_tcl_api_window_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::window_get_pointer", weechat_tcl_api_window_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); + Tcl_CreateObjCommand (interp, "weechat::window_set_title", + weechat_tcl_api_window_set_title, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::nicklist_add_group", weechat_tcl_api_nicklist_add_group, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL); Tcl_CreateObjCommand (interp, "weechat::nicklist_search_group", diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 9af6bbe16..110d2fc8d 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -33,7 +33,7 @@ struct t_infolist; struct t_weelist; /* API version (used to check that plugin has same API and can be loaded) */ -#define WEECHAT_PLUGIN_API_VERSION "20090502-01" +#define WEECHAT_PLUGIN_API_VERSION "20090510-01" /* macros for defining plugin infos */ #define WEECHAT_PLUGIN_NAME(__name) \ @@ -506,6 +506,7 @@ struct t_weechat_plugin const char *property); void *(*window_get_pointer) (struct t_gui_window *window, const char *property); + void (*window_set_title) (const char *title); /* nicklist */ struct t_gui_nick_group *(*nicklist_add_group) (struct t_gui_buffer *buffer, @@ -1046,6 +1047,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin); weechat_plugin->window_get_pointer(__window, __property) #define weechat_current_window() \ weechat_plugin->window_get_pointer(NULL, "current") +#define weechat_window_set_title(__title) \ + weechat_plugin->window_set_title(__title) /* nicklist */ #define weechat_nicklist_add_group(__buffer, __parent_group, __name, \ |