mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 05:46:38 +02:00
Added filling/color_fg/color_bg options for bars, added config_get/config_get_plugin/config_set_plugin in script API
This commit is contained in:
@@ -1851,6 +1851,124 @@ weechat_lua_api_config_free (lua_State *L)
|
||||
LUA_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_config_get: get config option
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_config_get (lua_State *L)
|
||||
{
|
||||
const char *option;
|
||||
char *result;
|
||||
int n;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get");
|
||||
LUA_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
option = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 1)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get");
|
||||
LUA_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
option = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
result = script_ptr2str (weechat_config_get ((char *)option));
|
||||
|
||||
LUA_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_config_get_plugin: get value of a plugin option
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_config_get_plugin (lua_State *L)
|
||||
{
|
||||
const char *option;
|
||||
char *value;
|
||||
int n;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get_plugin");
|
||||
LUA_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
option = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 1)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get_plugin");
|
||||
LUA_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
option = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
value = script_api_config_get_plugin (weechat_lua_plugin,
|
||||
lua_current_script,
|
||||
(char *)option);
|
||||
|
||||
LUA_RETURN_STRING(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_config_set_plugin: set value of a plugin option
|
||||
*/
|
||||
|
||||
static int
|
||||
weechat_lua_api_config_set_plugin (lua_State *L)
|
||||
{
|
||||
const char *option, *value;
|
||||
int n;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) L;
|
||||
|
||||
if (!lua_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_set_plugin");
|
||||
LUA_RETURN_ERROR;
|
||||
}
|
||||
|
||||
option = NULL;
|
||||
value = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_set_plugin");
|
||||
LUA_RETURN_ERROR;
|
||||
}
|
||||
|
||||
option = lua_tostring (lua_current_interpreter, -2);
|
||||
value = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
if (script_api_config_set_plugin (weechat_lua_plugin,
|
||||
lua_current_script,
|
||||
(char *)option,
|
||||
(char *)value))
|
||||
LUA_RETURN_OK;
|
||||
|
||||
LUA_RETURN_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_lua_api_prefix: get a prefix, used for display
|
||||
*/
|
||||
@@ -3878,8 +3996,8 @@ weechat_lua_api_bar_search (lua_State *L)
|
||||
static int
|
||||
weechat_lua_api_bar_new (lua_State *L)
|
||||
{
|
||||
const char *name, *type, *conditions, *position, *size, *size_max;
|
||||
const char *separator, *items;
|
||||
const char *name, *type, *conditions, *position, *filling, *size;
|
||||
const char *size_max, *color_fg, *color_bg, *separator, *items;
|
||||
char *result;
|
||||
int n;
|
||||
|
||||
@@ -3896,25 +4014,31 @@ weechat_lua_api_bar_new (lua_State *L)
|
||||
type = NULL;
|
||||
conditions = NULL;
|
||||
position = NULL;
|
||||
filling = NULL;
|
||||
size = NULL;
|
||||
size_max = NULL;
|
||||
color_fg = NULL;
|
||||
color_bg = NULL;
|
||||
separator = NULL;
|
||||
items = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 8)
|
||||
if (n < 11)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
|
||||
LUA_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
name = lua_tostring (lua_current_interpreter, -8);
|
||||
type = lua_tostring (lua_current_interpreter, -7);
|
||||
conditions = lua_tostring (lua_current_interpreter, -6);
|
||||
position = lua_tostring (lua_current_interpreter, -5);
|
||||
size = lua_tostring (lua_current_interpreter, -4);
|
||||
size_max = lua_tostring (lua_current_interpreter, -3);
|
||||
name = lua_tostring (lua_current_interpreter, -11);
|
||||
type = lua_tostring (lua_current_interpreter, -10);
|
||||
conditions = lua_tostring (lua_current_interpreter, -9);
|
||||
position = lua_tostring (lua_current_interpreter, -8);
|
||||
filling = lua_tostring (lua_current_interpreter, -7);
|
||||
size = lua_tostring (lua_current_interpreter, -6);
|
||||
size_max = lua_tostring (lua_current_interpreter, -5);
|
||||
color_fg = lua_tostring (lua_current_interpreter, -4);
|
||||
color_bg = lua_tostring (lua_current_interpreter, -3);
|
||||
separator = lua_tostring (lua_current_interpreter, -2);
|
||||
items = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
@@ -3922,8 +4046,11 @@ weechat_lua_api_bar_new (lua_State *L)
|
||||
(char *)type,
|
||||
(char *)conditions,
|
||||
(char *)position,
|
||||
(char *)filling,
|
||||
(char *)size,
|
||||
(char *)size_max,
|
||||
(char *)color_fg,
|
||||
(char *)color_bg,
|
||||
(char *)separator,
|
||||
(char *)items));
|
||||
|
||||
@@ -4639,6 +4766,9 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
|
||||
{ "config_read", &weechat_lua_api_config_read },
|
||||
{ "config_reload", &weechat_lua_api_config_reload },
|
||||
{ "config_free", &weechat_lua_api_config_free },
|
||||
{ "config_get", &weechat_lua_api_config_get },
|
||||
{ "config_get_plugin", &weechat_lua_api_config_get_plugin },
|
||||
{ "config_set_plugin", &weechat_lua_api_config_set_plugin },
|
||||
{ "prefix", &weechat_lua_api_prefix },
|
||||
{ "color", &weechat_lua_api_color },
|
||||
{ "print", &weechat_lua_api_print },
|
||||
|
||||
@@ -1530,6 +1530,101 @@ static XS (XS_weechat_config_free)
|
||||
PERL_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::config_get: get config option
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_config_get)
|
||||
{
|
||||
char *result;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get");
|
||||
PERL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get");
|
||||
PERL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
result = script_ptr2str (weechat_config_get (SvPV (ST (0), PL_na)));
|
||||
|
||||
PERL_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::config_get_plugin: get value of a plugin option
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_config_get_plugin)
|
||||
{
|
||||
char *value;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get_plugin");
|
||||
PERL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (items < 1)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get_plugin");
|
||||
PERL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
value = script_api_config_get_plugin (weechat_perl_plugin,
|
||||
perl_current_script,
|
||||
SvPV (ST (0), PL_na));
|
||||
|
||||
PERL_RETURN_STRING(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::config_set_plugin: set value of a plugin option
|
||||
*/
|
||||
|
||||
static XS (XS_weechat_config_set_plugin)
|
||||
{
|
||||
char *option, *value;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) cv;
|
||||
|
||||
if (!perl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_set_plugin");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (items < 2)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_set_plugin");
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
option = SvPV (ST (0), PL_na);
|
||||
value = SvPV (ST (1), PL_na);
|
||||
if (script_api_config_set_plugin (weechat_perl_plugin,
|
||||
perl_current_script,
|
||||
option,
|
||||
value))
|
||||
PERL_RETURN_OK;
|
||||
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat::prefix: get a prefix, used for display
|
||||
*/
|
||||
@@ -2764,7 +2859,7 @@ static XS (XS_weechat_buffer_set)
|
||||
if (!perl_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_set");
|
||||
PERL_RETURN_ERROR;
|
||||
PERL_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (items < 3)
|
||||
@@ -3219,8 +3314,8 @@ static XS (XS_weechat_bar_search)
|
||||
|
||||
static XS (XS_weechat_bar_new)
|
||||
{
|
||||
char *result, *name, *type, *conditions, *position, *size, *size_max;
|
||||
char *separator, *bar_items;
|
||||
char *result, *name, *type, *conditions, *position, *filling, *size;
|
||||
char *size_max, *color_fg, *color_bg, *separator, *bar_items;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -3232,7 +3327,7 @@ static XS (XS_weechat_bar_new)
|
||||
PERL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (items < 8)
|
||||
if (items < 11)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
|
||||
PERL_RETURN_EMPTY;
|
||||
@@ -3242,16 +3337,22 @@ static XS (XS_weechat_bar_new)
|
||||
type = SvPV (ST (1), PL_na);
|
||||
conditions = SvPV (ST (2), PL_na);
|
||||
position = SvPV (ST (3), PL_na);
|
||||
size = SvPV (ST (4), PL_na);
|
||||
size_max = SvPV (ST (5), PL_na);
|
||||
separator = SvPV (ST (6), PL_na);
|
||||
bar_items = SvPV (ST (7), PL_na);
|
||||
filling = SvPV (ST (4), PL_na);
|
||||
size = SvPV (ST (5), PL_na);
|
||||
size_max = SvPV (ST (6), PL_na);
|
||||
color_fg = SvPV (ST (7), PL_na);
|
||||
color_bg = SvPV (ST (8), PL_na);
|
||||
separator = SvPV (ST (9), PL_na);
|
||||
bar_items = SvPV (ST (10), PL_na);
|
||||
result = script_ptr2str (weechat_bar_new (name,
|
||||
type,
|
||||
conditions,
|
||||
position,
|
||||
filling,
|
||||
size,
|
||||
size_max,
|
||||
color_fg,
|
||||
color_bg,
|
||||
separator,
|
||||
bar_items));
|
||||
|
||||
@@ -3739,6 +3840,9 @@ weechat_perl_api_init (pTHX)
|
||||
newXS ("weechat::config_read", XS_weechat_config_read, "weechat");
|
||||
newXS ("weechat::config_reload", XS_weechat_config_reload, "weechat");
|
||||
newXS ("weechat::config_free", XS_weechat_config_free, "weechat");
|
||||
newXS ("weechat::config_get", XS_weechat_config_get, "weechat");
|
||||
newXS ("weechat::config_get_plugin", XS_weechat_config_get_plugin, "weechat");
|
||||
newXS ("weechat::config_set_plugin", XS_weechat_config_set_plugin, "weechat");
|
||||
newXS ("weechat::prefix", XS_weechat_prefix, "weechat");
|
||||
newXS ("weechat::color", XS_weechat_color, "weechat");
|
||||
newXS ("weechat::print", XS_weechat_print, "weechat");
|
||||
|
||||
@@ -1626,6 +1626,107 @@ weechat_python_api_config_free (PyObject *self, PyObject *args)
|
||||
PYTHON_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_config_get: get config option
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_config_get (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *option, *result;
|
||||
PyObject *object;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get");
|
||||
PYTHON_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
option = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", &option))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get");
|
||||
PYTHON_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
result = script_ptr2str (weechat_config_get (option));
|
||||
|
||||
PYTHON_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_config_get_plugin: get value of a plugin option
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_config_get_plugin (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *option, *value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get_plugin");
|
||||
PYTHON_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
option = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "s", &option))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get_plugin");
|
||||
PYTHON_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
value = script_api_config_get_plugin (weechat_python_plugin,
|
||||
python_current_script,
|
||||
option);
|
||||
|
||||
PYTHON_RETURN_STRING(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_config_set_plugin: set value of a plugin option
|
||||
*/
|
||||
|
||||
static PyObject *
|
||||
weechat_python_api_config_set_plugin (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *option, *value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) self;
|
||||
|
||||
if (!python_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_set_plugin");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
option = NULL;
|
||||
value = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ss", &option, &value))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_set_plugin");
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (script_api_config_set_plugin (weechat_python_plugin,
|
||||
python_current_script,
|
||||
option,
|
||||
value))
|
||||
PYTHON_RETURN_OK;
|
||||
|
||||
PYTHON_RETURN_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_python_api_prefix: get a prefix, used for display
|
||||
*/
|
||||
@@ -3426,8 +3527,8 @@ weechat_python_api_bar_search (PyObject *self, PyObject *args)
|
||||
static PyObject *
|
||||
weechat_python_api_bar_new (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *name, *type, *conditions, *position, *size, *size_max, *separator;
|
||||
char *items, *result;
|
||||
char *name, *type, *conditions, *position, *filling, *size, *size_max;
|
||||
char *color_fg, *color_bg, *separator, *items, *result;
|
||||
PyObject *object;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -3443,13 +3544,17 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
|
||||
type = NULL;
|
||||
conditions = NULL;
|
||||
position = NULL;
|
||||
filling = NULL;
|
||||
size = NULL;
|
||||
size_max = NULL;
|
||||
color_fg = NULL;
|
||||
color_bg = NULL;
|
||||
separator = NULL;
|
||||
items = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "ssssssss", &name, &conditions, &type,
|
||||
&position, &size, &size_max, &separator, &items))
|
||||
if (!PyArg_ParseTuple (args, "sssssssssss", &name, &conditions, &type,
|
||||
&position, &filling, &size, &size_max, &color_fg,
|
||||
&color_bg, &separator, &items))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
|
||||
PYTHON_RETURN_EMPTY;
|
||||
@@ -3459,8 +3564,11 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
|
||||
type,
|
||||
conditions,
|
||||
position,
|
||||
filling,
|
||||
size,
|
||||
size_max,
|
||||
color_fg,
|
||||
color_bg,
|
||||
separator,
|
||||
items));
|
||||
|
||||
@@ -3975,6 +4083,9 @@ PyMethodDef weechat_python_funcs[] =
|
||||
{ "config_read", &weechat_python_api_config_read, METH_VARARGS, "" },
|
||||
{ "config_reload", &weechat_python_api_config_reload, METH_VARARGS, "" },
|
||||
{ "config_free", &weechat_python_api_config_free, METH_VARARGS, "" },
|
||||
{ "config_get", &weechat_python_api_config_get, METH_VARARGS, "" },
|
||||
{ "config_get_plugin", &weechat_python_api_config_get_plugin, METH_VARARGS, "" },
|
||||
{ "config_set_plugin", &weechat_python_api_config_set_plugin, METH_VARARGS, "" },
|
||||
{ "prefix", &weechat_python_api_prefix, METH_VARARGS, "" },
|
||||
{ "color", &weechat_python_api_color, METH_VARARGS, "" },
|
||||
{ "prnt", &weechat_python_api_prnt, METH_VARARGS, "" },
|
||||
|
||||
@@ -1881,6 +1881,114 @@ weechat_ruby_api_config_free (VALUE class, VALUE config_file)
|
||||
RUBY_RETURN_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_config_get: get config option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_get (VALUE class, VALUE option)
|
||||
{
|
||||
char *c_option, *result;
|
||||
VALUE return_value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get");
|
||||
RUBY_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get");
|
||||
RUBY_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
|
||||
c_option = STR2CSTR (option);
|
||||
|
||||
result = script_ptr2str (weechat_config_get (c_option));
|
||||
|
||||
RUBY_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_config_get_plugin: get value of a plugin option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_get_plugin (VALUE class, VALUE option)
|
||||
{
|
||||
char *c_option, *value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get_plugin");
|
||||
RUBY_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (NIL_P (option))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get_plugin");
|
||||
RUBY_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
|
||||
c_option = STR2CSTR (option);
|
||||
|
||||
value = script_api_config_get_plugin (weechat_ruby_plugin,
|
||||
ruby_current_script,
|
||||
c_option);
|
||||
|
||||
RUBY_RETURN_STRING(value);
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_config_set_plugin: set value of a plugin option
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_config_set_plugin (VALUE class, VALUE option, VALUE value)
|
||||
{
|
||||
char *c_option, *c_value;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
|
||||
if (!ruby_current_script)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_set_plugin");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
if (NIL_P (option) || NIL_P (value))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_set_plugin");
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
Check_Type (option, T_STRING);
|
||||
Check_Type (value, T_STRING);
|
||||
|
||||
c_option = STR2CSTR (option);
|
||||
c_value = STR2CSTR (value);
|
||||
|
||||
if (script_api_config_set_plugin (weechat_ruby_plugin,
|
||||
ruby_current_script,
|
||||
c_option,
|
||||
c_value))
|
||||
RUBY_RETURN_OK;
|
||||
|
||||
RUBY_RETURN_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_ruby_api_prefix: get a prefix, used for display
|
||||
*/
|
||||
@@ -3942,12 +4050,14 @@ weechat_ruby_api_bar_search (VALUE class, VALUE name)
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
|
||||
VALUE position, VALUE size, VALUE size_max,
|
||||
VALUE separator, VALUE items)
|
||||
weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type,
|
||||
VALUE conditions, VALUE position, VALUE filling,
|
||||
VALUE size, VALUE size_max, VALUE color_fg,
|
||||
VALUE color_bg, VALUE separator, VALUE items)
|
||||
{
|
||||
char *c_name, *c_type, *c_conditions, *c_position, *c_size, *c_size_max;
|
||||
char *c_separator, *c_items, *result;
|
||||
char *c_name, *c_type, *c_conditions, *c_position, *c_filling, *c_size;
|
||||
char *c_size_max, *c_color_fg, *c_color_bg, *c_separator, *c_items;
|
||||
char *result;
|
||||
VALUE return_value;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -3963,13 +4073,17 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
|
||||
c_type = NULL;
|
||||
c_conditions = NULL;
|
||||
c_position = NULL;
|
||||
c_filling = NULL;
|
||||
c_size = NULL;
|
||||
c_size_max = NULL;
|
||||
c_color_fg = NULL;
|
||||
c_color_bg = NULL;
|
||||
c_separator = NULL;
|
||||
c_items = NULL;
|
||||
|
||||
if (NIL_P (name) || NIL_P (type) || NIL_P (conditions) || NIL_P (position)
|
||||
|| NIL_P (size) || NIL_P (size_max) || NIL_P (separator)
|
||||
|| NIL_P (filling) || NIL_P (size) || NIL_P (size_max)
|
||||
|| NIL_P (color_fg) || NIL_P (color_bg) || NIL_P (separator)
|
||||
|| NIL_P (items))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
|
||||
@@ -3980,8 +4094,11 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
|
||||
Check_Type (type, T_STRING);
|
||||
Check_Type (conditions, T_STRING);
|
||||
Check_Type (position, T_STRING);
|
||||
Check_Type (filling, T_STRING);
|
||||
Check_Type (size, T_STRING);
|
||||
Check_Type (size_max, T_STRING);
|
||||
Check_Type (color_fg, T_STRING);
|
||||
Check_Type (color_bg, T_STRING);
|
||||
Check_Type (separator, T_STRING);
|
||||
Check_Type (items, T_STRING);
|
||||
|
||||
@@ -3989,8 +4106,11 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
|
||||
c_type = STR2CSTR (type);
|
||||
c_conditions = STR2CSTR (conditions);
|
||||
c_position = STR2CSTR (position);
|
||||
c_filling = STR2CSTR (filling);
|
||||
c_size = STR2CSTR (size);
|
||||
c_size_max = STR2CSTR (size_max);
|
||||
c_color_fg = STR2CSTR (color_fg);
|
||||
c_color_bg = STR2CSTR (color_bg);
|
||||
c_separator = STR2CSTR (separator);
|
||||
c_items = STR2CSTR (items);
|
||||
|
||||
@@ -3998,8 +4118,11 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
|
||||
c_type,
|
||||
c_conditions,
|
||||
c_position,
|
||||
c_filling,
|
||||
c_size,
|
||||
c_size_max,
|
||||
c_color_fg,
|
||||
c_color_bg,
|
||||
c_separator,
|
||||
c_items));
|
||||
|
||||
@@ -4561,6 +4684,9 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
rb_define_module_function (ruby_mWeechat, "config_read", &weechat_ruby_api_config_read, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_reload", &weechat_ruby_api_config_reload, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_free", &weechat_ruby_api_config_free, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_get", &weechat_ruby_api_config_get, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_get_plugin", &weechat_ruby_api_config_get_plugin, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "config_set_plugin", &weechat_ruby_api_config_set_plugin, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "prefix", &weechat_ruby_api_prefix, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "color", &weechat_ruby_api_color, 1);
|
||||
rb_define_module_function (ruby_mWeechat, "print", &weechat_ruby_api_print, 2);
|
||||
@@ -4599,7 +4725,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
rb_define_module_function (ruby_mWeechat, "bar_item_update", &weechat_ruby_api_bar_item_update, 1);
|
||||
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, 8);
|
||||
rb_define_module_function (ruby_mWeechat, "bar_new", &weechat_ruby_api_bar_new, 11);
|
||||
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);
|
||||
|
||||
@@ -1158,7 +1158,7 @@ script_api_command (struct t_weechat_plugin *weechat_plugin,
|
||||
|
||||
/*
|
||||
* script_api_config_get_plugin: get a value of a script option
|
||||
* format in file is: plugin.script.option=value
|
||||
* format in file is: plugin.script.option = value
|
||||
*/
|
||||
|
||||
char *
|
||||
@@ -1185,7 +1185,7 @@ script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
|
||||
|
||||
/*
|
||||
* script_api_config_set_plugin: set value of a script config option
|
||||
* format in file is: plugin.script.option=value
|
||||
* format in file is: plugin.script.option = value
|
||||
*/
|
||||
|
||||
int
|
||||
|
||||
Reference in New Issue
Block a user