mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 21:06:38 +02:00
Add default template completion (by default: nick or IRC channel)
This commit is contained in:
@@ -550,7 +550,7 @@ weechat_lua_api_list_new (lua_State *L)
|
||||
static int
|
||||
weechat_lua_api_list_add (lua_State *L)
|
||||
{
|
||||
const char *weelist, *data, *where;
|
||||
const char *weelist, *data, *where, *user_data;
|
||||
char *result;
|
||||
int n;
|
||||
|
||||
@@ -566,22 +566,25 @@ weechat_lua_api_list_add (lua_State *L)
|
||||
weelist = NULL;
|
||||
data = NULL;
|
||||
where = NULL;
|
||||
user_data = NULL;
|
||||
|
||||
n = lua_gettop (lua_current_interpreter);
|
||||
|
||||
if (n < 3)
|
||||
if (n < 4)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("list_add");
|
||||
LUA_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
weelist = lua_tostring (lua_current_interpreter, -3);
|
||||
data = lua_tostring (lua_current_interpreter, -2);
|
||||
where = lua_tostring (lua_current_interpreter, -1);
|
||||
weelist = lua_tostring (lua_current_interpreter, -4);
|
||||
data = lua_tostring (lua_current_interpreter, -3);
|
||||
where = lua_tostring (lua_current_interpreter, -2);
|
||||
user_data = lua_tostring (lua_current_interpreter, -1);
|
||||
|
||||
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
|
||||
data,
|
||||
where));
|
||||
where,
|
||||
script_str2ptr (user_data)));
|
||||
|
||||
LUA_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ static XS (XS_weechat_api_list_new)
|
||||
|
||||
static XS (XS_weechat_api_list_add)
|
||||
{
|
||||
char *result, *weelist, *data, *where;
|
||||
char *result, *weelist, *data, *where, *user_data;
|
||||
dXSARGS;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -474,7 +474,7 @@ static XS (XS_weechat_api_list_add)
|
||||
PERL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (items < 3)
|
||||
if (items < 4)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("list_add");
|
||||
PERL_RETURN_EMPTY;
|
||||
@@ -483,9 +483,11 @@ static XS (XS_weechat_api_list_add)
|
||||
weelist = SvPV (ST (0), PL_na);
|
||||
data = SvPV (ST (1), PL_na);
|
||||
where = SvPV (ST (2), PL_na);
|
||||
user_data = SvPV (ST (3), PL_na);
|
||||
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
|
||||
data,
|
||||
where));
|
||||
where,
|
||||
script_str2ptr (user_data)));
|
||||
|
||||
PERL_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
@@ -485,7 +485,7 @@ weechat_python_api_list_new (PyObject *self, PyObject *args)
|
||||
static PyObject *
|
||||
weechat_python_api_list_add (PyObject *self, PyObject *args)
|
||||
{
|
||||
char *weelist, *data, *where, *result;
|
||||
char *weelist, *data, *where, *user_data, *result;
|
||||
PyObject *object;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -500,8 +500,9 @@ weechat_python_api_list_add (PyObject *self, PyObject *args)
|
||||
weelist = NULL;
|
||||
data = NULL;
|
||||
where = NULL;
|
||||
user_data = NULL;
|
||||
|
||||
if (!PyArg_ParseTuple (args, "sss", &weelist, &data, &where))
|
||||
if (!PyArg_ParseTuple (args, "ssss", &weelist, &data, &where, &user_data))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("list_add");
|
||||
PYTHON_RETURN_EMPTY;
|
||||
@@ -509,7 +510,8 @@ weechat_python_api_list_add (PyObject *self, PyObject *args)
|
||||
|
||||
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
|
||||
data,
|
||||
where));
|
||||
where,
|
||||
script_str2ptr (user_data)));
|
||||
|
||||
PYTHON_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
@@ -556,9 +556,10 @@ weechat_ruby_api_list_new (VALUE class)
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
weechat_ruby_api_list_add (VALUE class, VALUE weelist, VALUE data, VALUE where)
|
||||
weechat_ruby_api_list_add (VALUE class, VALUE weelist, VALUE data, VALUE where,
|
||||
VALUE user_data)
|
||||
{
|
||||
char *c_weelist, *c_data, *c_where, *result;
|
||||
char *c_weelist, *c_data, *c_where, *c_user_data, *result;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) class;
|
||||
@@ -572,8 +573,9 @@ weechat_ruby_api_list_add (VALUE class, VALUE weelist, VALUE data, VALUE where)
|
||||
c_weelist = NULL;
|
||||
c_data = NULL;
|
||||
c_where = NULL;
|
||||
c_user_data = NULL;
|
||||
|
||||
if (NIL_P (weelist) || NIL_P (data) || NIL_P (where))
|
||||
if (NIL_P (weelist) || NIL_P (data) || NIL_P (where) || NIL_P (user_data))
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("list_add");
|
||||
RUBY_RETURN_EMPTY;
|
||||
@@ -582,14 +584,17 @@ weechat_ruby_api_list_add (VALUE class, VALUE weelist, VALUE data, VALUE where)
|
||||
Check_Type (weelist, T_STRING);
|
||||
Check_Type (data, T_STRING);
|
||||
Check_Type (where, T_STRING);
|
||||
Check_Type (user_data, T_STRING);
|
||||
|
||||
c_weelist = STR2CSTR (weelist);
|
||||
c_data = STR2CSTR (data);
|
||||
c_where = STR2CSTR (where);
|
||||
c_user_data = STR2CSTR (user_data);
|
||||
|
||||
result = script_ptr2str (weechat_list_add (script_str2ptr(c_weelist),
|
||||
c_data,
|
||||
c_where));
|
||||
c_where,
|
||||
script_str2ptr (c_user_data)));
|
||||
|
||||
RUBY_RETURN_STRING(result);
|
||||
}
|
||||
@@ -6590,7 +6595,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
|
||||
rb_define_module_function (ruby_mWeechat, "mkdir", &weechat_ruby_api_mkdir, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "mkdir_parents", &weechat_ruby_api_mkdir_parents, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "list_new", &weechat_ruby_api_list_new, 0);
|
||||
rb_define_module_function (ruby_mWeechat, "list_add", &weechat_ruby_api_list_add, 3);
|
||||
rb_define_module_function (ruby_mWeechat, "list_add", &weechat_ruby_api_list_add, 4);
|
||||
rb_define_module_function (ruby_mWeechat, "list_search", &weechat_ruby_api_list_search, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "list_casesearch", &weechat_ruby_api_list_casesearch, 2);
|
||||
rb_define_module_function (ruby_mWeechat, "list_get", &weechat_ruby_api_list_get, 2);
|
||||
|
||||
@@ -622,7 +622,7 @@ weechat_tcl_api_list_add (ClientData clientData, Tcl_Interp *interp,
|
||||
int objc, Tcl_Obj *CONST objv[])
|
||||
{
|
||||
Tcl_Obj* objp;
|
||||
char *result, *weelist, *data, *where;
|
||||
char *result, *weelist, *data, *where, *user_data;
|
||||
int i;
|
||||
|
||||
/* make C compiler happy */
|
||||
@@ -635,7 +635,7 @@ weechat_tcl_api_list_add (ClientData clientData, Tcl_Interp *interp,
|
||||
TCL_RETURN_EMPTY;
|
||||
}
|
||||
|
||||
if (objc < 4)
|
||||
if (objc < 5)
|
||||
{
|
||||
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("list_add");
|
||||
TCL_RETURN_EMPTY;
|
||||
@@ -644,9 +644,11 @@ weechat_tcl_api_list_add (ClientData clientData, Tcl_Interp *interp,
|
||||
weelist = Tcl_GetStringFromObj (objv[1], &i);
|
||||
data = Tcl_GetStringFromObj (objv[2], &i);
|
||||
where = Tcl_GetStringFromObj (objv[3], &i);
|
||||
user_data = Tcl_GetStringFromObj (objv[4], &i);
|
||||
result = script_ptr2str (weechat_list_add (script_str2ptr (weelist),
|
||||
data,
|
||||
where));
|
||||
where,
|
||||
script_str2ptr (user_data)));
|
||||
|
||||
TCL_RETURN_STRING_FREE(result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user