mirror of
https://github.com/weechat/weechat.git
synced 2026-06-30 14:56:39 +02:00
New features and bug fixes with bars
This commit is contained in:
@@ -3792,6 +3792,47 @@ weechat_lua_api_bar_new (lua_State *L)
|
||||
LUA_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_bar_set: set a bar property
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_bar_set (lua_State *L)
|
||||
{
|
||||
const char *bar, *property, *value;
|
||||
int n;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("bar_set");
|
||||
LUA_RETURN_ERROR;
|
||||
}
|
||||
|
||||
bar = NULL;
|
||||
property = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 3)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_set");
|
||||
LUA_RETURN_ERROR;
|
||||
}
|
||||
|
||||
bar = lua_tostring (lua_current_interpreter, -3);
|
||||
property = lua_tostring (lua_current_interpreter, -2);
|
||||
value = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
weechat_buffer_set (script_str2ptr ((char *)bar),
|
||||
(char *)property,
|
||||
(char *)value);
|
||||
|
||||
LUA_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_bar_update: update a bar on screen
|
||||
*/
|
||||
@@ -4494,6 +4535,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
|
||||
{ "bar_item_remove", &weechat_lua_api_bar_item_remove },
|
||||
{ "bar_search", &weechat_lua_api_bar_search },
|
||||
{ "bar_new", &weechat_lua_api_bar_new },
|
||||
{ "bar_set", &weechat_lua_api_bar_set },
|
||||
{ "bar_update", &weechat_lua_api_bar_update },
|
||||
{ "bar_remove", &weechat_lua_api_bar_remove },
|
||||
{ "command", &weechat_lua_api_command },
|
||||
|
||||
@@ -3138,6 +3138,38 @@ static XS (XS_weechat_bar_new)
|
||||
PERL_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::bar_set: set a bar property
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_bar_set)
|
||||
{
|
||||
char *bar, *property, *value;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("bar_set");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (items < 3)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_set");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
bar = SvPV (ST (0), PL_na);
|
||||
property = SvPV (ST (1), PL_na);
|
||||
value = SvPV (ST (2), PL_na);
|
||||
weechat_bar_set (script_str2ptr (bar), property, value);
|
||||
|
||||
PERL_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::bar_update: update a bar on screen
|
||||
*/
|
||||
@@ -3621,6 +3653,7 @@ weechat_perl_api_init (pTHX)
|
||||
newXS ("weechat::bar_item_remove", XS_weechat_bar_item_remove, "weechat");
|
||||
newXS ("weechat::bar_search", XS_weechat_bar_search, "weechat");
|
||||
newXS ("weechat::bar_new", XS_weechat_bar_new, "weechat");
|
||||
newXS ("weechat::bar_set", XS_weechat_bar_set, "weechat");
|
||||
newXS ("weechat::bar_update", XS_weechat_bar_update, "weechat");
|
||||
newXS ("weechat::bar_remove", XS_weechat_bar_remove, "weechat");
|
||||
newXS ("weechat::command", XS_weechat_command, "weechat");
|
||||
|
||||
@@ -3342,6 +3342,41 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
|
||||
PYTHON_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_bar_set: set a bar property
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_bar_set (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *bar, *property, *value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("bar_set");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
bar = NULL;
|
||||
property = NULL;
|
||||
value = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "sss", &bar, &property, &value))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_set");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
weechat_buffer_set (script_str2ptr (bar),
|
||||
property,
|
||||
value);
|
||||
|
||||
PYTHON_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_bar_update: update a bar on screen
|
||||
*/
|
||||
@@ -3850,6 +3885,7 @@ PyMethodDef weechat_python_funcs[] =
|
||||
{ "bar_item_remove", &weechat_python_api_bar_item_remove, METH_VARARGS, "" },
|
||||
{ "bar_search", &weechat_python_api_bar_search, METH_VARARGS, "" },
|
||||
{ "bar_new", &weechat_python_api_bar_new, METH_VARARGS, "" },
|
||||
{ "bar_set", &weechat_python_api_bar_set, METH_VARARGS, "" },
|
||||
{ "bar_update", &weechat_python_api_bar_update, METH_VARARGS, "" },
|
||||
{ "bar_remove", &weechat_python_api_bar_remove, METH_VARARGS, "" },
|
||||
{ "command", &weechat_python_api_command, METH_VARARGS, "" },
|
||||
|
||||
@@ -3855,6 +3855,45 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE position,
|
||||
RUBY_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_bar_set: set a bar property
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_bar_set (VALUE class, VALUE bar, VALUE property, VALUE value)
|
||||
{
|
||||
char *c_bar, *c_property, *c_value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("bar_set");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (NIL_P (bar) || NIL_P (property) || NIL_P (value))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_set");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
Check_Type (bar, T_STRING);
|
||||
Check_Type (property, T_STRING);
|
||||
Check_Type (value, T_STRING);
|
||||
|
||||
c_bar = STR2CSTR (bar);
|
||||
c_property = STR2CSTR (property);
|
||||
c_value = STR2CSTR (value);
|
||||
|
||||
weechat_buffer_set (script_str2ptr (c_bar),
|
||||
c_property,
|
||||
c_value);
|
||||
|
||||
RUBY_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_bar_update: update a bar on screen
|
||||
*/
|
||||
@@ -4403,6 +4442,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
rb_define_module_function (ruby_mWeechat, "bar_item_remove", &weechat_ruby_api_bar_item_remove, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "bar_search", &weechat_ruby_api_bar_search, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "bar_new", &weechat_ruby_api_bar_new, 6);
|
||||
rb_define_module_function (ruby_mWeechat, "bar_set", &weechat_ruby_api_bar_set, 3);
|
||||
rb_define_module_function (ruby_mWeechat, "bar_update", &weechat_ruby_api_bar_update, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "bar_remove", &weechat_ruby_api_bar_remove, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "command", &weechat_ruby_api_command, 2);
|
||||
|
||||
Reference in New Issue
Block a user